This document shows you step-by-step how to deploy xDM Server Container to Azure App Service.  I assume you have completed the tutorial of Install Semarchy xDM on Docker.  We will be deploying the xDM Server Container pointing to an existing Azure SQL Server with an empty semarchy repository database.  


1. Modify the "docker-compose.yml" (refer to the section Configure and run your Docker container), the xDM Application Server Container will be pointing to an existing Azure SQL Server. 


version: '3.8'
networks:
  semarchy-net:
    driver: bridge

services:
  semarchy-appserver-azure:
    image: semarchy/xdm:latest
    ports:
      - '8088:8080'
    networks:
      - semarchy-net
    healthcheck:
      test: ["CMD", "curl", "-f", "http://semarchy-appserver-azure:8088/semarchy/api/rest/probes/started"]
    environment:
      # Repository connection, pointing to the semarchy-database service.
      # Reconfigure this connection to use a separate database.
      # Azure Database for PostgreSQL
      # Azure SQL Database
      - XDM_REPOSITORY_DRIVER=com.microsoft.sqlserver.jdbc.SQLServerDriver
      - XDM_REPOSITORY_URL=jdbc:sqlserver://azuresqldb.database.windows.net:1433;databaseName=semarchy_repository
      - XDM_REPOSITORY_USERNAME=semarchy_repository
      - XDM_REPOSITORY_PASSWORD=(Your Password)
      # Repository read-only datasource credentials
      - XDM_REPOSITORY_READONLY_USERNAME=semarchy_repository_ro
      - XDM_REPOSITORY_READONLY_PASSWORD=(Your Password)
      # Setup Token
      - SEMARCHY_SETUP_TOKEN=mySecretValue
      # Add other startup configuration properties below. For example, secrets management configuration
      # See http://semarchy.com/doc/semarchy-xdm/xdm/5.3/Install/startup-configuration.html
    volumes:
      # Volume for additional JAR libraries
      - ./additional-libraries:/usr/local/tomcat/additional-libraries


2. Run the following command, a docker container and image will be stored in the local docker desktop:

docker compose up --attach semarchy-appserver-azure --no-log-prefix


3. Create a Container Registry in Azure, say xdmcr


4. Install the Azure Command Line

5. Login to Azure Container Registry in the Command Prompt

C:\>az login
 
C:\>az acr login --name xdmcr
Login Succeeded

6. Create Access Keys in the Container Registry


7. Login to the Container Registry using the Access Keys as passwords


C:\>docker login xdmcr.azurecr.io
Username: xdmcr
Password:
Login Succeeded
 
C:\>docker images
REPOSITORY     TAG       IMAGE ID       CREATED        SIZE
semarchy/xdm   latest    4d3c2d55998e   6 days ago     955MB

8. Tag the local docker image to Azure Container Registry

C:\>docker tag semarchy/xdm:latest xdmcr.azurecr.io/semarchy/xdm
 
C:\>docker images
REPOSITORY                              TAG       IMAGE ID       CREATED     
SIZE
xdmcr.azurecr.io/semarchy/xdm           latest    4d3c2d55998e   6 days ago     955MB
semarchy/xdm                            latest    4d3c2d55998e   6 days ago     955MB

9. Push the docker local image onto Azure Container Registry

C:\>docker push xdmcr.azurecr.io/semarchy/xdm

10. Then you can see the Repositories of the Azure Container Registry contains your docker image

11. Create the Web App for xdm, choose Docker Container

12. Configure the App Service Application Settings, here are the environment variables needed, please refer to the values in your docker-compose.yml file.

13. Set up firewall rules on the Azure SQL Server that allows the Your App Service to access

14. Start the App Service and access the URL :  https://xdmapp.azurewebsites.net/semarchy/login.do
If you see the above page, you are good to go!