A Continuous Integration and Continuous Delivery ( CI/CD ) Pipeline implementation is an important part of the modern DevOps environment. It bridges the gap between development and operations teams by automating the building, testing, and deployment of applications. Jenkins is an open-source tool to build a CI/CD pipelines.

In this article, I will share a step-by-step walkthrough on how you can host your Jenkins master node to configure your pipelines.

For this demonstration, I’m using the AWS EC2 instance and dockerized image of Jenkins to host our Jenkins master node. I assume all the firewall rules are preconfigured.

Note: Installing docker instructions on your machine can be found here.

You can find out dockerized Jenkins master repo on Github. Just clone the repo and follow instructions.

$ git clone https://github.com/prahveen/jenkins-master.git
$ cd jenkins-master
$ docker-compose up -d

If you have followed the above instructions, Jenkins should be up and running. Use this below command to verify further.

$ docker ps

Yes our Jenkins master node container is up and running.

Wait…! 🤔 Jenkins master node is running in our instance. Great…! But how can we access Jenkins over the internet. Let’s investigate into this.

Let’s start with adding a reverse proxy via nginx to access over the internet our Jenkins master, by installing nginx in our instance.

$ sudo apt install nginx

Once you install nginx, edit your nginx conf file. For this demonstration, I’m going to edit the default conf file. If you are editing the default conf file, it is always better to get a backup. 😀

$ sudo vim /etc/nginx/default

Replace the following in your conf file.

upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}

Now restart nginx

$ sudo systemctl restart nginx

Boom! Now you can access Jenkins master node via internet

You can get your initial admin password from your Jenkins container

$ docker exec -it jenkinsmaster_jenkins_1  /bin/sh
$ cat /var/jenkins_home/secrets/initialAdminPassword
28d8b10580994647990b9893a8be1dde

Add your initial administrator password and then press continue. The next step, it will ask to install the required plugins.

If you do not have a clear idea of what packages you required to install, go with the suggested plugins. Once installation is done it will prompt to create an admin user account.

Once you create an admin user, restart Jenkins master node. Now you are good to go and you can access the Jenkins dashboard.

I hope this was helpful. If you still have any doubts, feel free to ping me on LinkedIn. In my next blog post I hope to write on how we set up CI/CD for our projects. Stay tuned!

Senior Software Engineer | Self Learner

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store