Head in the Cloud

My journey to work in cloud technology

My Jenkins Installation

December 10, 2018 · AWS, Docker

The goal here is to set up a continuous integration server to control the build and deployment of the disaster recovery steps. If possible, I'd like to get a failure notice from a nagios container, trigger a build in a jenkins container, use a terraform container to trigger the deployment, and have a roll back method that that will back up the dr region resources, tear them down and update the operational regions resources. To do that, I need a Jenkins CI control server.

Should be pretty straight forward, right? There are a couple of steps here that were fun to discover:

  1. Sometimes, the latest jenkins image doesn't work with some plugins.
    1. First, you can't just pull jenkins, you have to pull jenkins/jenkins. This was my intro to the concept of docker repos, and you have to be careful to get the correct official package and not pull someone's customized version.
    2. Not sure why, but when I first used the jenkins/jenkins:latest version, a lot of the plugins were broken. I had to use the :lts version, which worked.  Now the :latest version is working, but it was a good lesson on pulling different tagged versions to find the one that works best.
  2. Using a shared volume for installation file storage can be tricky where a Norton "smart" firewall is concerned. Even though I added the virtualized network to the firewall rules, I still have to stop my firewall for a few minutes when I start a container that uses a shared volume. Once the connection is established, the volume is accessible, but upon restart (which a Windows system loves to do every now and again, as a surprise), it won't catch without intervention. I hope to figure that out one day, it would be great to have a container auto restart without my having to hold my finger on the firewall.
  3. I created a folder for the jenkins data and started the container with the following command: 
docker run -it --name myJenkins -p 8080:8080 -p 5000:5000 -v c:/Users/soops/jenkins_home:/var/jenkins_home jenkins/jenkins

This command created a container with a custom name, attached ports from the local machine to the container's exposed ports, and bound the container's /var/jenkins folder to the local file system's folder. Once I solve the firewall problem I can recreate the container with --restart always so it will automatically start when the Docker Desktop app is started. The shared folder saves the configuration and local working folders so I don't have to reinitialize Jenkins each time I start it.

Later I'll cover adding the necessary plugins and pipelines for my projects.

Next: My Nagios Installation