DEV Community

Cover image for Full stack DevOps Lab
EMMANUEL
EMMANUEL

Posted on

Full stack DevOps Lab

In this article, i am going to dive in ,in detail, on full stack DevOps lab. We have got to have these required Downloads

1.Node.js(v18 or higher)- Current LTS:v20.x

  • Download from: https://nodejs.org/
  • Choose the LTS version (20.x as of 2025)
  • Choose your Operating system,i will be using Mac, using nvm with npm
  • Verify installation: node --version and npm --version using VS code.

Installation of Node.js

Node.js Download

2.Git - Latest stable version

Git download

  • Choose your operating system version/install Homebrew

Homebrew install

Homebrew

  • Install git

Install git

Install git

  • Verify installation: git --version

Verification of git version

3.Docker Desktop - Latest version

Docker download

  • Install and start Docker Desktop

Docker desktop

  • Verify installation: docker --version and docker-compose --version

Docker version

4. GitHub Account

Sign up at: https://github.com. You'll need this for hosting your code and CI/CD pipeline.

Github Account

5.Code Editor (Optional but recommended)

VS Code

  • Or any editor you prefer (Sublime Text, Atom, etc.) but in this lab, I'm going to use VS Code.

Verify Everything is Installed

  • node --version
  • npm --version
  • git --version
  • docker --version

Verification of required downloads

I have got all our the requirement for this Full stack DevOps lab, now lets go into steps for our Full stack DevOps lab. On the course of this process, I'm going to use VS Code as our Code Editor and the Terminal. I'm going to open my VS Code and create a Folder for this Project.

Working Terminal and Code Editor

Step 1: Set Up Git for Version Control

This Configures Git on your machine so it knows who you are when you make commits, and sets up proper project tracking.

A. One-time Git Configuration

  • git config --global user.name "Emmanuel"
  • git config --global user.email "emmanuelobinnaonyemuche"
  • git config --global init.defaultBranch main

One time Git Configuration

B. Create and Initialize Project
I created a folder initially for project, but now I'm going to create a specific folder for the project. Then Cd into it and create a local git for the directory.

  • mkdir my-devops-project
  • cd my-devops-project
  • git init

Create and Initialize project

Step 2: Build a Node.js Web App

What this step does: Creates a web application using Node.js that can serve web pages and API endpoints.

A. Initialize Node.js Project

This Creates a package.json file that describes your project and manages dependencies.

npm init -y

Initialize Node.js

B. Update package.json

What this step does: Customizes the package.json with proper scripts and metadata for your DevOps project. Create/edit package.json. Paste the code.

Update package.json

C. Create Application File

What this code does:

  • Creates an HTTP server that listens on port 3000
  • Serves different endpoints (/, /health, /info, /metrics)
  • Includes security headers and proper error handling
  • Provides graceful shutdown capability
  • Exports the server for testing

Create app.js:

To create a text file, I'm going to use this command,touch app.js,then paste the code to create app.js

App.js

D. Install Dependencies

We install dependencies so we don’t have to build everything from scratch. Dependencies are pre-written, tested code that your app depends on to work.

What you'll see:
A node_modules/ folder with all installed packages
A package-lock.json file that locks dependency versions

  • Install testing and development tools
    npm install --save-dev jest eslint supertest

  • Install all dependencies (creates node_modules folder)
    npm install

Install Dependencies

Step 3: Create Proper Tests

What this step does: Sets up automated testing so you can verify your application works correctly every time you make changes.

A. Create tests directory and test file

Create a folder for your tests
mkdir tests

Create the main test file

touch tests/app.test.js

Proper Tests

B. Create test file

Copy this code into tests/app.test.js:

App.test.js

C. Create Jest configuration

Create jest.config.js,copy and paste the code

jest configuration

Step 4: GitHub Actions CI/CD Pipeline

What this step does: Creates an automated pipeline that runs tests and builds Docker images every time you push code to GitHub.

A. Create workflow directory

Create the GitHub Actions directory structure
mkdir -p .github/workflows

Workflow directory

B. Create CI/CD pipeline file

Create .github/workflows/ci.yml:

In VS Code, use touch command touch .github/workflows/ci.yml. then copy and the code in ci.yml 1,U.

Create CI/CD pipeline file

Step 5: Dockerfile

What this step does: Creates instructions for Docker to build a container image of your application that can run anywhere.

What this Dockerfile does:

  • Uses multi-stage builds for smaller image size
  • Installs curl for health checks
  • Creates a non-root user for security
  • Sets up proper file permissions
  • Configures health checks

Create Dockerfile:

In your terminal, use this command touch dockerfile,to create a docker file, then copy the code below and paste.

Dockerfile in VS Code

Step 6: Essential Configuration Files

This Creates configuration files that tell various tools what to ignore, how to behave, and what settings to use.

A.Create .dockerignore

Create .dockerignore:

In your Terminal, use touch .dockerignore and paste the code below

Dockerignore
`

B.Create .gitignore

Create .gitignore:

Use touch command to create a text file for gitignore and copy and paste the code .

gitignore

C.Create environment template

Create .env.example:

Use touch .env.example Command to create this, copy and pasts the code.

env.example

D. Create ESLint configuration

Create .eslintrc.js:

Use touch .eslintrc.js Command to create this, copy and pasts the code.

.eslintrc.js configuration

Step 7: Docker Compose for Development

What this step does: Creates a Docker Compose file that makes it easy to run your application and any supporting services with a single command.

Create docker-compose.yml:

Use touch docker-compose.yml Command to create this, copy and pasts the code

docker-compose.yml
`

Step 8: Test Everything Locally

What this step does: Shows you how to actually run and test your application locally before deploying it.

A. Install and Test Locally

Install all dependencies from package.json

npm install

npm install

Run your test suite to make sure everything works

npm test

npm test

Start the application server

npm start

npm start

What you'll see:

  • Tests should pass with green checkmarks: ✓ GET / should return welcome page
  • Server starts and shows: 🚀 Server running at http://localhost:3000/

Test endpoints (in a new terminal window):

Homepage

Health check JSON

System info JSON

Prometheus metrics

B.Docker Commands

# Build image

docker build -t my-devops-app:latest .

docker build

# Run container

Run container

# Check container status

docker ps
docker logs my-devops-container

Container status

# Test health check

curl http://localhost:3000/health

Health check

# Stop container

  • docker stop my-devops-container
  • docker rm my-devops-container

docker stop/remove

C. Docker Compose Commands

# Start all services defined in docker-compose.yml

docker-compose up -d

docker-compose up

# View real-time logs from all services

docker-compose logs -f

docker-compose logs

# Stop all services and clean up

docker-compose down

docker-compose down

Step 9: Deploy to GitHub

What this step does: Commits your code to Git and pushes it to GitHub so the automated CI/CD pipeline can start working.

A. Initial commit

# Add all files to Git staging area

git add .

# Create your first commit with a descriptive message

git commit -m "Initial commit: Complete DevOps setup with working CI/CD"

Initial commit

B. Connect to GitHub

⚠️ IMPORTANT: Before running these commands:

  • Go to GitHub.com and create a new repository called my-devops-project

my-devops-project

  • DO NOT initialize it with README, .gitignore, or license (we already have these)

new repository

  • Copy the repository URL from GitHub

URL from GitHub

  • Replace YOUR_GITHUB_USERNAME below with your actual GitHub username

# Set main as the default branch

git branch -M main

git branch -M main

# Connect to your GitHub repository (UPDATE THIS URL!)

git remote add origin https://github.com/EMMANUELOBINNAONYEMUCHE/Day1-Fullstack-devOps-project.git

GitHub repository

# Push your code to GitHub for the first time

git push -u origin main

git push

Step 10: Kubernetes Deployment Configurations

What this step does: Creates Kubernetes configuration files that define how your application should run in staging and production environments.

A. Create directories
mkdir -p k8s/staging k8s/production

directory for staging and production

B. Create Staging Deployment

Create k8s/staging/deployment.yml:
use touch k8s/staging/deployment.yml to create an empty text file and paste the code .

⚠️ IMPORTANT: Update YOUR_GITHUB_USERNAME in the image URL below!

Staging area

C. Create Production Deployment

Create k8s/production/deployment.yml:

use touch k8s/production/deployment.yml to create an empty text file and paste the code.

⚠️ IMPORTANT: Update YOUR_GITHUB_USERNAME in the image URL below

Production stage

Step 11: Complete Deployment Workflow

What this step does: Shows you how to use the complete CI/CD pipeline with proper branching strategy for staging and production deployments.

Branch-based Deployment Strategy

  • develop branch → Automatically deploys to staging environment
  • main branch → Automatically deploys to production environment
  • Pull requests → Run tests only (no deployment)

A. Deploy Changes
Deploy to staging:

  • # Create and switch to develop branch git checkout -b develop_

git checkout

  • # Make your changes, then commit and push git add .

git add .

git commit -m "Add new feature"

git commit

git push origin develop

git push origin develop

git pushed develop in github

Completed jobs

B. Deploy to production:

Switch to main branch

git checkout main

git checkout main

# Merge changes from develop
git merge develop

git merge develop

# Push to trigger production deployment
git push origin main

git push origin main

Pushed to production stage

This Full Stack DevOps lab provides a comprehensive, hands-on exploration of modern software delivery practices. Beginning with a simple Node.js application, the lab incrementally evolves into a fully automated, production-style system that reflects how DevOps teams operate in real-world environments.

A key strength of the lab is how it demonstrates the interconnected nature of the DevOps lifecycle. Local development, containerization with Docker, automated testing through GitHub Actions, and deployment to staging and production environments using Kubernetes are presented as an integrated workflow rather than isolated steps. This approach clearly illustrates DevOps as a continuous delivery pipeline where each stage depends on the reliability and consistency of the previous one.

The lab strongly emphasizes automation and standardization. By implementing CI/CD pipelines and a branch-based deployment strategy, manual intervention is minimized and the risk of deployment errors is significantly reduced. Automated testing, image builds, and environment-specific deployments ensure predictable and repeatable outcomes, reinforcing core DevOps principles such as reliability, traceability, and trust in the delivery pipeline.

Beyond technical implementation, the lab highlights DevOps as an operational and cultural mindset. It underscores the importance of building systems that are secure, observable, scalable, and maintainable. Overall, this lab establishes a solid foundation for designing and managing real-world DevOps workflows and prepares learners to confidently engage with more complex, production-grade environments.

Top comments (0)