Table of contents
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.
Ensure that ports 22 and 8080 are open to receive requests.
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.
4.3. Install recommended upgrades.
apt upgrade -y
4.4. Install docker runtime engine.
apt install docker.io -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.
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.