Set up Jenkins server on a digital ocean droplet.

Photo by RetroSupply on Unsplash

Set up Jenkins server on a digital ocean droplet.

Set up Jenkins running in a docker container on a digital ocean droplet.

This article will go through the steps needed to set up a Jenkins instance on a digital ocean droplet

What is Jenkins?

Jenkins is an open-source automation server that helps development teams to automate repetitive tasks in CI/CD

Let's now head to set up our Jenkins server.

1. Register for a digital ocean account here

2. Create a droplet with the following specs.

  • An image - Ubuntu: the Lts tag
  • Plan - 4GB 2 AMD CPUs
  • Datacenter region - (preferably one close to your location)
  • Authentication method - (ssh keys) and copy your public key to Digital Ocean. follow this link to create ssh keys.

3. Configure firewall rules to open ports 22 and 8080 that our Jenkin server will use.

Click on the newly created droplet and navigate to the networking tab.

Screenshot from 2022-08-25 14-23-51.png

Ensure that ports 22 and 8080 are open to receive requests.

Screenshot from 2022-08-25 14-25-59.png

4. Install docker and run Jenkin as a docker container.

4.1 ssh into the droplet by using the command

            ssh root@YOUR_IP

4.2. Update the server by using the command.

 apt update
 apt upgrade -y

4.4. Install docker runtime engine.

apt install -y

5. Run Jenkins as a docker container using the following command

docker run -p 8080:8080 -p 50000:50000 -d \ 
-v jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(which docker):/usr/bin/docker jenkins/jenkins:lts

6. Access the Jenkins server on the web using the server's public IP as shown below

After a successful installation of Jenkins in the Docker container, you should see a screen similar to the one below that will prompt you for an administrator password

#use this command to get the initialAdminPassword
cat /var/lib/docker/volumes/jenkins_home/_data/secrets/initialAdminPassword

copy the password and login into Jenkins. We can now create our first Jenkins user.

Screenshot from 2022-08-25 15-07-43.png

We have now successfully installed Jenkins.

In our next article, we shall go through how to deploy a Django application to an ec2 instance using the Jenkins server we have set up.