See Nomad commands reference here.
Ensure the latest version of the microservice code has built successfully and is uploaded to s3 and to .49 (via fetch microservice). The jars are located in .49 under Local ms jar repo
If the jars are available then progress with Step 2 below to deploy the microservice. Else run below command to download the jars from S3 into .49
Execute the following command
curl -X GET 'localhost:4010/fetch-jar?microService=<MS_NAME>&version=<VERSION>' -H 'auth_token: <auth token>'
curl -X GET 'https://<Digital1_extenal/internal_ip>_OR_<PREPROD_External/InternalIP>/v1/fetch-micro-service-jar-from-s3/fetch-jar?microService=<MS_NAME>&version=<VERSION>' -H 'auth_token: <Check in preprod server>' -H 'cache-control: no-cache' -H 'content-type: application/vnd.api+json' -H 'x-client-id: cbdcfa43-dd67-4c38-b418-83572a936fca' -k
For auth_token get in touch with @Aravind or DEVOPS
Please refer to Fetch jar MS for more details
- Login to stage server through putty as custadm user and switch to root user.
- Change directory to
/local/home/custadm/nomad-stage. - Open the hcl file for the microservice and update the jar version number in 2 places - the jar name under args section and artifact section.
- Login to stage server through putty as custadm user and switch to root user.
- Change directory to
/local/home/custadm/nomad. - Open the hcl file for the microservice and update the jar version number in 2 places - the jar name under args section and artifact section.
- The preprod is setup with fabio that runs on port 9999 so there are no haproxy in new preprod.
- Login to stage server through putty as custadm user and switch to root user.
- Change directory to
/local/home/custadm/nomad. - Open the hcl file for the microservice and update the jar version number in 2 places - the jar name under args section and artifact section.
nomad plan <xxxx.hcl>
Copy and execute the command returned from nomad plan. The plan command invokes nomad in dry run mode when a new job is submitted or or an existing job is updated. This also gives a check-index as part of the resulted command. When running the job with the check-index flag, the job will only be run if the server side version matches the job modify index returned. If the index has changed, another user has modified the job and the plan's results are potentially invalid.
nomad status <job name given in the hcl>nomad alloc-status <allocation_id from above command>
Login to corresponding box/server after identifying the instance
nomad logs <allocation id>to output the entire log
nomad logs <allocation id> | moreto browse logs page by page
nomad logs <allocation id> | grep "<Date time - logging format>" | moreto browse logs from a specific date time
OR
Goto the job logs directory cd /var/lib/nomad/alloc/<allocation_id>/alloc/logs
IF there are no changes to the hcl file and microservice needs a restart then follow Step 4 below....
nomad stop <job name given in the hcl>
nomad run <xxxxx.hcl>
Finally login to consul on that specific environment and check if the service has registered successfully and it is healthy [GREEN]