From b8d7cd0f2c292dfb3bf9fa52957049a36a8a0105 Mon Sep 17 00:00:00 2001 From: Lorenz Padberg Date: Tue, 2 May 2023 15:21:18 +0200 Subject: [PATCH] Add requirments file for azure --- env/azure/azure-infos.md | 21 ++++ env/azure/commands.sh | 11 ++ env/azure/vbv-prod.json | 213 +++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 4 files changed, 246 insertions(+) create mode 100644 env/azure/azure-infos.md create mode 100644 env/azure/commands.sh create mode 100644 env/azure/vbv-prod.json create mode 100644 requirements.txt diff --git a/env/azure/azure-infos.md b/env/azure/azure-infos.md new file mode 100644 index 00000000..d26cc489 --- /dev/null +++ b/env/azure/azure-infos.md @@ -0,0 +1,21 @@ +# VBV installstion on Azure + +## Prerequisites + +- Azure subscription +- Azure CLI + + +## For this project we use the +vbv resource group. + +[Azure app services tutorial](https://learn.microsoft.com/en-us/azure/app-service/media/tutorial-python-postgresql-app/python-postgresql-app-architecture-240px.png) +![](https://learn.microsoft.com/en-us/azure/app-service/media/tutorial-python-postgresql-app/python-postgresql-app-architecture-240px.png) +For the app we use azure app services, wiht a potgres database. + + + +Deployment for django: +https://tonybaloney.github.io/posts/django-on-azure-beyond-hello-world.html + +az webapp deployment user set --user-name --password diff --git a/env/azure/commands.sh b/env/azure/commands.sh new file mode 100644 index 00000000..64e5d7e2 --- /dev/null +++ b/env/azure/commands.sh @@ -0,0 +1,11 @@ +# create a webapp deploment user +# you can not run these command wiht the free tier subscription... at least developer tier is needed. +az webapp deployment user set --user-name iterativ_developer --password 1password + +# Create plans for stage and prod +az appservice plan create --name stage --resource-group VBV --sku P1V2 --is-linux +az appservice plan create --name prod --resource-group VBV --sku P2V2 --is-linux + +# create the two applications on Python 3.10, change +az webapp create --resource-group VBV --plan stage --name app-stage --runtime "PYTHON|3.10" --deployment-local-git +az webapp create --resource-group VBV --plan prod --name app-prod --runtime "PYTHON|3.10" --deployment-local-git diff --git a/env/azure/vbv-prod.json b/env/azure/vbv-prod.json new file mode 100644 index 00000000..ea449371 --- /dev/null +++ b/env/azure/vbv-prod.json @@ -0,0 +1,213 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "sites_vbv_prod_name": { + "defaultValue": "vbv-prod", + "type": "String" + }, + "serverfarms_prod_externalid": { + "defaultValue": "/subscriptions/b93dcf47-7d82-4af9-8dbc-3317650d0ad7/resourceGroups/VBV/providers/Microsoft.Web/serverfarms/prod", + "type": "String" + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Web/sites", + "apiVersion": "2022-09-01", + "name": "[parameters('sites_vbv_prod_name')]", + "location": "Switzerland North", + "kind": "app,linux", + "properties": { + "enabled": true, + "hostNameSslStates": [ + { + "name": "[concat(parameters('sites_vbv_prod_name'), '.azurewebsites.net')]", + "sslState": "Disabled", + "hostType": "Standard" + }, + { + "name": "[concat(parameters('sites_vbv_prod_name'), '.scm.azurewebsites.net')]", + "sslState": "Disabled", + "hostType": "Repository" + } + ], + "serverFarmId": "[parameters('serverfarms_prod_externalid')]", + "reserved": true, + "isXenon": false, + "hyperV": false, + "vnetRouteAllEnabled": false, + "vnetImagePullEnabled": false, + "vnetContentShareEnabled": false, + "siteConfig": { + "numberOfWorkers": 1, + "linuxFxVersion": "PYTHON|3.10", + "acrUseManagedIdentityCreds": false, + "alwaysOn": true, + "http20Enabled": false, + "functionAppScaleLimit": 0, + "minimumElasticInstanceCount": 0 + }, + "scmSiteAlsoStopped": false, + "clientAffinityEnabled": false, + "clientCertEnabled": false, + "clientCertMode": "Required", + "hostNamesDisabled": false, + "customDomainVerificationId": "A2AB57353045150ADA4488FAA8AA9DFBBEDDD311934653F55243B336C2F3358E", + "containerSize": 0, + "dailyMemoryTimeQuota": 0, + "httpsOnly": true, + "redundancyMode": "None", + "publicNetworkAccess": "Enabled", + "storageAccountRequired": false, + "keyVaultReferenceIdentity": "SystemAssigned" + } + }, + { + "type": "Microsoft.Web/sites/basicPublishingCredentialsPolicies", + "apiVersion": "2022-09-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/ftp')]", + "location": "Switzerland North", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ], + "properties": { + "allow": false + } + }, + { + "type": "Microsoft.Web/sites/basicPublishingCredentialsPolicies", + "apiVersion": "2022-09-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/scm')]", + "location": "Switzerland North", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ], + "properties": { + "allow": false + } + }, + { + "type": "Microsoft.Web/sites/config", + "apiVersion": "2022-09-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/web')]", + "location": "Switzerland North", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ], + "properties": { + "numberOfWorkers": 1, + "defaultDocuments": [ + "Default.htm", + "Default.html", + "Default.asp", + "index.htm", + "index.html", + "iisstart.htm", + "default.aspx", + "index.php", + "hostingstart.html" + ], + "netFrameworkVersion": "v4.0", + "linuxFxVersion": "PYTHON|3.10", + "requestTracingEnabled": false, + "remoteDebuggingEnabled": false, + "remoteDebuggingVersion": "VS2019", + "httpLoggingEnabled": false, + "acrUseManagedIdentityCreds": false, + "logsDirectorySizeLimit": 35, + "detailedErrorLoggingEnabled": false, + "publishingUsername": "$vbv-prod", + "scmType": "BitbucketGit", + "use32BitWorkerProcess": true, + "webSocketsEnabled": false, + "alwaysOn": true, + "managedPipelineMode": "Integrated", + "virtualApplications": [ + { + "virtualPath": "/", + "physicalPath": "site\\wwwroot", + "preloadEnabled": true + } + ], + "loadBalancing": "LeastRequests", + "experiments": { + "rampUpRules": [] + }, + "autoHealEnabled": false, + "vnetRouteAllEnabled": false, + "vnetPrivatePortsCount": 0, + "publicNetworkAccess": "Enabled", + "localMySqlEnabled": false, + "ipSecurityRestrictions": [ + { + "ipAddress": "Any", + "action": "Allow", + "priority": 2147483647, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scmIpSecurityRestrictions": [ + { + "ipAddress": "Any", + "action": "Allow", + "priority": 2147483647, + "name": "Allow all", + "description": "Allow all access" + } + ], + "scmIpSecurityRestrictionsUseMain": false, + "http20Enabled": false, + "minTlsVersion": "1.2", + "scmMinTlsVersion": "1.2", + "ftpsState": "Disabled", + "preWarmedInstanceCount": 0, + "elasticWebAppScaleLimit": 0, + "functionsRuntimeScaleMonitoringEnabled": false, + "minimumElasticInstanceCount": 0, + "azureStorageAccounts": {} + } + }, + { + "type": "Microsoft.Web/sites/deployments", + "apiVersion": "2022-09-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/96334b4eb6a7ae5b0d86abd7febcbcc67323bb94')]", + "location": "Switzerland North", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ], + "properties": { + "status": 4, + "author_email": "ramon.wenger@iterativ.ch", + "author": "Ramon Wenger", + "message": "Merged in feature/VBV-304-praesenztag-ui (pull request #65)\n \n Feature/VBV-304 praesenztag ui\n \n Approved-by: Daniel Egger", + "start_time": "2023-05-02T12:43:38.4426574Z", + "end_time": "2023-05-02T12:43:58.307067Z", + "active": true + } + }, + { + "type": "Microsoft.Web/sites/hostNameBindings", + "apiVersion": "2022-09-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/', parameters('sites_vbv_prod_name'), '.azurewebsites.net')]", + "location": "Switzerland North", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ], + "properties": { + "siteName": "vbv-prod", + "hostNameType": "Verified" + } + }, + { + "type": "Microsoft.Web/sites/snapshots", + "apiVersion": "2015-08-01", + "name": "[concat(parameters('sites_vbv_prod_name'), '/2023-05-02T12_40_23_4355704')]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('sites_vbv_prod_name'))]" + ] + } + ] +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..3ea08861 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-r server/requirements/requirements.txt