Azure App Service
This section will be an overview on how to
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.
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.
formio-azure-app-service-multicontainer.zip
2KB
Binary
- 1.Within your Azure portal, click on + Create at the top left of the page above the Filter for any field.

- 2.Once you've pressed you will then be directed to a page called Create Web App. The below headings outlines the tabs and sections of this page.
- 3.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, would 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 which is dependent on the chosen region.
NOTE: Availability of instance types will vary across regions.

- 4.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.

## FILE: docker-compose.yml
version: '3'
#########################################################
## DOCKER NETWORK
#########################################################
networks:
formio-network:
driver: bridge
services:
##############################################
## PROXY
##############################################
proxy:
container_name: proxy
image: ryanformio/formio-proxy
ports:
- 80:80
links:
- api-server
- pdf-server
networks:
- formio-network
## Comment out if running locally, for streaming logs to Azure
logging:
driver: stdout
##############################################
## API SERVER
##############################################
api-server:
container_name: api-server
image: formio/formio-enterprise:8.1.0
environment:
PORT: 3000
DEBUG: "formio.*"
PDF_SERVER: http://pdf-server:4005
PORTAL_ENABLED: 1
MONGO: ${MONGO}
LICENSE_KEY: ${LICENSE_KEY}
ADMIN_KEY: ${ADMIN_KEY}
ADMIN_EMAIL: ${ADMIN_EMAIL}
ADMIN_PASS: ${ADMIN_PASS}
DB_SECRET: ${DB_SECRET}
JWT_SECRET: ${JWT_SECRET}
networks:
- formio-network
## Comment out if running locally, for streaming logs to Azure
logging:
driver: stdout
##############################################
## PDF SERVER
##############################################
pdf-server:
container_name: pdf-server
image: formio/pdf-server:5.0.2
ports:
- "4005:4005"
environment:
MONGO: ${MONGO}
LICENSE_KEY: ${LICENSE_KEY}
FORMIO_AZURE_CONNECTION_STRING: ${FORMIO_AZURE_CONNECTION_STRING}
FORMIO_AZURE_CONTAINER: ${FORMIO_AZURE_CONTAINER}
FORMIO_PDF_PORT: 4005
DEBUG: "pdf.*"
networks:
- formio-network
## Comment out if running locally, for streaming logs to Azure
logging:
driver: stdout
- 5.On the Review + create tab review the App Service settings then press the Create button.
- 1.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.
- 2.On the left-side column underneath the Settings section select Configuration.
- 3.Once on the Configuration page click on Advanced Edit.

- 4.Copy and Paste the json from env.json in the azure-app-service-multcontainer.zip above.
- 5.Edit the environment variables to for your environment before clicking OK.

- 6.Once you've finished editing your environment variables in the Advanced Editing section click Save button to persist your current configuration.
- 1.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.
- 2.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.
- 1.In the Overview page of the Azure App Service, copy the Virtual IP address under the Networking section.
- 2.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.
- 3.In the Firewall section of the Cosmos DB Networking page add the Virtual IP address from the Azure App Service Networking section.

Last modified 1mo ago