Azure App Service
Last updated
Last updated
Azure App Service is a fully managed platform-as-a-service (PaaS) that allows developers to build, deploy, and scale web, mobile, and API applications.
Within your Azure App Service Dashboard, click on + Create at the top left of the page above the Filter for any field.
This will navigate you to a page called Create Web App.
On the Basics Tab enter these settings.
Under Project Details choose a Subscription
Under the Project Details choose a Resource Group
Under Instance Details enter an App Service Name.
Under Instance Details select Docker Container as the Publish method.
Under Instance Details choose Linux as the Operating System.
Under Instance Details select a Region.
Recommend using the same region that your Cosmos DB is running in. Be aware that choosing certain regions will affect your options for Zone redundancy.
Under Pricing Plans choose a Linux Plan. Dependent on the chosen region.
Under Pricing Plans choose a Pricing Plan that is suitable for your environment requirements. Dependent on the chosen region.
NOTE: Availability of instance types will vary across regions.
NOTE: Single Container deployment of Azure App Service does not require the use of a Nginx container deployment.
On the Docker Tab enter these settings.
For Options select Single Container.
For Image Source choose Docker Hub.
Under Docker hub options for Access Type choose Public
Under Docker hub options for Image and Tag enter path to the image on API Server Docker Hub Registry. Example: formio/formio-enterprise:9.0.0
On the Review + create tab review the App Service settings then press the Create button.
To deploy the PDF server repeat the steps in Create Azure App Service
On the Docker Tab enter these settings.
For Options select Single Container.
For Image Source choose Docker Hub.
Under Docker hub options for Access Type choose Public
Under Docker hub options for Image and Tag enter path to the image on PDF Server Docker Hub Registry. Example: formio/pdf-server:5.5.2
On the Review + create tab review the App Service settings then press the Create button.
Upon completion of the previous steps of the Single Container deployment on Azure App Service you can skip the "Multi-container Azure App Service" section and continue with steps following Adding Environment Variables.
NOTE: Azure App Service option for Docker Compose has been in Preview.
Preview features let you opt in to new functionality before it's released. Some preview features are available to anyone who wants to opt in.
Review Microsoft Azure Preview Policy before utilizing the multi-container deployment.
In this section, we will deploy a docker-compose.yml file to Azure App Service and connect it to the Cosmos DB and Blob Storage services previously mentioned.
On the Docker Tab enter these settings.
For Options select Docker Compose (Preview).
For Image Source choose Docker Hub.
Under Docker hub options for Access Type choose Public
For your Configuration File select the docker-compose.yml
from the downloaded zip at the top of this page.
On the Review + create tab review the App Service settings then press the Create button.
From the App Service Dashboard on the left side navigation panel, locate Development Tools and select Advanced Tools option. Then the Go-> button.
This will take you to a Advanced Tools section for the deployment where you can view container logs, application settings, and deployment information.
At the top of the page click the link that says Bash, which will navigate into a terminal window where we were can create our default.conf
file for our Nginx proxy container.
In the terminal when run the following commands to navigate to the correct directory, create a conf.d
folder inside of ~/site/wwwroot
then inside the conf.d
folder create a file called default.conf
that our Nginx container will use to proxy traffic to the correct containers.
You will then copy the default.conf
from the formio-multicontainer-azure-app-service.zip at the top of the page and save the file by typing :wq and pressing Enter.
To verify that this worked you can go back to the Advanced Tools page and click on the link at the bottom of the page under Browse Directory section where it says Site wwwroot
Once the App Service resource has been created you should have clicked Go to Resource, where you will be directed to an Overview page for the App Service.
On the left-side column underneath the Settings section select Configuration.
Once on the Configuration page click on Advanced Edit.
Copy and Paste the json from env.json in the azure-app-service-multcontainer.zip above.
Edit the environment variables to for your environment before clicking OK.
Once you've finished editing your environment variables in the Advanced Editing section click Save button to persist your current configuration.
LICENSE_KEY
Form.io Enterprise license key
<formio-enterprise-license>
PORT
Port API server will be served on
3000
DEBUG
Application Logging Settings.
Less Verbose: "formio.*" Most Verbose: "*.*"
PORTAL_ENABLED
Used to enable or disable the developer portal within a remote environment.
true
MONGO
Defines your MongoDB compatiable database string.
mongodb://formio-cosmos-db:@:10255/formio?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@formio-cosmos-db@
ADMIN_EMAIL
Used to set the email address of the default root user login when the PORTAL_ENABLED variable is set to "true".
admin@example.com
ADMIN_PASS
Used to set the password of the default root user login.
CHANGEME
DB_SECRET
The database encryption secret
CHANGEME
JWT_SECRET
Used as the secret for JWT token encryption. It is used to generate and validate JSON Web Tokens (JWT) for authentication purposes.
CHANGEME
PDF_SERVER
Used to specify the URL or IP address of the PDF server or load balancer. If you are not using Web PDFs and only need to generate PDFs of submissions, you do not need to make the PDF server available on the internet and it only needs to be accessible to the Form.io Server.
Docker Compose: http://pdf-server:4005 Single Container: https://formio-pdf-server.azurewebsites.net (PDF App Service Default Domain)
MONGO
Defines your MongoDB compatiable database string.
mongodb://formio-cosmos-db:@:10255/formio?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@formio-cosmos-db@
LICENSE_KEY
Form.io Enterprise license key
<formio-enterprise-license>
FORMIO_AZURE_CONNECTION_STRING
Connection string for accessing the Azure Blob Storage. Configures project's File Storage settings and the PDF Server.
DefaultEndpointsProtocol=https;AccountName=formioblobstoragecontainer;AccountKey=;EndpointSuffix=core.windows.net
FORMIO_AZURE_CONTAINER
Specifies the name of the container in Azure Blob Storage where the files will be stored.
formio-blob-storage-container
FORMIO_PDF_PORT
Port PDF server will be served from.
4005
DEBUG
Application Logging Settings.
Less Verbose: "pdf.*" Most Verbose: "*.*"
The logs are not turned on by default so as a last step go to App Service Logs on the side bar underneath the Monitoring section.
Where it says Application Logging toggle it to File System, and set some quota thresholds and a log retention period.
If you followed along and reach this point and are receiving connection issues with the database. The most likely cause is that you will need to register the Azure App Service IP address with your Cosmos DB Firewall.
In the Overview page of the Azure App Service, copy the Virtual IP address under the Networking section.
To add your IP to the Firewall settings in Cosmos DB first select the database. Then in the left bar under Settings select the Networking option.
In the Firewall section of the Cosmos DB Networking page add the Virtual IP address from the Azure App Service Networking section.