Skip to content

Latest commit

 

History

History
187 lines (140 loc) · 7.48 KB

File metadata and controls

187 lines (140 loc) · 7.48 KB
image

DEVOPS-STACK

CI - GitHub Actions CI - GitLab Docker Platform

A hands-on DevOps project built during an internship to practice real-world workflows — containerization, CI/CD pipelines, infrastructure automation, and security. The project is structured as a multi-tool DevOps stack and deployed using Docker + Nginx, with pipelines running on both GitHub Actions and GitLab CI.


📸 Live Output

Docker Container Running App Served at localhost:8080
devops-nginx image · port 8080→80 "Hello from DevOps Project 🚀"
2026-04-12 (19)

Nginx is serving a static page from inside a Docker container on WSL2 Ubuntu.


✅ What's Implemented

🐳 Docker + Nginx

  • Built a custom Docker image using nginx:alpine as the base
  • Copied app/index.html and nginx/default.conf into the image
  • Exposed port 80, mapped to host port 8080
  • Debugged and fixed a 502 Bad Gateway error (nginx was proxying to a non-existent upstream on port 3000)
  • Fixed a bash entrypoint syntax error (unexpected token 'newline')
  • Successfully ran container: docker run -d -p 8080:80 devops-nginx 2026-04-12 (22)

⚙️ GitLab CI Pipeline

  • Created .gitlab-ci.yml with a build stage and build-job

  • First run failed: docker: command not found on GitLab shared runners 2026-04-12 (27)

    2026-04-12 (43)
  • Fixed by removing Docker dependency from the pipeline job

  • Second run passed (Pipeline #2447320552, 30s) — verified project files, echoed build messages 2026-04-12 (28)

    2026-04-13 (2)
  • Repository: Rengu / devops-stack on GitLab 2026-04-12 (26)

🐙 GitHub Actions

  • Added bash-check.yml workflow with a test-bash job 2026-04-18 (9)

    2026-04-18 (13)
  • Triggered on every push to main

  • Workflow passed on first run (9s total, 4s job time)

  • Repository: rey26341-sudo / devops-stack on GitHub

🔀 Dual Remote Git Setup

  • Configured two remotes: origin (GitLab) and github (GitHub)

  • Push to both simultaneously: git push && git push github main

    2026-04-12

🗂️ Project Structure

devops-stack/
├── app/                  # Static web app (index.html)
├── nginx/                # Nginx config (default.conf)
├── dockerfile            # Docker image definition
├── ansible/              # Ansible playbooks (planned)
├── terraform/            # Terraform IaC scripts (planned)
├── jenkins/              # Jenkins pipeline config (planned)
├── scripts/              # Bash utility scripts
├── security/             # Security patch check scripts
├── screenshots/          # Proof-of-work screenshots
└── README.md

🐛 Real Debugging Done

Problem Fix
Nginx 502 Bad Gateway Removed broken upstream proxy config
GitLab CI docker not found Removed Docker dependency from shared runner job
GitHub auth failure Switched from password to Personal Access Token
Bash entrypoint syntax error Fixed newline formatting in entrypoint script

📋 What's Next

  • Ansible playbook for server config automation
  • Terraform for GCP VM provisioning
  • Jenkins self-hosted pipeline
  • Kubernetes deployment with Helm

🛠️ Tools Used

Tool Purpose Status
Docker Containerization ✅ Implemented
Nginx Reverse proxy / static server ✅ Implemented
GitHub Actions CI pipeline ✅ Implemented
GitLab CI CI pipeline ✅ Implemented
Bash Scripting & automation ✅ Implemented
Ansible Server configuration automation 🔧 In Progress
Terraform Infrastructure as Code 🔧 In Progress
Jenkins CI/CD pipeline (self-hosted) 🔧 In Progress
GCP Cloud VM provisioning 📋 Planned

🚀 Getting Started

Prerequisites

  • Docker installed (or WSL2 + Docker Desktop on Windows)
  • Git

Run Locally

# Clone the repo
git clone https://github.com/rey26341-sudo/devops-stack.git
cd devops-stack

# Build the Docker image
docker build -t devops-nginx .

# Run the container
docker run -d -p 8080:80 devops-nginx

# Open in browser
# → http://localhost:8080

Verify it's running

docker ps
# You should see devops-nginx mapped to 0.0.0.0:8080->80/tcp

🔄 CI/CD Pipeline Flow

Developer pushes code to GitHub / GitLab
         │
         ▼
┌─────────────────────────────────┐
│   GitHub Actions (bash-check)   │  ← triggers on push to main
│   • Runs test-bash job (4s)     │
│   • Status: ✅ PASSING          │
└─────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────┐
│   GitLab CI (.gitlab-ci.yml)    │  ← triggers on push to main
│   • Runs build-job (30s)        │
│   • Verifies project structure  │
│   • Status: ✅ PASSING          │
└─────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────┐
│   Docker image built locally    │  ← manual step (local WSL2)
│   • nginx:alpine base           │
│   • Served at localhost:8080    │
└─────────────────────────────────┘
---
---

## 👤 Author

**Iswaryak / Rengu** — DevOps Intern  
📍 Tiruchirappalli, Tamil Nadu  
🔗 [GitLab](https://gitlab.com/rengu26341) · [GitHub](https://github.com/rey26341-sudo)