Jenkins Setup

Edit | Report



Jenkins Setup

Jenkins is used to build, deploy and setup the infrastructure for Sunbird. Almost everything in Sunbird is automated using Jenkins pipelines which integrates with ansible and other tools.

  • SSH to the Jenkins server and enter the following commands -

       git clone
       cd sunbird-devops && git checkout tags/release-4.3.0 -b release-4.3.0
       cd deploy/jenkins
       sudo bash
  • Open Jenkins UI in a browser by visiting JENKINS_IP:8080

  • Enter the initial password and follow the on-screen instructions. Choose Install suggested plugin and create an admin user

  • Go to http://JENKINS_IP:8080/pluginManager/available -> Search for ‘Configuration as Code Plugin’ and install the plugin without restart.

Don’t run the following until above steps finished

  • Run the below commands on Jenkins server -

      sudo bash
      cp envOrder.txt.sample envOrder.txt
      vi envOrder.txt
  • Update the environment list as per your requirement in ascending order. For example, if you want to have dev, staging and production environments, your envOrder.txt will look like -

  • Run the below script on Jenkins server and provide input as required (case sensitive) -

      sudo bash
  • Restart jenkins

      sudo service jenkins restart
  • Configure Jenkins
    sudo su jenkins
    curl -SsL -o ~/jenkins.yaml
    # Replace all placeholders ${VALUE} with proper values
    # For example, 
    # username: "${GH_USERNAME}" to  username: "mygithubusername"
    vim ~/jenkins.yaml
  • Run the below commands on Jenkins server -

      mkdir -p /var/lib/jenkins/secrets
      cd /var/lib/jenkins/secrets
      touch deployer_ssh_key vault-pass k8s.yaml
      chmod 600 deployer_ssh_key vault-pass k8s.yaml
  • Copy the contents of your server’s private key into /var/lib/jenkins/secrets/deployer_ssh_key

  • Copy the kubernetes config file contents into /var/lib/jenkins/secrets/k8s.yaml

  • If you have encrypted your secrets.yml using ansible-vault, enter the password to decrypt into /var/lib/jenkins/secrets/vault-pass. If you have not encrypted, then enter a random value like 12345

  • Run sudo visudo on jenkins server and add the below line -
      jenkins ALL=(ALL) NOPASSWD:ALL

  • Reboot the Jenkins VM (sudo reboot)

Edit | Report