Setting Up Jenkins on Kamatera: A Survival Guide for Beginners

Setting Up Jenkins on Kamatera: A Survival Guide for Beginners

If you've ever tried setting up Jenkins for the first time with zero prior experience, you probably know the feeling of banging your head against a wall—repeatedly. As someone who just went through this ordeal, I decided to document my journey for 1) to make a note in case I need to do it all over again, and 2) to help others who find themselves in the same predicament.

This guide walks you through the steps and pain points I encountered while setting up Jenkins on Kamatera Cloud Platform. Of course, your mileage may vary as I had a very specific cloud architecture setup and different companies may have different ones.

Anyway, let's dive in.

Selecting a Server: Kamatera Cloud Platform

After some research, I discovered Kamatera Cloud Platform, which offers hosted and managed Jenkins instances. According to their website, the basic server starts at $4 monthly for 1GB RAM. Unfortunately, our instance crashed with Out-Of-Memory (OOM) issues when trying to run a build, requiring an upgrade to 2GB RAM, which costs $6 monthly. Still, not a bad deal for the flexibility and peace of mind it offers.

(Edit: After some toiling around, I had to yet upgrade it to 3GB RAM version with $9/monthly cost so my Jenkins build can run with the full 2048MB memory.)

(Edit 2: Then I found out that one of my builds will have to download a huge base image to begin with, which meant the original 20GB hard disk was not gonna be enough. In the end, I shelled out $3 more per month to double it, bringing the total to 40GB, and the total monthly cost to a whopping $12!)

Once registered on Kamatera's website, spinning up the server for the first time takes about 10 minutes. Don't be alarmed if nothing happens initially; patience is key. Kamatera sends an email confirmation once your server is ready.

Components

One of our primary requirements was GitHub integration for webhook activation upon commit pushes. The build process involves multiple technologies: NodeJS, Docker, AWS ECR & S3, Kubernetes, with SSH. Here's a breakdown of each component:

1. NodeJS

  • Install the NodeJS plugin from the Jenkins Plugin Manager.
  • Navigate to the Jenkins 'Tools' page and add the correct NodeJS versions. This was surprisingly the most straightforward step. No issues here!

2. GitHub Integration

  • Add your GitHub organization to Jenkins by creating a Jenkins App on GitHub. For detailed instructions, refer to the Jenkins Blog
  • For Kamatera, it’s crucial to disable SSL verification for your GitHub App's webhook. Though not recommended for security reasons, this is necessary for Jenkins to properly receive webhook requests.

3. Docker

  • Start by installing the relevant Docker plugins from Jenkins Plugin Manager.
  • SSH into your VM and install Docker using a package distribution via the command line. In the settings there was some Docker auto-install option but I never got it to work, so had to install it manually.
  • Also add the 'jenkins' user to the Docker user group to avoid system permission issues. This can be done by executing the following command:

sudo usermod -aG docker jenkins        

4. AWS

  • Install the relevant AWS plugins.
  • Set AWS S3 Profiles under the Jenkins 'System' configuration page and add separate credentials under the project. This ensures secure access to AWS resources.

5. Kubernetes

  • Kubernetes requires its set of plugins which can be installed directly from the Jenkins Plugin Manager. Again, pretty straightforward, but we needed to SSH into an AWS VM to control our cluster, so...

6. SSH

  • Install the SSH plugins necessary for remote execution.
  • Ensure your SSH private keys are added to Jenkins credentials, same as in step 4. It's crucial to note that these keys should be in RSA and .pem format for compatibility.

7. Post-install Settings

  • Ensure Jenkins workspace is getting cleaned either before or after each build as it can accrue build artifacts quickly and suck up your limited disk space.

Conclusion

The journey of setting up Jenkins on Kamatera is not without its challenges, especially for those new to Jenkins. But once configured, it becomes a powerful tool that streamlines your CI/CD pipeline. Following these steps should save you from some of the head-banging moments I experienced. Happy building!

Would you like to chat further? Feel free to reach out with any queries or share your experiences and tips. Let's make the DevOps community a bit more navigable together!

Glad you had a great experience with Kamatera, Tianyi Pan! Thank you for this very helpful tutorial.

要查看或添加评论,请登录

Tianyi Pan的更多文章

社区洞察

其他会员也浏览了