Skip to content

explicit-logic/aws-module-9.4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Module 9 - AWS Services

This repository contains a demo project created as part of my DevOps studies in the TechWorld with Nana – DevOps Bootcamp.

https://www.techworld-with-nana.com/devops-bootcamp

Demo Project: Complete the CI/CD Pipeline (Docker-Compose, Dynamic versioning) Technologies used: AWS, Jenkins, Docker, Linux, Git, Java, Maven, Docker Hub

Project Description:

  • CI step: Increment version
  • CI step: Build artifact for Java Maven application
  • CI step: Build and push Docker image to Docker Hub
  • CD step: Deploy new application version with Docker Compose
  • CD step: Commit the version update

Prerequisites

Complete the previous demo project first. The EC2 instance must be launched with Docker installed. See aws-module-9.1 for setup instructions.

Authenticate with Docker Hub before proceeding:

docker login

1. Install Docker Compose on AWS EC2 Instance

Reference: https://gist.github.com/npearce/6f3c7826c7499587f00957fee62f8ee9

Download the binary:

sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

Fix permissions:

sudo chmod +x /usr/local/bin/docker-compose

Verify installation:

docker-compose version

2. Create docker-compose.yml

See ./app/docker-compose.yaml for the configuration that deploys the web application image.


3. Configure Jenkins Multibranch Pipeline

Groovy: app/script.groovy

Jenkinsfile: Jenkinsfile

Create the Pipeline Job

  1. Go to DashboardNew Item
  2. Name it aws-multibranch, select Multibranch Pipeline, click OK

Branch Sources

Click Add sourceGit and configure:

Field Value
Credentials github
Repository HTTPS URL https://github.com/explicit-logic/aws-module-9.4

Click Validate to confirm access.

Behaviors

Click Add and include:

  • Discover branches
  • Discover pull requests from origin

Build Configuration

Field Value
Script Path Jenkinsfile

Scan Multibranch Pipeline Triggers

Click Save — Jenkins will scan the repository and automatically create jobs for each branch.


4. Create SSH Key Credentials for the EC2 Server

  1. Navigate to the aws-multibranch pipeline → CredentialsAdd Credentials

  2. Fill in the following fields:

Field Value
Kind SSH Username with private key
ID aws-ec2
Username ec2-user
Private Key Paste the contents of your .pem file

To copy the private key content:

cat ~/.ssh/app-key.pem

5. Run the pipeline job

Demo

About

Complete the CI/CD Pipeline (Docker-Compose, Dynamic versioning)

Topics

Resources

Stars

Watchers

Forks

Contributors