diff --git a/StarshipWebApp/.env.example b/StarshipWebApp/.env.example new file mode 100644 index 0000000..e4a273e --- /dev/null +++ b/StarshipWebApp/.env.example @@ -0,0 +1,7 @@ +# === Database === +ConnectionStrings__DefaultConnection=Server=YOUR_SERVER;Database=StarshipDb;User Id=YOUR_USERNAME;Password=YOUR_PASSWORD; + +# === Google OAuth === +Authentication__Google__ClientId=your-google-client-id.apps.googleusercontent.com +Authentication__Google__ClientSecret=your-google-client-secret + diff --git a/StarshipWebApp/Program.cs b/StarshipWebApp/Program.cs index 3748daf..d3717ed 100644 --- a/StarshipWebApp/Program.cs +++ b/StarshipWebApp/Program.cs @@ -12,6 +12,12 @@ var builder = WebApplication.CreateBuilder(args); +builder.Configuration + .AddJsonFile("appsettings.json", optional: false) + .AddEnvironmentVariables(); + + + // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); diff --git a/StarshipWebApp/Properties/ServiceDependencies/DevMandoStarships/profile.arm.json b/StarshipWebApp/Properties/ServiceDependencies/DevMandoStarships/profile.arm.json new file mode 100644 index 0000000..42c418f --- /dev/null +++ b/StarshipWebApp/Properties/ServiceDependencies/DevMandoStarships/profile.arm.json @@ -0,0 +1,120 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_dependencyType": "compute.appService.container" + }, + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "DefaultResourceGroup-CUS", + "metadata": { + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "centralus", + "metadata": { + "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support." + } + }, + "resourceName": { + "type": "string", + "defaultValue": "DevMandoStarships", + "metadata": { + "description": "Name of the main resource to be created by this template." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "variables": { + "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]", + "appServiceContainer_name": "['Container', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]" + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('resourceLocation')]", + "name": "[parameters('resourceName')]", + "type": "Microsoft.Web/sites", + "apiVersion": "2015-08-01", + "tags": { + "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty" + }, + "dependsOn": [ + "[variables('appServicePlan_ResourceId')]" + ], + "kind": "app", + "properties": { + "name": "[parameters('resourceName')]", + "kind": "app", + "httpsOnly": true, + "reserved": false, + "serverFarmId": "[variables('appServicePlan_ResourceId')]", + "siteConfig": { + "linuxFxVersion": "DOCKER|nginx" + } + }, + "identity": { + "type": "SystemAssigned" + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServicePlan_name')]", + "type": "Microsoft.Web/serverFarms", + "apiVersion": "2015-02-01", + "kind": "linux", + "properties": { + "name": "[variables('appServicePlan_name')]", + "sku": "Standard", + "workerSizeId": "0", + "reserved": true + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServiceContainer_name')]", + "type": "Microsoft.ContainerRegistry/registries", + "apiVersion": "2017-10-01", + "sku": { + "name": "Standard" + }, + "properties": { + "tenantId": "[subscription().tenantId]", + "adminUserEnabled": false + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/StarshipWebApp/docker-compose.yml b/StarshipWebApp/docker-compose.yml new file mode 100644 index 0000000..1b73e34 --- /dev/null +++ b/StarshipWebApp/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.9' + +services: + web: + build: . + ports: + - "8080:80" + environment: + Authentication__Google__ClientId: ${GOOGLE_CLIENT_ID} + Authentication__Google__ClientSecret: ${GOOGLE_CLIENT_SECRET} + ConnectionStrings__DefaultConnection: ${CONNECTIONSTRINGS__DEFAULTCONNECTION}