Prerequisites
- Access to Simplifier Runtime Container @ Dockerhub
- Access to Azure-CLI Docker container on Docker Hub
Get bash working with Azure-CLI Docker container on Docker Hub microsoft/azure-cli
docker pull microsoft/azure-cli docker run -it microsoft/azure-cli
Variables to configure as you need
subscription=<YourAzureSubscription> indentifier=simplifier resource="$identifierresource" location="eastus" DNS_NAME_LABEL="$identifierdns" container_name="$indentifierruntime" image_name=simplifierag/runtime mysql_server_name="$identifiermysqlserver" mysql_server_host="$identifiermysqlserver.mysql.database.azure.com" mysql_database_name="$identifiermysqldatabase" login_mysql_server=mysqladmin login_mysql_db="mysqladmin@$mysql_server_name" password=<ChoosePassword> startIP=0.0.0.0 endIP=0.0.0.0 ACI_PERS_STORAGE_ACCOUNT_NAME="$identifierstorage" ACI_PERS_SHARE_NAME="$identifieracishare"
Login with azure cli
az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <Enter Code> to authenticate.
Set Account Subscription
az account set --subscription $subscription
Create resource group
az group create --name $resource --location $location
Create the storage account with the parameters
Read this manual first https://docs.microsoft.com/de-de/azure/container-instances/container-instances-volume-azure-files
Switch to –sku Premium_LRS for SSD Storage
az storage account create -g $resource -n $ACI_PERS_STORAGE_ACCOUNT_NAME -l $location --sku Standard_LRS
Create the file share
az storage share create -n $ACI_PERS_SHARE_NAME --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --quota 40
Storage account key
This value can be found using the following command:
STORAGE_KEY=$(az storage account keys list -g $resource --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
Create MySQL Server
# https://docs.microsoft.com/de-de/azure/mysql/quickstart-create-mysql-server-database-using-azure-cli
# https://docs.microsoft.com/en-us/cli/azure/mysql/server?view=azure-cli-latest#az-mysql-server-create
az mysql server create -g $resource -n $mysql_server_name -l $location -u $login_mysql_server -p $password --sku-name GP_Gen5_1 --version 5.7 --ssl-enforcement Disabled --public-network-access Enabled --storage-size 51200
Create a MySQL database
see https://docs.microsoft.com/en-us/cli/azure/mysql/db?view=azure-cli-latest
az mysql db create -g $resource -s $mysql_server_name -n $mysql_database_name
Firewall Rules
see https://docs.microsoft.com/de-de/cli/azure/mysql/server/firewall-rule?view=azure-cli-latest#az-mysql-server-firewall-rule-create
# Check your ISP Ip Adress so you can log in with your Client IP
# client_IP= <Your ISP IP Adress>
az mysql server firewall-rule create -g $resource -s $mysql_server_name -n AllowMyClientIP --start-ip-address $client_IP --end-ip-address $client_IP
Allow Azure services and internet access
az mysql server firewall-rule create -g $resource -s $mysql_server_name -n AllowMyIP --start-ip-address $startIP --end-ip-address $endIP
az mysql server firewall-rule create -g $resource -s $mysql_server_name -n AllowAll --start-ip-address 0.0.0.0 --end-ip-address 255.255.255.255
Create container
See Environment Variables: https://docs.microsoft.com/de-de/learn/modules/run-docker-with-azure-container-instances/4-use-environment-variables
az container create \ --resource-group $resource \ --name $container_name \ --image $image_name \ --cpu 4 \ --memory 32 \ --os-type Linux \ --restart-policy OnFailure \ --ip-address Public \ --ports 8080 8091 \ --dns-name-label $DNS_NAME_LABEL \ --location $location \ --azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME \ --azure-file-volume-account-key $STORAGE_KEY \ --azure-file-volume-share-name $ACI_PERS_SHARE_NAME \ --azure-file-volume-mount-path /opt/simplifier/data \ --environment-variables \ DB=mysql \ MYSQL_HOST=$mysql_server_host \ MYSQL_PORT=3306 \ MYSQL_USER=$login_mysql_db \ MYSQL_PASSWORD=$password \ MYSQL_DB=$mysql_database_name \ PLUGINLIST=keyValueStorePlugin,pdfPlugin,powerSupplyPlugin,wordGeneratorPlugin,kundenMarktplatzPlugin,postCdPlugin,captcha,contentRepoPlugin,jsonStore \ VIRTUAL_HOST=127.0.0.1
Check Deployment Status
az container show --resource-group $resource --name $container_name --query "{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}" --out table
Show Container Logs
az container logs -g $resource -n $container_name
Attach Container Output Stream to Console
az container attach -g $resource -n $container_name