Deploying SolitX container-apps on Microsoft azure

Pre-requisites

Before creating and deploying the login-service and accessing Swagger via the gateway, make sure there is access for all the details below. Each item lists what it is and where to find it.

  • Docker Hub credentials — Username and password for the Docker registry that hosts the container image.

    • Example: username: solitx (Don’t have access to the credentials? → Ask project’s Admin).

  • Docker image — The exact image name and tag to deploy (this is the image that will run in Azure).

    • Docker URL for login service solitx : Docker URl for Login service

    • Example: solitx/loginservice:38. Copy this/the latest image tag from Docker Hub.

  • Vault connection details — The secrets store information used by the service. Provide all of these

    • Vault name : Name of the vault used Eg: neptune. Refer : Vault UI

    • Vault host : The VM’s public IP address (Primary NIC public IP). Refer : VM-IP

    • Vault port : The network port, e.g., 8200.

    • Vault scheme : http.

    • Vault token : The secret token used to access Vault. Refer : Vault token

  • Service port number — The port that the application listens on (this is set in the service code in Bitbucket).

    • Example

      • 5052 for Gateway service or 6055 for Login service. Check the service’s Bitbucket repository for the exact value.

      • Path to find port number of login service in the bitbucket source code → LoginService/src/main/resources/application.yml.

  • Application name (App Id) — The name used by the application (also found in the service’s Bitbucket repository.

    • This is used for Dapr configuration and for identifying the app in Azure.

    • Example

      • login-service for Login service (or) solitx-gateway for Gateway service.

      • Path to find application name (App Id) of login service in the bitbucket source codeLoginService/src/main/resources/application.yml.

Service port and application name

1. Sign in to the Azure portal

  • Visit the Azure portal.

  • Sign in with Azure account credentials.

  • Click on the Menu button on the left top corner and select All Services from the list.

Menu
  • In the Categories section, click on Containers on the left panel and select Container Apps.

All services
  • Inside the Container Apps tab, click on CreateContainer App.

Create container apps

3. Create Container App

3.1. Basics

3.1.1. Project details

  • In the Subscription field, select the subscription that is to be used to create the container app.

  • In the Resource group field, select an existing resource group or create a new one by clicking on Create new resource group under Resource group and enter a new name under Resource group name.

  • Example : loginservice-resource-group.

Create a new resource group
  • In the Container app name field, enter a unique name for the container app (Eg: loginservice-container-app).

3.1.2. Container apps environment

  • In the Region section, select Central US from the dropdown.

  • Select the required container apps environment from the dropdown menu or create a new environment by following the steps below.

    • Click Create new environment under Create Container Apps environmentBasic, enter a new name under Environment name (Eg: loginservice-environment).

Environment name
  • Click on Workload Profiles section on top and click Add workload profile.

Click Add workload profile
  • At Workload profile name enter the name of the workload profile (Eg: login-workload).

  • At Workload profile sizeChoose a size

Add workload profile name
  • Under Select a workload profile size select Dedicated-D4 and click Select at the bottom.

Select workload profile size
  • Click Add.

Add workload profile
  • Click Monitoring section on top.

Workload profile
  • Click Create new under Log Analytics workspace.

Log Analytics workspace
  • A modal opens from the right. Enter name (Eg: loginserviceloganalyticsworkspace) under Name and click OK.

Name log Analytics workspace
  • Click Networking section on top, leave the default settings as is and click on Create at the bottom.

Networking environment
  • Click on Next: Container >.

Container

3.2. Container

  • Under Name section, enter name of the container (Eg: loginservice-container-app).

  • Under Image Source click on Docker Hub or other registeries.

  • Select Image TypePrivate.

  • Enter Registry user name and Registry password credentials under username and password fields.

Contact Admin for user credentials.

  • For Image and tag section, take the docker image from dockerhub website. (Eg: solitx/loginservice:38)

  • In CPU and memory select required memory and CPU usage for the project (Eg: 0.5 CPU cores, 1Gi Memory)

Container apps creation
  • For Environment variables, enter the values which are used in the project.

  • Eg: Few environment variables are given in the image below as an example.

Container app environment variables
  • Click Next: Ingress >.

3.3. Ingress

  • Enable Ingress.

  • Select Accepting traffic from anywhere.

  • Enter the target port (ie., module port) which can be found from the source code (Eg: 6055).

  • Enable Session affinity and click on Next: Tags >.

Ingress container apps

3.4. Tags

  • Click on Next: Review + create >.

Tags Container apps

3.5. Review + create

  • Review the Project details and click on Create.

Review + create Container apps
  • A page with the message Deployment is in progress is displayed. Once the deployment is successfully completed, a message: Your deployment is complete is shown.

Deployment complete overview
  • Once the deployment is complete, click on Go to resource.

Go to resource container apps

4. Dapr

  • Dapr offers built-in service discovery, simplifying how microservices locate and communicate with each other.

  • In the container app overview, Click on SettingsDapr on the left side panel.

Dapr enable container apps
  • Select Enable.

  • In App Id, enter the name of the application used in the source code (Eg: login-service).

  • In App Port enter the port number of the application used in the source code (Eg: 6055).

Dapr settings container-apps
  • Click on SaveContinue.

Save Dapr settings Container apps
  • A confirmation notification is shown with the message Update Dapr settings → Successfully updated Dapr settings.

Update dapr settings container apps

Access Swagger using gateway URL

  • To install the gateway and view other services (like login-service) through the gateway

    1. Ensure that installation steps 1–4 of the solitx-gateway service are completed successfully.

    2. To access Swagger using the gateway URL:

      1. Copy the Application URL from the deployed container app and append /swagger-ui/index.html to the end of it.

      2. Example: https://gateway-app-name.region.azurecontainerapps.io/swagger-ui/index.html

Swagger Gateway