Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconaws-helpers
file-type-iconbuild-helpers
file-type-iconcheck-url
file-type-iconcircleci-helpers
file-type-icondocs-generator
file-type-iconec2-backup
file-type-iconecs-deploy-runner-invoke-iam-policy
file-type-iconecs-deploy-runner
file-type-icongit-helpers
file-type-icongruntwork-module-circleci-helpers
file-type-iconiam-policies
file-type-iconinfrastructure-deploy-script
file-type-iconinfrastructure-deployer
file-type-iconinstall-jenkins
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-iconrun-jenkins
file-type-iconjenkins-server
file-type-iconkubernetes-circleci-helpers
file-type-iconterraform-helpers
file-type-icontest
file-type-icontestdep
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME-CircleCI.adoc
file-type-iconREADME-Jenkins.adoc
file-type-iconREADME-Terraform-Terragrunt-Pipeline.adoc
file-type-iconREADME-TravisCI.adoc
file-type-iconREADME.adoc
file-type-iconsetup.cfg

Browse the Repo

file-type-icon.circleci
file-type-icon_ci
file-type-icon_docs
file-type-iconexamples
file-type-iconmodules
file-type-iconaws-helpers
file-type-iconbuild-helpers
file-type-iconcheck-url
file-type-iconcircleci-helpers
file-type-icondocs-generator
file-type-iconec2-backup
file-type-iconecs-deploy-runner-invoke-iam-policy
file-type-iconecs-deploy-runner
file-type-icongit-helpers
file-type-icongruntwork-module-circleci-helpers
file-type-iconiam-policies
file-type-iconinfrastructure-deploy-script
file-type-iconinfrastructure-deployer
file-type-iconinstall-jenkins
file-type-iconREADME.md
file-type-iconinstall.sh
file-type-iconrun-jenkins
file-type-iconjenkins-server
file-type-iconkubernetes-circleci-helpers
file-type-iconterraform-helpers
file-type-icontest
file-type-icontestdep
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME-CircleCI.adoc
file-type-iconREADME-Jenkins.adoc
file-type-iconREADME-Terraform-Terragrunt-Pipeline.adoc
file-type-iconREADME-TravisCI.adoc
file-type-iconREADME.adoc
file-type-iconsetup.cfg
EC2 backup

EC2 backup

Snapshot your EC2 instances on a scheduled basis.

Code Preview

Preview the Code

mobile file icon

README.md

down

Install Jenkins Module

This module contains two scripts for working with Jenkins CI server:

  1. install.sh: This script will install Jenkins on a Linux server. Currently, Ubuntu and CentOS are supported. This script also installs the run-jenkins script.
  2. run-jenkins: This script can be used to configure and run Jenkins. You will typically run this script while your server is booting.

Example code

Install Jenkins

The easiest way to install and run these scripts is to use the Gruntwork Installer (make sure to replace VERSION below with the latest version from the releases page):

gruntwork-install \
  --module-name 'install-jenkins' \
  --repo 'https://github.com/gruntwork-io/module-ci' \
  --tag '<VERSION>' \
  --version 2.164.3

The command above will copy install.sh to your server, run it, install Jenkins 2.164.3, and copy the run-jenkins script into /usr/local/bin. We recommend running this command in a Packer template so you can create an AMI with Jenkins installed. Check out the jenkins example for an example of such a Packer template.

Run Jenkins

Once you have an AMI with Jenkins installed, you need to deploy it on an EC2 Instance in AWS. The easiest way to do this is with the jenkins-server module. When the EC2 Instance is booting, you should typically do two things in User Data:

  1. Mount an EBS volume for the Jenkins home directory. You want to use an EBS volume so that your Jenkins data is persisted even if the EC2 Instance is replaced (e.g., after a crash or upgrade). The mount-ebs-volume script in the persistent-ebs-volume module makes it easy to attach and mount a volume.

  2. Execute the run-jenkins script to start Jenkins, set its home directory to the mount point for the EBS volume, and configure it to use a certain amount of memory:

    run-jenkins \
      --memory "1g" \
      --jenkins-home "/jenkins"
    

Check out the jenkins example for an example of such a User Data script.

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?