This is part 1 of my CI/CD experiment. In this post, I’ll be focusing on getting Jenkins up and running. This build was supposed to take me 15 to 30 minutes but I kept running into issues that needed fixing that ballooned that time to a few hours. I haven’t mentioned them here but I’ve included the ways to mitigate them(like additional installs, the updated apache conf files, etc) so if anyone follows they “shouldn’t” run into issues.
To get started I considered installing Jenkins from scratch from an empty linode, but I believe I’ve mentioned this before… I’m Lazy.
So instead I took advantage of Linode’s Apps, and deployed a prebuilt image of Jenkins. I still had to do a little work on it though.
First, the Linode image didn’t come with JDK for reasons, so I installed it with
apt install default-jdk
Other things you should install
apt install git
apt install apache2
Setting up the domain
The Linode image allows us to access Jenkins at <ip address>:8080. This won’t do. I prefer human-readable names because, of course I do. So let’s dust out one of my old domains.
I have a bunch of domain names, one of which I got when some asshat scammed me on flippa. That’s an interesting story which I might write about another time. Oh to be young and stupid. Anyway, I haven’t really had a use for it and I didn’t want to let it go so I decided to use it for my experiments.
First set the hostname of the box to jenkins and the FQDN to jenkins.example.com. (Removed the actual domain for “reasons”)
Now I can access it at jenkins.example.com:8080
Next, I installed Apache, yes, yes, Nginx is better for this and that blah, blah, blah. I prefer Apache, sue me. Here we need a few things, first enable a few modules
Code language: CSS (css)
a2enmod proxy ssl rewrite proxy_http headers a2ensite jenkins.example.com.conf systemctl restart apache2
The jenkins.example.com.conf and jenkins.example.com-le-ssl.conf have the site configurations.
I’m 99% sure that we don’t need the error handling in the HTTP section, but I’m way too lazy to refactor it right now.
In comes Certbot, and one
certbot --apache later my Jenkins is now running HTTPS, yay!
Note to self: Don’t forget to automate the renewal for Certbot.
Next, I put in a firewall. I’m lazy so I went with UFW. enabled
ufw allow ssh ufw allow "WWW Full"
Wouldn’t do to get locked out of your box, would it? That would suck. Also, I know there are a bunch of services that came with the image that I should probably open ports for but I’ll do that as needed.
While I’m here I also disabled root access and created my own user with a ridiculously long password that I won’t use since I added my public key into
I installed the recommended plugins, but I went into the select option and chose a few different ones, like GitHub.
Set up the JAVA_HOME location in “Manage Jenkins > Global Tool Configuration”(Aint you happy you installed that JDK now?)
From here we can create a simple job that prints Hello world from the console and we have proof that our stuff works!
Hurray. The next stage would be to create our pipeline that builds and tests our projects, maybe blocks merging on Github till build succeeds all that other witchcraft and wizardry. For that, we’ll need a simple project or two, preferably in Django, with some tests, running on Docker…
But it’s 10 pm here so I’m going to bed and I’ll pick this up another time.