Deploying Party Microservice on Azure
This section explains how to deploy the Party microservice on the Azure cloud. To do so, you need to perform the following tasks:
Deployment Artefacts
The folder structure of the Party microservice is available as a single release bundle. For example, ms-party-package-azure-<release_number>.zip.
This bundle contains the following files:
ms-party-package-azure-<release_number>.jar-
Azure Script files:
- install.sh/install.bat: This script is used to deploy the Party microservice in the Standalone mode.
- destroy.sh/destroy.bat: This script is used to undeploy the microservice and delete the Azure services from the Azure environment.
- Folder structure for the
ms-party-package-azure-<release_number>.zipfile is as follows.Pom-azure-deploy.xmlfile deploys the Azure function on the Azure portal.
Deploying Party Microservice on Azure
Prerequisites
Before deploying Party microservice on Azure ensure you have the following:
- Install the Azure Command Line Interface. For more information about the installation, click here.
- Install Maven.
- Install Mongo Shell.
Download the Mongo Shell from Mongo Atlas under the tab named Connect with Mongo Shell by clicking Connect.
- An active connection string of Mongo Atlas cluster. The Mongo Atlas Cluster must be acquired for Java driver version 3.4.
- MONGODB_CONNECT_STR string must be obtained for Java driver version 3.4.
- Download the mongo shell from the Mongo Atlas under the Connect with mongo shell tab by clicking Connect.
- MONGOSHELL_CONNECT_STR string must be obtained under the Connect with MongoDB Compass by clicking Connect.
To deploy Party microservice on Azure, follow these steps.
- Download the generated zip file from the target folder into the installation directory.
- Extract the zip file.
- In Command Prompt, go to the installation directory.
- Modify the installation-specific details such as Resource Group, Location, MONGODB_CONNECT_STR, and MONGOSHELL_CONNECT_STR in the install.sh/install.bat script.
For example,
- SET MONGODB_CONNECT_STR="mongodb://Temenos:Temenos123@cluster0-shard-00-02.4o1ua.azure.mongodb.net:27017,cluster0-shard-00-00.4o1ua.azure.mongodb.net:27017,cluster0-shard-00-01.4o1ua.azure.mongodb.net:27017/ms_party?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-vj913p-shard-0&ssl=true"
- SET MONGOSHELL_CONNECT_STR="mongodb+srv://Temenos:Temenos123@cluster0.4o1ua.azure.mongodb.net"
- The default mongo.js file (master data) is inserted into the MongoDB through install.bat.shfile. To insert the data other than the master data, do the following:
- Load the prerequisite data into Mongo DB through the install-db-scripts.bat/.sh script file. The data can be loaded only through the script files(.js).
- Place all the files under the folder path, ms-party-azure\target\azure-functions\<app folder.
- Send the following parameters while executing the bat file:
uri Provide the Mongo string URL along with username and password that are mentioned in the Prerequisite section. app_name Provide the app name that is mentioned during the Azure deployment. scripts Provide the files names delimited by comma. - Execute the following commands:
- For .bat file,
- install-db-scripts.bat --uri <uri> --app_name <app_name> --scripts "<filename1>,<filename2>"
For example, install-db-scripts.bat --uri --mongodb+srv://test:test@cluster0.4o1ua.azure.mongodb.net --app_name partyapp --scripts "mongo1.js,mongo2.js".
- install-db-scripts.bat --uri <uri> --app_name <app_name> --scripts "<filename1>,<filename2>"
- For .sh file,
- install-db-scripts.sh --uri <uri> --app_name <app_name> --scripts "<filename1>,<filename2>"
For example, install-db-scripts.sh --uri mongodb+srv://test:test@cluster0.4o1ua.azure.mongodb.net --app_name partyapp --scripts mongo1.js,mongo2.js.
- install-db-scripts.sh --uri <uri> --app_name <app_name> --scripts "<filename1>,<filename2>"
- For .bat file,
- The default Azure function app name in the script can be changed. In case of app name changes, the folder available (ms-party-azure\target\azure-functions\<app folder>\) in the name of the app must also be renamed.
- To enable the in-house authentication in addition to the API key, perform the JWT Authentication in the installation scripts.
- After this, execute either
install.shorinstall.bat.Script Description install.sh/install.bat To deploy the necessary components for a microservice including streaming services will be deployed, in order to run the microservice independently. After successful installation, these Azure functions are created.
- Sign in to the Azure portal and verify if the Resource Group and the Function App are created.
Resource Group
Function App
Party Functions
- Obtain the API key for each endpoint by using the
func azure functionapp list-functions <function-app-name> --show-keyscommand. Alternatively, you can also obtain the API key from the Azure function GUI. - Obtain the endpoints of the Azure Function App from the Azure Function App. The URL of the sample function app is as follows:
The Get Function URL provides the complete URL along with the API key.
- After the successful deployment, database, collections, and reference data(master data) are loaded into the mongo server database for the Party microservice.
In this topic