diff --git a/README.md b/README.md index b544fd5c..8d01cb94 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,15 @@ Final demo is one of the sequence to sequence tasks, machine translation. Since ![Machine Translation](./docs/translation.gif) +## Deployment + +### Azure + +Doccano can be deployed to Azure ([Web App for Containers](https://azure.microsoft.com/en-us/services/app-service/containers/) + +[PostgreSQL database](https://azure.microsoft.com/en-us/services/postgresql/)) by clicking on the button below: + +[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fchakki-works%2Fdoccano%2Fmaster%2Fazuredeploy.json) + ## Features * Collaborative annotation diff --git a/azuredeploy.json b/azuredeploy.json new file mode 100644 index 00000000..b44b7ed6 --- /dev/null +++ b/azuredeploy.json @@ -0,0 +1,197 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appName":{ + "type": "string", + "minLength": 1, + "metadata": { + "description": "The name for the webapp. Must be globally unique." + } + }, + "secretKey":{ + "type": "securestring", + "minLength": 16, + "metadata": { + "description": "The value to use as the Django secret key." + } + }, + "adminUserName":{ + "type": "string", + "minLength": 1, + "metadata": { + "description": "The user name for the Postgres administrator" + } + }, + "adminPassword":{ + "type": "securestring", + "minLength": 16, + "metadata": { + "description": "The password for the Postgres administrator" + } + }, + "appServiceSku": { + "type": "string", + "defaultValue": "B2", + "allowedValues": [ + "B1", + "B2", + "B3", + "S1", + "S2", + "S3" + ], + "metadata": { + "description": "The SKU of the webapp hosting tier." + } + }, + "databaseCores": { + "type": "int", + "defaultValue": 2, + "allowedValues": [ + 2, + 4, + 8, + 16, + 32, + 64 + ], + "metadata": { + "description": "The number of vCores to provision for the PostgreSQL server." + } + }, + "databaseSize": { + "type": "int", + "minValue": 51200, + "defaultValue": 51200, + "metadata": { + "description": "The storage capacity to provision for the PostgreSQL server." + } + }, + "databaseName": { + "type": "string", + "minLength": 1, + "defaultValue": "doccano", + "metadata": { + "description": "The name of the database to provision on the PostgreSQL server." + } + }, + "dockerImageName": { + "type": "string", + "minLength": 1, + "defaultValue": "cwolff/doccano:latest", + "metadata": { + "description": "The Docker image to deploy." + } + } + }, + "variables": { + "location": "[resourceGroup().location]", + "databaseSkuTier": "GeneralPurpose", + "databaseSkuFamily": "Gen5", + "databaseSkuName": "[concat('GP_', variables('databaseSkuFamily'), '_', parameters('databaseCores'))]", + "databaseConnectionString": "[concat('pgsql://', parameters('adminUserName'), '@', variables('databaseServerName'), ':', parameters('adminPassword'), '@', variables('databaseServerName'), '.postgres.database.azure.com:5432/', parameters('databaseName'))]", + "databaseVersion": "9.6", + "databaseServerName": "[concat(parameters('appName'),'-state')]", + "appServicePlanName": "[concat(parameters('appName'),'-hosting')]" + }, + "resources": [ + { + "apiVersion": "2017-08-01", + "type": "Microsoft.Web/serverfarms", + "kind": "linux", + "name": "[variables('appServicePlanName')]", + "location": "[variables('location')]", + "properties": { + "reserved": true + }, + "dependsOn": [], + "sku": { + "name": "[parameters('appServiceSku')]" + } + }, + { + "apiVersion": "2017-12-01", + "type": "Microsoft.DBforPostgreSQL/servers", + "location": "[variables('location')]", + "name": "[variables('databaseServerName')]", + "sku": { + "name": "[variables('databaseSkuName')]", + "tier": "[variables('databaseSkuTier')]", + "family": "[variables('databaseSkuFamily')]", + "capacity": "[parameters('databaseCores')]", + "size": "[parameters('databaseSize')]" + }, + "properties": { + "version": "[variables('databaseVersion')]", + "administratorLogin": "[parameters('adminUserName')]", + "administratorLoginPassword": "[parameters('adminPassword')]", + "storageMB": "[parameters('databaseSize')]" + }, + "resources": [ + { + "name": "allowAzure", + "type": "firewallrules", + "apiVersion": "2017-12-01", + "location": "[variables('location')]", + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + }, + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers/', variables('databaseServerName'))]" + ] + }, + { + "name": "[parameters('databaseName')]", + "type": "databases", + "apiVersion": "2017-12-01", + "properties": { + "charset": "utf8", + "collation": "English_United States.1252" + }, + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers/', variables('databaseServerName'))]" + ] + } + ] + }, + { + "type": "Microsoft.Web/sites", + "apiVersion": "2016-08-01", + "name": "[parameters('appName')]", + "kind": "app,linux,container", + "location": "[variables('location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers/', variables('databaseServerName'))]", + "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]" + ], + "properties": { + "name": "[parameters('appName')]", + "siteConfig": { + "linuxFxVersion": "[concat('DOCKER|', parameters('dockerImageName'))]", + "alwaysOn": true, + "appSettings": [ + { + "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE", + "value": "false" + }, + { + "name": "DEBUG", + "value": "False" + }, + { + "name": "SECRET_KEY", + "value": "[parameters('secretKey')]" + }, + { + "name": "DATABASE_URL", + "value": "[variables('databaseConnectionString')]" + } + ] + }, + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]" + } + } + ] +}