Jenkins Ready to Go
Having a CI/CD pipeline has become an integral part of the software development with the automation server acting as the backbone of this process.
Jenkins for long has been the go to server in the open source community, and wether it’s for practice or learning how to build a pipeline, setting it up from scratch might take some time.
It’s a burden for me (even with Docker) to have to spin up the container locally, specially for something I use so often and sometimes from different computers. So I have a cheap cloud instance with a bunch of tools, for which I use Nginx as proxy.
This project will give you:
- NGINX proxy to manage your connections.
- Obtain and automatically renew your own ssl certificates with Let’s Encrypt. So no need to worry for SSL.
- Configuration centralized in a single file:
.env
- Jenkins with volume storage locally or in the cloud.
There are a couple of things you will you need to have in the cloud:
- A domain.
- A cloud instance (AWS, GC, DO…).
None of the above is needed to run locally.
You can setup a cloud instance the cloud for cheap, I recommend using Digital Ocean since it’s pretty easy to setup, just grab the preconfigured docker droplet and you are good to go.
Easy configuration and extension
It’s made it in a way that in case you want to go deep in the setup and overall building of this solution you can. It’s based on my own project to create a ghost blog with automatic ssh renewal.
Then I combined it with this Jenkins setup by our folks at Riot Games, all put together to work in sync for our own benefit. You can go ahead and read those if you want to practice and learn how to set it up or extend it by yourself.
The env
file is where you define all the things you need. So if you are not
familiar with docker there is really no need to touch the docker compose files.
Jus edit the env
with your values and that’s it.
Running locally
- Clone this repository.
- Rename the
env.sample
toenv
and run./start.sh
Running in the cloud
- Clone or copy this repository to your cloud instance.
- Copy and rename the
env.sample
toenv
and add your details as desired. These are the basics to get it running:
IP=0.0.0.0 or the actual IP either way works
URL=your domain e.g. "https://example.com"
VIRTUAL_HOST=your domain e.g. "https://example.com"
LETS_ENCRYPT_HOST=your domain e.g. "https://example.com"
LETS_ENCRYPT_EMAIL=Email to register the ssl certificate e.g. "your@email.com"
LETSENCRYPT_TEST=true | Change to false to get prod ssl certificate
- Run
./start.sh
Additional information
The start.sh
script is configured to run in detached mode, if you want to see the entire output to get the admin password during setup, make this change in the file:
docker-compose up -d
to docker-compose up
In case of running with the default detached mode you can access the Jenkins container in the instance and extract the admin code this way:
docker exec -it jenkins-master bash
And then print the log on screen where you will find the admin password:
cat /var/jenkins_home/secrets/initialAdminPassword
Or for the full log:
cat /var/log/jenkins/jenkins.log
Install the plugins you prefer or use the default setup and that’s it. Now you have a Jenkins running in a cloud instance.