Code Deployment
The following section explains how the DRISTI code is deployed on the environment created in the previous steps. Follow this to deploy on Azure.
DRISTI Deployment
Create env and env-secret from sample and sample secrets.
Check for the DB credential passed for Azure Postgres DB as well as the server host for the DB created, and update the DB credential in the env and env-secret files.
Update the env value in the env file with the proper value, also update the filestore bucket name and container name and link for globalconfig.js file with new one for this env.
Use Sops to encrypt secret files.
Create a new workflow for pucar-deployment and update appropriate variables value from sample.yaml (https://github.com/pucardotorg/pucar-DevOps/blob/Solutions-Pipeline/.github/workflows/sample.yaml)
Update HELMFILE_ENV: "<ENV NAME>" value in digit deployment step to env as environment and secrets file is named as env.yaml and env-secrets.yaml or similar according to the env file name.
Make sure the workflow gets triggered when push/pull requests are based on requirements.
For first-time creation, the db-migration part needs to be commented as mdms and workflow service flyway migration needs to be completed before running the init-script otherwise it will create a flyway migration conflict.
Trigger the pipeline and review the logs. If you encounter any issues try to resolve them. One better way to troubleshoot infra creation is to run the terraform apply from the local system but make sure to store and use the same tfstate file.
Generate the self Certificate for a domain name mapping for UI: Use the certbot command to create a certificate. Replace "domain" with your actual domain name:
sudo certbot certonly --manual --preferred-challenges=dns --email infra123@beehyv.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos --manual-public-ip-logging-ok -d "domain"
Configure the DNS Record: Add an "A" record in the DNS-hosted zone for pucar.org. Point the domain name (yourdomain.com) to the IP address of the incoming load balancer.
Using certbot, create the certificate and private key and update tls-certs secret to have private key and cert.
This will enable UI access.
Create root User for new tenants:
Enable port forward for user service run the following command to create a root user for the tenant Note: Please ensure that you update all the necessary details in the curl command, such as tenant ID, username, password, etc.
Example : curl --location 'http://localhost:8280/user/users/_createnovalidate' --header 'Content-Type: application/json' --data-raw '{"requestInfo":{"apiId":"Rainmaker","ver":".01","ts":null,"action":"_update","did":"1","key":"","msgId":"20170310130900|en_IN","authToken":"2666f331-6376-48b8-ad9a-2ab3d9948af3","userInfo":{"id":24226,"uuid":"11b0e02b-0145-4de2-bc42-c97b96264807","userName":"amr001","name":"leela","mobileNumber":"9814424443","emailId":"leela@llgmail.com","locale":null,"type":"EMPLOYEE","roles":null,"active":true,"tenantId":"pg.citya","permanentCity":null}},"user":{"userName":"TEST-M1","mobileNumber":"9919939947","name":"PGR Admin","password":"eGov@123","type":"EMPLOYEE","roles":[{"name":"SUPERUSER","code":"SUPERUSER","tenantId":"pg"},{"name":"CSR","code":"CSR","tenantId":"pg"},{"name":"EMPLOYEE","code":"EMPLOYEE","tenantId":"pg"}],"tenantId":"pg","active":true}}'
Localization:
"RequestInfo": {
"apiId": "Rainmaker",
"msgId": "1713365188488|ml_IN",
"authToken": "46b52737-cb49-458a-baec-43173c6c61ba",
"plainAccessRequest": {}
},
"tenantId": "kl",
"messages": [
{
"code": "AGE_VALIDATION",
"message": "Invalid Age",
"module": "rainmaker-common",
"locale": "en_IN"
}
]
API: https://dristi-kerala-qa.pucar.org/localization/messages/v1/_upsert
If we have a localization sheet-like (https://github.com/pucardotorg/kerala-configs/tree/develop/localization), then we can add localization data directly using the below script.
Another way of doing this is, fetch the localization message from the existing environment which has the same data as mentioned in the sheet, and then just paste that message array in the upsert api given above.
Last updated