...
1. SSH to the Jenkins server
git clone https://github.com/project-sunbird/sunbird-devops.git cd sunbird-devops && git checkout tags/release-1.14 -b release-1.14 cd deploy/jenkins sudo bash jenkins-server-setup.sh |
2. Once the jenkins-server-setup.sh script completes, open jenkins in browser by typing domain-name:8080 / public-ip:8080
3. Enter the initial password. Follow the on screen instructions.
4. Choose install suggested plugin
5. Create a admin user
6. Choose the default jenkins URL. You can either change this to your domain name or public IP. If in doubt, just use whatever is displayed on screen as this can be changed later if required in Jenkins configuration.
7. Switch back to the terminal session on the Jenkins server
sudo bash jenkins-plugins-setup.sh Enter the URL as localhost:8080 Enter the admin username and password |
8. Now go to Manage Jenkins -> Manage Plugins -> Update Center -> Check status of plugin install. If any plugins failed to install, install them manually by visiting the plugins section of Jenkins
9. Now switch back to the terminal session on the Jenkins server
cp envOrder.txt.sample envOrder.txt vi envOrder.txt |
10. Update the environment list as per your infrastructure in ascending order. For example if you have only dev and production, your envOrder.txt will look like
...
11. Now run the jenkins-jobs-setup.sh script
sudo bash jenkins-jobs-setup.sh |
12. Follow the onscreen instruction of the script. Provide choice as yes for all questions. The options are case sensitive, the script will display the accepted options.
13. Once the script completes copying the job config, go to the browser and restart jenkins using public-ip:8080/restart OR domain-name:8080/restart
14. Go to http://<jenkins_domain>/credentials/store/system/domain/_/newCredentials
15. Select Username with Password
16. Enter the username and password of the github account. This github account will require a private repository which will contain the inventory and other secrets. Currently github signup and github private repository is free for all.
17. Create an empty private repository
18. Also keep your dockerhub credentials handy. You will require it in subsequent steps. Currently dockerhub signup is free for all.
19. You can leave the ID blank so that jenkins auto generates it or you can give the ID to some long unique string such as abcde-fghij-klmno
20. You can provide the description as private repo credentails and click OK.
21. If you have left the ID blank, then click on the credential which was just created and then clikc on update. Jenkins will display the auto generated id. Copy this and keep it handy. We will require this in subsequent steps.
22. Goto http://<jenkins_domain>/configure
23. Choose the check box named “Environment variables”
24. Click on Add and enter the following Name, Value pairs
...
25. Scroll down to “Global Pipeline Libraries” section and click Add. Provide the values as below
Name | Value |
---|---|
Library Name | deploy-conf |
Default version | Tag name of the jenkins shared library. This should be same version as release. For example, if release is release-1.14, jenkins shared tag will be release-1.14-shared-lib |
Retrieval method | Modern SCM |
Source Code Management | Git |
Project Repository | https://github.com/project-sunbird/sunbird-devops.git |
25. Click on Save and go to Manage Jenkins -> Configure global security
26. Choose the “Markup Formatter” as “Safe HTML”
27. Go to Manage Jenkins -> Manager Nodes -> Click master -> Click Configure -> Provide labels as “build-slave”
28. Set the number of executors to a number like 15 if your system configuration is 16 GB RAM and 4 core CPU. Adjust this number accordingly based on your system configuration
29. Restart jenkins
30. Switch back to the terminal session on Jenkins server
sudo su jenkins mkdir -p /var/lib/jenkins/secrets && cd /var/lib/jenkins/secrets touch deployer_ssh_key ops_ssh_key vault-pass chmod 400 deployer_ssh_key ops_ssh_key vault-pass |
31. The key which you used to login to the Jenkins server will be called as ops_ssh_key from now on wards. Example:
...