DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

LEVEL 2 – CI/CD Production Deployment with GitHub Actions

Production Scenario

You joined ABC Financial Bank as a Junior DevOps Engineer.

Developers don't want to send ZIP files anymore.

They don't want you to SSH into servers every day.

Every time a developer pushes code to GitHub:

  • The application should automatically build.
  • Tests should run.
  • A Docker image should be created.
  • The application should automatically deploy to AWS EC2.
  • Users should immediately see the new version.

This is Continuous Integration (CI) and Continuous Deployment (CD).


What Students Will Learn

Git

  • Repository
  • Commit
  • Branch
  • Merge
  • Clone
  • Pull
  • Push
  • Remote
  • HEAD
  • Merge conflicts

GitHub

  • Repository
  • Branch protection
  • Pull Requests
  • Issues
  • Secrets
  • Actions
  • Collaboration
  • Forks

GitHub Actions

  • Workflow
  • Runner
  • Jobs
  • Steps
  • Events
  • Triggers
  • Secrets
  • Variables
  • SSH Deployment

Docker

  • Dockerfile
  • Image
  • Container
  • Build
  • Push
  • Pull
  • Restart
  • Remove
  • Volumes
  • Networks

AWS

  • EC2
  • Security Groups
  • Elastic IP
  • IAM
  • SSH Keys
  • CloudWatch (introduction)

Linux

  • SSH
  • chmod
  • chown
  • systemctl
  • apt
  • nano
  • vim
  • journalctl
  • docker logs
  • ps
  • top

Networking

  • IP
  • DNS
  • HTTP
  • HTTPS
  • TCP
  • Ports
  • SSH
  • NAT
  • Security Groups
  • Load Balancer (preview)

API

  • REST
  • HTTP Methods
  • JSON
  • Headers
  • Status Codes
  • curl
  • Postman

DevOps Concepts

  • CI
  • CD
  • Automation
  • Build
  • Test
  • Release
  • Deployment
  • Rollback
  • Monitoring

Final Architecture

Developer

↓

Git

↓

GitHub Repository

↓

GitHub Actions

↓

Ubuntu Runner

↓

SSH

↓

AWS EC2

↓

Docker Build

↓

Docker Container

↓

Application

↓

Browser
Enter fullscreen mode Exit fullscreen mode

Module 1 – Introduction

What is Hardware?

Hardware is the physical equipment.

Examples

  • CPU
  • RAM
  • SSD
  • Motherboard
  • Network Card

Explain

Without hardware nothing can run.


What is Software?

Software is instructions.

Examples

Linux

Docker

Git

Python

Chrome

Nginx


Question

Can software exist without hardware?

No.


Can hardware work without software?

No.


Module 2 – How Internet Works

Show

Browser

↓

Internet

↓

AWS

↓

Linux Server

↓

Docker

↓

Application
Enter fullscreen mode Exit fullscreen mode

Explain every layer.

Students understand what happens after pressing Enter.


Module 3 – Client Server

Client

Requests information

Server

Returns information

Example

Browser

Amazon

Product page


Module 4 – HTTP

Teach

GET

POST

PUT

PATCH

DELETE

Explain real examples.

Amazon

Facebook

Netflix

Banking


Status Codes

200

201

301

400

401

403

404

500

502

503


Module 5 – REST API

Students build

GET

/products

POST

/products

DELETE

/products

Test

Postman

curl

Browser


Module 6 – Git

Explain

Git is local.

GitHub is remote.

Diagram

Laptop

↓

Git

↓

GitHub
Enter fullscreen mode Exit fullscreen mode

Commands

git init

git status

git add

git commit

git log

git diff

git restore

git branch

git switch

git merge

git clone

git fetch

git pull

git push


Explain every command.

Why it exists.

Where companies use it.


Module 7 – GitHub

Repository

Branch

Pull Request

Review

Merge

Actions

Secrets


Students create

Production branch

Development branch

Feature branch


Workflow

Developer

feature/login

Pull Request

Review

Merge

main


Module 8 – Docker

Explain

Why Docker exists.

Problem before Docker.

"It works on my machine."

Docker solves

Different operating systems.

Different libraries.

Different environments.


Students build

Dockerfile

Build Image

Run Container

Stop Container

Remove Container

Volumes

Networks


Explain difference

Image

Container

Registry


Module 9 – AWS

Launch EC2

Ubuntu

Security Groups

SSH

Elastic IP

Docker installation

Git installation


Explain

Why cloud?

Why not physical servers?


Module 10 – SSH

Generate keys

ssh-keygen
Enter fullscreen mode Exit fullscreen mode

Explain

Private key

Public key

Encryption

Authentication


Students login

ssh ubuntu@EC2-IP
Enter fullscreen mode Exit fullscreen mode

Module 11 – GitHub Secrets

Create

HOST

USERNAME

SSH_KEY

Enter fullscreen mode Exit fullscreen mode

Explain

Why passwords should never be in workflows.


Module 12 – GitHub Actions

Explain

GitHub Actions is a CI/CD platform.

Workflow

Runner

Job

Step

Students create

.github/

workflows/

deploy.yml
Enter fullscreen mode Exit fullscreen mode

Trigger

on:

push:

branches:

- main
Enter fullscreen mode Exit fullscreen mode

Explain

Developer pushes.

Workflow starts.


Module 13 – Build Pipeline

Steps

Checkout

Install

Build

Test

Deploy

Explain each stage.


Students write

Checkout



Docker Build



SSH



Deploy
Enter fullscreen mode Exit fullscreen mode

Module 14 – Deployment Pipeline

Workflow

Developer

↓

git push

↓

GitHub

↓

GitHub Actions

↓

SSH

↓

EC2

↓

docker stop

↓

docker rm

↓

docker build

↓

docker run
Enter fullscreen mode Exit fullscreen mode

Students understand

No manual deployment.


Module 15 – Linux Production

Students practice

systemctl

journalctl

docker logs

docker ps

top

free

df

netstat

ss

ps

kill

pkill

tail

cat

less

nano

chmod


Explain when DevOps engineers use each command.


Module 16 – Docker Logs

Students break application.

Read logs.

Fix application.

Deploy again.

Exactly what companies do.


Module 17 – Rollback

Bad deployment.

Website broken.

Restore previous version.

Students understand

Rollback.


Module 18 – Versioning

Deploy

v1

v2

v3

Rollback

v2

Students finally understand Docker tags.


Module 19 – Production Security

Secrets

SSH Keys

Least Privilege

IAM

Security Groups

HTTPS overview

Never expose credentials


Module 20 – Troubleshooting Scenarios

Students solve real incidents.

Scenario 1

GitHub Action failed.

Find logs.


Scenario 2

Docker build failed.

Fix Dockerfile.


Scenario 3

SSH permission denied.

Fix key.


Scenario 4

Website unavailable.

Check

EC2

Docker

Container

Logs

Ports

Security Groups


Scenario 5

Container exited.

Read logs.

Restart.


Scenario 6

Application running

Browser doesn't open

Check

Port mapping

Security Group

Firewall


Scenario 7

Developer says

"I pushed code."

Production unchanged.

Investigate

GitHub Actions

Deployment

Container

Browser cache


Final Enterprise Workflow

Developer

↓

Git Add

↓

Git Commit

↓

Git Push

↓

GitHub Repository

↓

GitHub Actions Trigger

↓

GitHub Runner

↓

Checkout Code

↓

Build Docker Image

↓

(Optional: Run Unit Tests)

↓

SSH to EC2

↓

Pull Latest Code

↓

Stop Old Container

↓

Remove Old Container

↓

Build New Docker Image

↓

Run New Container

↓

Health Check

↓

Users Access Website
Enter fullscreen mode Exit fullscreen mode

You're absolutely right. What I gave you was the curriculum, not the project.

A DevOps engineer learns best by working on one realistic project from start to finish. The project should evolve as new technologies are introduced, just like it does in a real company.

Level 2 Project

Project: FreshMart Online Grocery Store

Instead of deploying a simple HTML page, students deploy a small application that looks like a real business.


Company Story

FreshMart is an online grocery company.

Developers built a new version of the website.

Customers use the website every day.

Your DevOps team is responsible for deploying every new release safely and automatically.


Final Architecture

                     Customer

                        │

                        ▼

                Internet Browser

                        │

                        ▼

                  AWS EC2 Ubuntu

                        │

                Docker Container

                        │

              Flask API Application

                        │

                products.json

                        │

                 GitHub Repository

                        ▲

                        │

              GitHub Actions CI/CD

                        ▲

                        │

                 Developer Laptop
Enter fullscreen mode Exit fullscreen mode

Notice there is now an application, not just static HTML.


What Students Build

freshmart-app/

│

├── app.py

├── products.json

├── templates/

│      index.html

├── static/

│      style.css

│

├── Dockerfile

├── requirements.txt

├── .github/

│      workflows/

│             deploy.yml

└── README.md
Enter fullscreen mode Exit fullscreen mode

This is exactly what many small production applications look like.


What Does the Application Do?

Customers open

http://server-ip
Enter fullscreen mode Exit fullscreen mode

They see

FreshMart Grocery

--------------------------

Apple

Milk

Eggs

Rice

Orange Juice

Chicken

Bread

Enter fullscreen mode Exit fullscreen mode

The page loads data from an API.


API Endpoints

Students create

GET /products
Enter fullscreen mode Exit fullscreen mode

Returns

[
  {
    "id":1,
    "name":"Milk",
    "price":4.99
  },
  {
    "id":2,
    "name":"Apple",
    "price":1.29
  }
]
Enter fullscreen mode Exit fullscreen mode

Second endpoint

GET /health
Enter fullscreen mode Exit fullscreen mode

Returns

{
   "status":"healthy"
}
Enter fullscreen mode Exit fullscreen mode

Explain

Production companies use health endpoints.

Load Balancers check

/health
Enter fullscreen mode Exit fullscreen mode

every few seconds.


Third endpoint

GET /
Enter fullscreen mode Exit fullscreen mode

Displays HTML page.


Developer Workflow

Developer changes

products.json
Enter fullscreen mode Exit fullscreen mode

Adds

{
"id":8,
"name":"Watermelon",
"price":7.99
}
Enter fullscreen mode Exit fullscreen mode

Commits

git add .

git commit

git push
Enter fullscreen mode Exit fullscreen mode

DevOps Workflow

GitHub detects

git push
Enter fullscreen mode Exit fullscreen mode

Starts GitHub Actions

Checks out repository

Builds Docker image

Runs syntax check

SSH into EC2

Stops old container

Deletes old container

Builds new image

Runs new container

Deployment complete

Students refresh browser.

Watermelon appears.

Nobody logged into the server manually.


Dockerfile

Students write

FROM python:3.12-slim

WORKDIR /app

COPY . .

RUN pip install -r requirements.txt

EXPOSE 5000

CMD ["python","app.py"]
Enter fullscreen mode Exit fullscreen mode

Now they understand why every line exists.


requirements.txt

Flask
Enter fullscreen mode Exit fullscreen mode

Application

Students write Flask routes.

/

↓

HTML

/products

↓

JSON

/health

↓

Health Check
Enter fullscreen mode Exit fullscreen mode

Now they understand

Frontend

Backend

API

JSON

Browser


CI/CD Workflow

Students create

.github/workflows/deploy.yml
Enter fullscreen mode Exit fullscreen mode

Workflow

Developer Push

↓

GitHub

↓

GitHub Actions

↓

Ubuntu Runner

↓

SSH

↓

EC2

↓

docker stop

↓

docker rm

↓

docker build

↓

docker run
Enter fullscreen mode Exit fullscreen mode

Exactly like production.


Real DevOps Tasks During the Lab

Task 1

Developer says

"I changed prices."

Deploy new version.


Task 2

Developer broke application.

GitHub Action fails.

Find error.


Task 3

Docker container won't start.

Read

docker logs
Enter fullscreen mode Exit fullscreen mode

Task 4

Application works locally.

Not working on EC2.

Investigate.

Students check

  • Security Group
  • Port mapping
  • Flask host
  • Docker container
  • EC2 firewall

Task 5

Developer accidentally deleted

products.json
Enter fullscreen mode Exit fullscreen mode

Deployment failed.

Restore using Git.


Task 6

Deploy Version 2

Website header changes

FreshMart Grocery
Enter fullscreen mode Exit fullscreen mode


FreshMart Grocery v2
Enter fullscreen mode Exit fullscreen mode

Students understand versioning.


Task 7

Rollback

Deploy

v1
Enter fullscreen mode Exit fullscreen mode

again.

Explain

Production engineers rollback all the time.


New Features Every Week

Instead of changing projects, students continue improving the same application.

Week 1

Display products
Enter fullscreen mode Exit fullscreen mode

Week 2

Search products
Enter fullscreen mode Exit fullscreen mode

Week 3

Add categories
Enter fullscreen mode Exit fullscreen mode

Week 4

Shopping cart
Enter fullscreen mode Exit fullscreen mode

Week 5

User login
Enter fullscreen mode Exit fullscreen mode

Week 6

Admin dashboard
Enter fullscreen mode Exit fullscreen mode

Week 7

Database
Enter fullscreen mode Exit fullscreen mode

Week 8

Docker Compose
Enter fullscreen mode Exit fullscreen mode

Week 9

Terraform
Enter fullscreen mode Exit fullscreen mode

Week 10

Kubernetes
Enter fullscreen mode Exit fullscreen mode

Why This Project Works

Many bootcamps make students build a new project every week, so they spend more time understanding the business than learning DevOps.

A more realistic approach is to use one application throughout the entire course. As students learn Git, Docker, AWS, CI/CD, Terraform, Kubernetes, and monitoring, they keep enhancing the same project. This mirrors what happens in real companies, where DevOps engineers support and improve an existing application over months or years rather than constantly starting from scratch.

Top comments (0)