The database is running and the team found out that you can run multi-container application in an Azure Web App as well. The DevOps team has successfully automated the deployment of these Azure Resources. Now it is time to start running the application in the cloud. The team already uses docker compose to build the containers, to test the application locally and to push them to the GitHub Container Registry. Now it is time to run the application in the cloud without redoing all the work!
In this challenge you will run the WEB and API application in an Azure Web App, using the multi-container Web App, while it connects with the CosmosDB. The INIT container, that was pushed to the registry as well, can be run from your codespace while connected to the CosmosDB to populate the CosmosDB.
-
To deploy a multi-container application to an Azure Web App use the
az webapp config container --multicontainer-config-file --multicontainer-config-type COMPOSE
command. -
To be able to pull a container from the GitHub Container Registry in to the Azure Web app, you need to configure the Docker registry in the
az webapp config
command using thedocker-registry-server-password
,docker-registry-server-url
anddocker-registry-server-user
switches. -
To populate the CosmosDB run the fabrikam-init container with
MONGODB_CONNECTION
environment variable set to the CosmosDB -
To be able to access the CosmosDB, set an Application Setting
MONGODB_CONNECTION
variable in the Web App Configuration with the connection string to the CosmosDB
- Docker compose file deployed to Azure Web App
- Web application showing the conference site
- API showing data from the CosmosDB
- Web site is accessible via Public IP address
- Deployed the fabrikam-init container to the cluster that connects to the CosmosDB
Tips
Make sure you add the environment variable
CONTENT_API_URL
to the web service in the docker compose fileenvironment: CONTENT_API_URL: http://api:3001Make sure you add the environment variable
MONGODB_CONNECTION
to the API service in the docker compose fileenvironment: MONGODB_CONNECTION: mongodb://mongo:27017/contentdb
If you are stuck or you want to progress to the next challenge, there is a solution prepared for you. When you run the following command from the PowerShell Terminal, a Pull Request with the files and instructions will be created for you.
Workshop-Step Solution "MOVECLOUD-T002"
To read or view a step by step explanation of this challenge, please visit this page
When you are done, move to the next challenge