Skip to main content
Home
www.herd-of-neurons.com
No more neurons? Use mine

Main navigation

  • Home
User account menu
  • Log in

Breadcrumb

  1. Home

DevOps: Building a Continuous Integration environment using AWS, Docker, Jenkins and GitHub

  • Sources
  • Aggregator
  • Reset your password

2019-08-21
High Level Goals:
Create a demo project on GitHub and build it using Jenkins running in Docker all hosted on and AWS instance.

Pre-requisites:
You will need to have an AWS account and a GitHub account.

Software Downloads:
You will need to download Terraform. I was using v0.11.14 for this post.

Configuration Downloads:
GitHub Project

Procedure:

  1. Clone my example GitHub project
  2. Configure your AWS credentials and Key
    • In provider.tf I look for credentials in ../credentials/credentials. Change to suit your environment
    • In Variables.tf I set the ec2_keypair_name to HoN_DevOps_Walkthrough_1. Change this to refer to one of your keys.
    • In Variables.tf; change aws_route53_zone.HON_Sandbox to an AWS Route53 domain you administer
  3. Run terraform apply to get the environment up and running
  4. Use a browser view Jenkins: http://‹jenkins.your.domain›:8080/
  5. Enter the Jenkins initialization password to get access to the admin interface. You can get this from either:
    • /var/jenkins_home/secrets/initialAdminPassword in your Docker container, or
    • As root in your AWS instance: grep -A1 "Please use the following password" /var/log/messages
  6. Create a new Jenkins administrator - we'll use this in the future.
  7. Install the default Jenkins configuration
  8. Add your GitHub credentials to Jenkins
    • "Credentials" => "System" => "Global Credentials" => "Add Credentials"
  9. Configure Jenkins to build your clone of the example project
    • New Item => Name your Jenkins job => "Freestyle project" => "OK"
    • Enter a description for your new Jenkins Job; "Introduction to AWS/Docker/Jenkins and GitHub"
    • Select "GitHub Project" and enter the URL to your clone of my example GitHub project into the "Project URL"
    • Under "Source Code Management", Select "Git" and enter the URL to your clone of my example GitHub project into the Repository URL. Then select the credentials you entered earlier
    • Under "Build Triggers", select "Poll SCM" and set the schedule to "H/5 * * * *"
    • Under "Build", Select "Add build step", Select "Execute Shell", Enter "cd src; make all"
    • Save the Job

Bonus Points:

  • Implement with HTTPS
  • Have the project build after a commit instead of having Jenkins poll GitHub looking for changes
  • Log in to post comments
Powered by Drupal