Deploy Jenkins

In this guide we will see how Cycleops makes it ridiculously easy for us to deploy the Jenkins CI/CD system, on the hosts of our choice (cloud or bare metal), with a self‑service no‑code workflow.

To achieve this we will use the official jenkins/jenkins Docker image, which facilitates running Jenkins in a Docker container.

Preparation

Before following the steps in this guide, let's make sure the following are available:

  • A server running Linux.
  • A public IP that can be used to access the server above.
  • Inbound traffic to the server is allowed through port 22 (SSH), for Cycleops to run the deployments.
  • Inbound traffic to the server is allowed through port 8080 (HTTP), for us to access our deployed container.
  • (optional) Inbound traffic to the server is allowed through port 50000 (TCP), for additional agents connecting to Jenkins

Steps

To deploy Jenkins on Cycleops:

  1. Create a new host
  2. Create a new service using the Docker Container Group unit, with two containers configured:
    • First container:
      • Name: jenkins
      • Image: jenkins/jenkins
      • Tag: lts-jdk17
      • Ports:
        • 8080:8080
        • 50000:50000 (optional)
      • Volumes:
        • jenkins_home:/var/jenkins_home
    • Second container:
      • Name: jenkins-password
      • Image: jenkins/jenkins
      • Tag: lts-jdk17
      • Remove: true
      • Attach: true
      • Volumes:
        • jenkins_home:/var/jenkins_home
      • Command:
        bash -c "sleep 10 && cat /var/jenkins_home/secrets/initialAdminPassword"
        
  3. Create a new stack with the following units (order matters):
    • Docker Container Group
    • Docker Engine
  4. Create a new setup with the following configuration:
    • Stack: The one we created above.
    • Service for Docker Container Group: The one we created above.
    • Service for Docker Engine: The default configuration available.
    • Target host: The one we created above
  5. Deploy the setup we created above.
  6. Go to setup deployment logs and copy the password from the output of the Docker Container Group. Example:
    TASK [docker-container-group : Show command output for attached jenkins-password container] ***
    ok: [203.0.113.255] => {
        "msg": [
            "copy_this_password"
        ]
    }
    

Now, you can verify that Jenkins is running by accessing it at your host's public IP at port 8080 (e.g. http://203.0.113.255:8080). You should see the Jenkins initial setup form, where you can kick off setup by pasting the password copied above.

Bonus steps

  • Read through "Use with Jenkins" to close the loop and also use Cycleops within Jenkins to deploy your containers.
  • Read through "Deploy auto-renewable HTTPS" to protect your Jenkins installation with automatically generated and renewed HTTPS.