Language: English
This guide walks you through deploying the ActivityInfo Self-managed Server as an Azure Web App for Containers, using the official Docker image. It is intended for IT professionals who are familiar with Microsoft Azure.
Before you start
The ActivityInfo Self-managed Server stores its data in an SQLite database. This has two consequences for an Azure Web App deployment:
- You must attach a persistent volume for the database, because a Web App's own file system is reset each time the container is restarted or moved.
- You must run a single instance. The server is designed to scale vertically, not horizontally: to support more concurrent users, give the instance more CPU cores and memory rather than adding instances.
Azure App Service also terminates the HTTPS connection for you and forwards plain HTTP to the container. You therefore run ActivityInfo in HTTPS proxy mode.
The steps below use the Azure CLI. You can run the same steps from the Azure portal if you prefer. Sign in first with:
az login
Set variables
The commands in this guide reuse a few values. Set them once, choosing your own globally unique app and storage account names:
RESOURCE_GROUP=activityinfo-rg
LOCATION=westeurope
PLAN=activityinfo-plan
APP=my-activityinfo
STORAGE_ACCOUNT=aistorage$RANDOM
SHARE=activityinfo-data
Create a resource group
az group create --name $RESOURCE_GROUP --location $LOCATION
Create a Linux App Service plan
Create a Linux plan with a single worker. The Basic B1 tier or higher is required for custom storage, a custom domain, and the "Always On" setting.
az appservice plan create \
--name $PLAN \
--resource-group $RESOURCE_GROUP \
--location $LOCATION \
--is-linux \
--sku B1 \
--number-of-workers 1
Create a file share for the database
Create a storage account and an Azure Files share. ActivityInfo stores its SQLite database and config.ini on this share, so the data survives restarts and redeployments.
az storage account create \
--name $STORAGE_ACCOUNT \
--resource-group $RESOURCE_GROUP \
--location $LOCATION \
--sku Standard_LRS
az storage share-rm create \
--resource-group $RESOURCE_GROUP \
--storage-account $STORAGE_ACCOUNT \
--name $SHARE \
--quota 10
Create the web app
Create the web app from the official ActivityInfo image on Docker Hub:
az webapp create \
--resource-group $RESOURCE_GROUP \
--plan $PLAN \
--name $APP \
--container-image-name activityinfo/activityinfo:5.0.0
Mount the file share
Mount the file share into the container at /data. First read the storage account key, then add the mount:
STORAGE_KEY=$(az storage account keys list \
--resource-group $RESOURCE_GROUP \
--account-name $STORAGE_ACCOUNT \
--query "[0].value" --output tsv)
az webapp config storage-account add \
--resource-group $RESOURCE_GROUP \
--name $APP \
--custom-id activityinfo-data \
--storage-type AzureFiles \
--account-name $STORAGE_ACCOUNT \
--share-name $SHARE \
--access-key $STORAGE_KEY \
--mount-path /data
Configure ActivityInfo
Set the application settings. WEBSITES_PORT tells App Service that the container listens on port 8081. The ACTIVITYINFO_* variables put the server in HTTPS proxy mode and point its data directory at the mounted share.
az webapp config appsettings set \
--resource-group $RESOURCE_GROUP \
--name $APP \
--settings \
WEBSITES_PORT=8081 \
ACTIVITYINFO_SERVER_HTTPS_PROXY=TRUE \
ACTIVITYINFO_SERVER_DOMAIN=$APP.azurewebsites.net \
ACTIVITYINFO_DATA_DATA_DIRECTORY=/data
Enable "Always On" so App Service keeps the container running and does not unload it when the app is idle:
az webapp config set \
--resource-group $RESOURCE_GROUP \
--name $APP \
--always-on true
Create the administrator account
Azure provides a free managed certificate for the azurewebsites.net domain, so the app is available over HTTPS immediately. Navigate to https://<APP>.azurewebsites.net, where you are prompted to create the first administrator user account.
Use a custom domain
To serve ActivityInfo from your own domain, add a custom domain and a managed certificate to the web app. Then update the ACTIVITYINFO_SERVER_DOMAIN setting to match, so that links in notification emails use the correct address:
az webapp config appsettings set \
--resource-group $RESOURCE_GROUP \
--name $APP \
--settings ACTIVITYINFO_SERVER_DOMAIN=activityinfo.example.gov
Storage performance
The file share mounted above is Azure Files, a network file system that the container reaches over the SMB protocol. Every read and write travels over the network, which adds latency compared to a local disk. Databases perform many small, synchronous writes and holds file locks during transactions, so they are sensitive to this latency. On a busy server, the share can become the limiting factor for response times. A Web App for Containers can only attach network storage, so this trade-off applies to any single-instance deployment on App Service.
If you need higher database performance, deploy on Azure Kubernetes Service instead. There you can attach a Premium SSD v2 managed disk to a single pod, which gives near-local-disk latency with configurable IOPS while still surviving the loss of a node.
Next steps
Follow the Configuration guide to set up Email delivery and Single Sign-On through the web-based interface.