I’m happy to report that I’ve successfully set up a Jenkins pipeline to automate the deployment of my Jekyll site to Cloudflare Pages. The pipeline builds a deployment container and uses it to deploy the site whenever I push changes to the main branch of my self hosted git repository. This setup ensures that my site is always up-to-date with the latest content and changes with minimal manual intervention or click-ops.

Jenkins Setup

To achieve this, I created a Jenkins pipeline that performs the following steps:

  1. Build Deployment Container: The pipeline builds a Docker container that includes all the necessary tools for deploying the Jekyll site to Cloudflare Pages.
  2. Run Deployment: The pipeline runs the deployment container, which executes the deployment script to push the latest version of the site to Cloudflare Pages.

Yes, there are ways to extend this, such as adding a telegram notification step to inform me of successful deployments or failures. However, for now, I’m content with the current setup as it effectively automates the deployment process. I also don’t push the built container to a registry, as it’s only used within the Jenkins environment. This keeps things simple and avoids unnecessary complexity at the risk of not having a reproducible build environment outside of Jenkins. Alas.

There are many ways to skin this cat, but I’m pleased with how this solution turned out. It streamlines my workflow and ensures that my site is always live with the latest updates. If you’re looking to automate your Jekyll site deployments, I highly recommend considering a similar approach with Jenkins and Cloudflare Pages.

Performance

One of the benefits of using Cloudflare Pages is the performance improvements it offers. By leveraging Cloudflare’s global CDN, my site loads quickly for visitors around the world. This is a significant improvement over my previous setup, which relied on a single server to host the site. With Cloudflare Pages, my site is now more resilient and can handle higher traffic volumes without any issues.

Additionally, the CI pipeline runs in less than 15 seconds. This is largely due to caching of the docker deployment image on my single build node. The actual deployment step takes only a few seconds, as Cloudflare Pages is optimized for fast deployments.

Jenkins Pipeline Performance

Overall, I’m thrilled with the results of this project. The combination of Jenkins and Cloudflare Pages has made it easy to manage and deploy my Jekyll site, while also improving its performance and reliability. If you’re looking to streamline your own site deployments, I highly recommend giving this approach a try.

Future Improvements

Looking ahead, there are several potential improvements I could make to this setup. For example, I could add more stages to the Jenkins pipeline, such as testing or linting, to ensure that the deployment goes smoothly. I could also add a staging environment to test changes before deploying them to production. I could also add a notification step to inform me of successful deployments or failures. Additionally, I could explore other deployment options, such as using a different CI/CD tool or hosting platform. I tried a Telegram Jenkins plugin, but it was clunky and didn’t work well. I may revisit this in the future.