To implement on QA server¶
- Build the jenkins-blueocean image and spin it up in order to get the SSh key pair is generated:
1 | docker-compose -f docker-compose.yml up --force-recreate --build -d jenkins-blueocean |
- Add the jenkins (@blueocean) SSH pub key to host
.env
file (so it’s gets picked by the SSH agent agent)
1 | echo "JENKINS_SLAVE_SSH_PUBKEY=$(docker exec -it jenkins-blueocean cat /var/jenkins_home/.ssh/id_rsa.pub)" > .env |
- Finally, run all services:
1 | docker-compose -f docker-compose.yml up --force-recreate -d |
docker ps
now, you should see all our containers running (hopefully!)
- Get the default Jenkins password from the jenkins-blueocean container (and copy it):
1 | docker exec -it jenkins-blueocean cat /var/jenkins_home/secrets/initialAdminPassword
|
-
Go to jenkins https://jenkins.mobomo.net/ and use the above copied pass to login
-
Configure Jenkins
-
Add all the required plugins (for MBN we are using):
- GitHub Authentication
- Docker
- SSH Agent
Useful commands¶
For the agent¶
For Jenkins¶
Backup volume/jenkins_home¶
1 | docker run --volumes-from jenkins-blueocean -v $(pwd):/backup debian tar -zcvf /backup/$(date +%Y-%m-%d)_jenkins-blueocean.tar.gz --exclude=workspace /var/jenkins_home |
workspace
dir.
Restore¶
1 | docker run --volumes-from jenkins-blueocean -v $(pwd):/backup debian tar -zxvf /backup/jenkins-blueocean.tar.gz |