Table of Contents |
---|
CI
Spec
Example
A typical pipeline for a service:
http://build.openlmis.org/view/Referencedata-pipeline/
How tos
How to run contract tests in CI?
How it’s configured in jenkins:
http://build.openlmis.org/view/Requisition-pipeline/job/OpenLMIS-requisition-contract-test/configure
Use this one script to run contract tests for different services by passing parameter:
https://github.com/OpenLMIS/openlmis-contract-tests/blob/master/run_contract_tests.sh
Each contract test suite would need its own compose file to define which container is needed:
Use gradle waitFor -Pcontainers=x,y,z to wait for http server in containers before start testing:
https://github.com/OpenLMIS/openlmis-contract-tests/blob/master/build.gradle#L36
The same way could be used by developers locally as well.
How to write contract tests?
Refer to this doc:
https://github.com/OpenLMIS/openlmis-contract-tests/blob/master/README.md
How to configure deployment job to run only after all previous steps pass?
Take the requisition service deployment job for example:
It uses the “Fan-in” plugin to make sure the deployment job is only triggered after contract tests, erd generation and sonar checks all pass.
How is db credentials and other sensitive information handled during auto deployment?
Please refer to this doc:
https://github.com/OpenLMIS/openlmis-deployment/blob/master/deployment/README.md
The content of the .env file for test and uat is identical with the default one for now, but they are not referring to the one in github, you can change them under “/var/lib/jenkins/credentials” if you have ssh access.
How to set up a Jenkins Slave machine?
The jenkins slave machine is initialized with this script:
http://build.openlmis.org/configure
(at the bottom of the page, in the “init script” text box)
...
This script will be ran to create a new EC2 instance when “Provision via AWS” is clicked on this page: http://build.openlmis.org/computer/
Or when there are more jobs in the queue than the current executors can handle.
The slaves auto launched by Jenkins are configured to have 32G disks, if that becomes too small in the future, this option can be changed in “Block device mapping” field in this page http://build.openlmis.org/configure
How to publish erd documents?
ERD documents are published as a zip file in the Jenkin job’s artifact, and also published to apache web server for online browsing.
...
This is the job configuration:
http://build.openlmis.org/job/OpenLMIS-auth-erd-generation/configure
The latest zip file: http://build.openlmis.org/job/OpenLMIS-auth-erd-generation/lastSuccessfulBuild/artifact/erd-auth.zip
The online browsing url:
http://ci.openlmis.org/erd-auth/
These urls follow a pattern, if you substitute the word auth with another service’s name, the url will point to the generated erd documents of that service.
...
There is a new ticket working on publishing docs: https://openlmis.atlassian.net/browse/OLMIS-673
This may be replaced by that, please refer to the ticket for latest information.
...
Example: Requisition Service build job using gradle.properties (which has serviceVersion property) injecting ${serviceVersion} and tagging this in DockerHub.
CD
Spec
(Revised)
Example
http://elb-test-env-swarm-683069932.us-east-1.elb.amazonaws.com:8888/auth/
https://elb-test-env-swarm-683069932.us-east-1.elb.amazonaws.com/auth/
(Test env)
http://uat-env-elb-1284865908.us-east-1.elb.amazonaws.com/auth/
https://uat-env-elb-1284865908.us-east-1.elb.amazonaws.com/auth/
(UAT env)
How tos
How to Provision a deployment environment?
There are three docs under this directory:
https://github.com/OpenLMIS/openlmis-deployment/tree/master/provision
They cover provision for single host or swarm, with EIP or ELB.
How to configure deployment job?
How it’s configured in jenkins:
Note that deployment jobs need to be run on the master/jenkins server. This is due to a security plugin we're using that will help keep the hosts secure. See
for more information. Jira Legacy server JIRA (openlmis.atlassian.net) columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 448ba138-230b-3f91-a83e-16e7db1deed1 key OLMIS-1226
...
Use this one script to re-deploy different services by passing parameter:
(Apart from these two links, also refer to the provision docs for how to enable jenkins to access the remote deployment target machine)
How to wipe data during redeployment?
Go to: http://build.openlmis.org/job/OpenLMIS-notification-deploy-to-test/build?delay=0sec
(example of redeploying notification service, there are jobs for redeploying other services as well)
...
The above example is for test env, it’s the same thing for UAT env as well.
How to backup kept data?
Please refer to this doc:
How to deploy a versioned component
...
Even though the *deploy-to-test and *deploy-to-uat* Jenkins jobs trigger the automatic loading of demo data to the Test and UAT environments, the configuration is not in the Jenkins jobs themselves. The configuration can be found in the openlmis-deployment GitHub repo (https://github.com/OpenLMIS/openlmis-deployment.git), under deployment.
The Reference Distribution (blue) is designed to load in the demo data that is stored in JSON and built within each service. For more, see the OpenLMIS-Blue README and its utils/demo-data.sh script.
Monitors
Monitor for docker hosts(the EC2 instances):
(Test env)
(UAT env)
Monitor for containers
http://uat-env-elb-1284865908.us-east-1.elb.amazonaws.com:3000/dashboard/db/test-docker-host
http://uat-env-elb-1284865908.us-east-1.elb.amazonaws.com:3000/dashboard/db/uat-docker-host
There is a read only user, name: view_only, password: Nn24AQnG8Nxwd7oj
...
Please refer to this doc: https://github.com/OpenLMIS/openlmis-deployment/blob/master/monitoring/README.md
And use the one liner script to set up.
...
For both contract test repo https://github.com/OpenLMIS/openlmis-contract-tests and deployment repo https://github.com/OpenLMIS/openlmis-deployment, the team Developers and Soldevelo have been given write access.
...