Follow-along instructions for the freeCodeCamp Jenkins course.
Table of Contents
- Technologies Used in Tutorial
- Follow Along Material and Extra Information for Sections of the Course
- Extra Material
- Helpful Jenkins Resources
- Related Projects
This is a tutorial showing how to build a CI/CD pipeline for a web application using Jenkins. I use one of my previous tutorial apps - the Curriculum App - from my livestreams to create this. One interesting thing about that app is that I already have Github actions written to deploy it automatically to Dockerhub in the repo. That will give you an opportunity to compare the Jenkins pipeline I set up in this tutorial to an already working CI/CD pipeline in the repo.
- Debian servers running on Linode (Jenkins from Linode marketplace)
- Jenkins
- Docker & Dockerhub
- Github
- Some command line for settings things up
Every section here corresponds to a section in the freeCodeCamp video.
Why would want you use Jenkins as an app developer?
Why do companies use Jenkins?
How does Jenkins compare to other CI/CD tools?
- CI/CD Tools Comparison: Jenkins, GitLab CI, Buildbot, Drone, and Concourse
- Comparing GitHub Actions vs Jenkins
- Jenkins versus Gitlab
- Aleternatives to Jenkins
-
Configuring Jenkins - admin account, plugins, settings
-
Deploying an app to Github and using the Jenkins Github plugin
-
Using Jenkins to test and deploy to Dockerhub
-
Another Linode server will be watching for updates on Dockerhub and pull & run the updated container
-
Reviewing Jenkins features like build history
Make sure you follow these steps to set up Jenkins from the Linode marketplace: https://www.linode.com/marketplace/apps/linode/jenkins/
- Jenkins Plugin Index - Search for plugins
Shell scripts from the tutorial:
ls -la
cd curriculum-front && npm i && npm run test:unit
docker build -f curriculum-front/Dockerfile . -t fuze365/curriculum-front
docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
docker push fuze365/curriculum-front:latest
Commands for installing Git and Node on server:
# install Git
apt install git
git --version
# node version 16 (comes with npm)
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
apt-get install -y nodejs
node --version
npm --version
There are two main ways to handle app deployments with our Jenkins setup:
- We could deploy the app to Dockerhub and have the app server watch for changes to the docker image. It will pull whenever there are changes. (this is what we have set up now)
- The more advanced setup is to have Jenkins deploy directly to our app server when all of the CI steps pass. This requires a bit of extra configuration in Jenkins and also ensuring security in the app server.
You can see this tutorial for a walkthrough of how I set up the app server to watch for changes to a Docker image on Dockerhub.