Skip to content

Akshatsrii/DockStack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation



ย  ย  ย  ย 


DockStack is a production-grade DevOps platform that simplifies containerized deployments using Docker, Nginx, Terraform, Ansible, and GitHub Actions โ€” all wired into one centralized pipeline.

๐Ÿ“Œ Table of Contents


๐Ÿšจ Problem Statement

Modern application deployment involves multiple steps and tools. Managing them manually is time-consuming, error-prone, and overwhelming โ€” especially for developers new to DevOps.

โŒ Pain Point ๐Ÿ˜ฉ Impact
Manual Docker container setup Time wasted on repetitive config
Complex server configuration High chance of human error
No centralized deployment management Scattered tools, no visibility
Difficult CI/CD pipeline setup Slow release cycles

๐Ÿ’ก Solution

DockStack provides a centralized DevOps platform that integrates all these tools into one seamless workflow.

โœ…  Manage projects from a unified dashboard
โœ…  Deploy applications using Docker containers
โœ…  Route traffic with Nginx reverse proxy
โœ…  Provision cloud infrastructure with Terraform
โœ…  Configure servers automatically with Ansible
โœ…  Automate every deployment with GitHub Actions

๐Ÿ—๏ธ System Architecture

flowchart TD
    U([๐ŸŒ User Browser]) --> N

    subgraph APP ["โšก Application Layer"]
        N[๐Ÿ”€ Nginx\nReverse Proxy :80]
        N --> FE[โš›๏ธ React + Vite\nFrontend]
        N --> BE[๐ŸŸข Node.js + Express\nBackend API]
        BE --> DB[(๐Ÿƒ MongoDB\nDatabase)]
    end

    subgraph INFRA ["๐Ÿ—๏ธ Infrastructure Layer"]
        TF[๐ŸŒ Terraform\nCloud Provisioning]
        AN[๐Ÿค– Ansible\nServer Configuration]
        TF --> AN
    end

    subgraph CICD ["๐Ÿ”„ CI/CD Layer"]
        GH[๐Ÿ“ฆ GitHub Push]
        GA[โš™๏ธ GitHub Actions]
        GH --> GA
        GA -->|SSH + Deploy| APP
    end

    INFRA -->|Prepares Server| APP

    style APP fill:#0d2137,stroke:#00d4ff,color:#7dd3fc
    style INFRA fill:#1a0a2e,stroke:#7B42BC,color:#c4b5fd
    style CICD fill:#0a1f0a,stroke:#16a34a,color:#bbf7d0
Loading

๐Ÿงฐ Tech Stack

๐Ÿ–ฅ๏ธ Frontend

Technology Purpose
React UI Component Library
Vite Lightning-fast Bundler
Axios HTTP Client
React Router Client-side Routing

๐Ÿ”ง Backend

Technology Purpose
Node.js JavaScript Runtime
Express REST API Framework
MongoDB NoSQL Database
JWT Authentication

๐Ÿ› ๏ธ DevOps

Technology Purpose
Docker Containerization
Docker Compose Multi-container Orchestration
Nginx Reverse Proxy
Terraform Infrastructure as Code
Ansible Server Automation
GitHub Actions CI/CD Automation

๐Ÿ“ Project Structure

dockstack-devops-platform/
โ”‚
โ”œโ”€โ”€ ๐ŸŸข backend/
โ”‚   โ”œโ”€โ”€ server.js                    โ† App entry point
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ .env                         โ† Environment variables
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ db.js                    โ† MongoDB connection
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ User.js                  โ† User schema
โ”‚   โ”‚   โ”œโ”€โ”€ Project.js               โ† Project schema
โ”‚   โ”‚   โ””โ”€โ”€ Deployment.js            โ† Deployment schema
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js
โ”‚   โ”‚   โ”œโ”€โ”€ projectController.js
โ”‚   โ”‚   โ””โ”€โ”€ deploymentController.js
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ””โ”€โ”€ authMiddleware.js        โ† JWT verification
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ routes/
โ”‚       โ”œโ”€โ”€ authRoutes.js
โ”‚       โ”œโ”€โ”€ projectRoutes.js
โ”‚       โ””โ”€โ”€ deploymentRoutes.js
โ”‚
โ”œโ”€โ”€ โš›๏ธ  frontend/
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ main.jsx
โ”‚       โ”œโ”€โ”€ App.jsx
โ”‚       โ”œโ”€โ”€ components/
โ”‚       โ”‚   โ”œโ”€โ”€ Navbar.jsx
โ”‚       โ”‚   โ”œโ”€โ”€ Sidebar.jsx
โ”‚       โ”‚   โ””โ”€โ”€ Loader.jsx
โ”‚       โ”œโ”€โ”€ pages/
โ”‚       โ”‚   โ”œโ”€โ”€ Login.jsx
โ”‚       โ”‚   โ”œโ”€โ”€ Register.jsx
โ”‚       โ”‚   โ”œโ”€โ”€ Dashboard.jsx
โ”‚       โ”‚   โ”œโ”€โ”€ Projects.jsx
โ”‚       โ”‚   โ””โ”€โ”€ Profile.jsx
โ”‚       โ”œโ”€โ”€ services/
โ”‚       โ”‚   โ””โ”€โ”€ api.js               โ† Axios API config
โ”‚       โ””โ”€โ”€ context/
โ”‚           โ””โ”€โ”€ AuthContext.jsx      โ† Global auth state
โ”‚
โ”œโ”€โ”€ ๐Ÿ”€ nginx/
โ”‚   โ””โ”€โ”€ default.conf                 โ† Reverse proxy rules
โ”‚
โ”œโ”€โ”€ ๐Ÿณ docker/
โ”‚   โ”œโ”€โ”€ Dockerfile.backend
โ”‚   โ”œโ”€โ”€ Dockerfile.frontend
โ”‚   โ””โ”€โ”€ docker-compose.yml           โ† Orchestrates all services
โ”‚
โ”œโ”€โ”€ ๐ŸŒ terraform/
โ”‚   โ”œโ”€โ”€ main.tf                      โ† Cloud resource definitions
โ”‚   โ””โ”€โ”€ variables.tf
โ”‚
โ”œโ”€โ”€ ๐Ÿค– ansible/
โ”‚   โ””โ”€โ”€ setup.yml                    โ† Installs Docker & Git
โ”‚
โ””โ”€โ”€ ๐Ÿ”„ .github/
    โ””โ”€โ”€ workflows/
        โ””โ”€โ”€ deploy.yml               โ† Auto-deploy on push

โš™๏ธ Installation & Setup

Prerequisites

Make sure these are installed before you begin.

Git Node Docker

1๏ธโƒฃ Clone the Repository

git clone https://github.com/YOUR_USERNAME/DockStack.git
cd DockStack

2๏ธโƒฃ Backend Setup

cd backend
npm install
npm run dev

๐ŸŸข Backend API running at http://localhost:5000

3๏ธโƒฃ Frontend Setup

cd frontend
npm install
npm run dev

โš›๏ธ Frontend running at http://localhost:3000


๐Ÿณ Docker Setup

Run the entire platform โ€” Frontend, Backend, MongoDB, and Nginx โ€” with a single command.

docker-compose -f docker/docker-compose.yml up --build
Container Service Port
๐Ÿ”€ nginx Reverse Proxy 80
โš›๏ธ frontend React App 3000
๐ŸŸข backend Express API 5000
๐Ÿƒ mongo MongoDB 27017

๐ŸŒ Open http://localhost in your browser โ€” Nginx routes everything automatically.


โ˜๏ธ Infrastructure Setup (Terraform)

Provisions a cloud server ready for Docker deployments.

# Move into terraform directory
cd terraform

# Initialize Terraform providers
terraform init

# Preview what will be created
terraform plan

# Provision the server
terraform apply
โœ…  Apply complete!
โœ…  Resources: 2 added, 0 changed, 0 destroyed.
โœ…  Output: server_ip = "xx.xx.xx.xx"

๐Ÿค– Server Configuration (Ansible)

Automatically installs and configures Docker on your remote server.

ansible-playbook ansible/setup.yml
# What setup.yml does:
  โœ”  Install Docker & Docker Compose
  โœ”  Install Git
  โœ”  Configure firewall (UFW)
  โœ”  Enable Docker service on boot

๐Ÿ”„ CI/CD Pipeline

Push to main โ†’ app is live. Zero manual steps.

sequenceDiagram
    participant Dev as ๐Ÿ‘จโ€๐Ÿ’ป Developer
    participant GH  as ๐Ÿ“ฆ GitHub
    participant GA  as โš™๏ธ GitHub Actions
    participant SRV as ๐Ÿ–ฅ๏ธ Cloud Server

    Dev->>GH: git push origin main
    GH->>GA: Trigger deploy.yml workflow
    GA->>GA: ๐Ÿ”‘ Load SSH secrets & ENV
    GA->>SRV: ๐Ÿ“ก SSH into server
    SRV->>SRV: ๐Ÿ“ฅ git pull latest code
    SRV->>SRV: ๐Ÿณ docker compose up --build
    SRV-->>Dev: โœ… Deployment successful!
Loading

Required GitHub Secrets:

Secret Key Description
SSH_PRIVATE_KEY Private key for SSH access
SERVER_IP Your cloud server's public IP
SSH_USER Server login user (e.g. ubuntu)

๐Ÿ” Authentication

JWT-based authentication secures all protected routes.

POST /api/auth/register   โ†’  Create a new account
POST /api/auth/login      โ†’  Login & receive JWT token
GET  /api/projects        โ†’  ๐Ÿ”’ Protected (token required)
GET  /api/deployments     โ†’  ๐Ÿ”’ Protected (token required)
Client โ”€โ”€โ”€โ”€ POST /login โ”€โ”€โ”€โ”€โ–ถ Server
             โ—€โ”€โ”€ JWT Token โ”€โ”€โ”€โ”€
Client โ”€โ”€โ”€โ”€ Authorization: Bearer <token> โ”€โ”€โ–ถ Protected Routes

๐Ÿ“Š Features

Feature Status
๐Ÿ” JWT User Authentication โœ… Done
๐Ÿ“‚ Project Management Dashboard โœ… Done
๐Ÿš€ Deployment Tracking โœ… Done
๐Ÿณ Dockerized Services โœ… Done
๐Ÿ”€ Nginx Reverse Proxy โœ… Done
๐ŸŒ Infrastructure as Code (Terraform) โœ… Done
๐Ÿค– Server Automation (Ansible) โœ… Done
๐Ÿ”„ CI/CD with GitHub Actions โœ… Done

๐Ÿ”ฎ Future Improvements

๐Ÿ”œ  Kubernetes Deployment         โ€” Container orchestration at scale
๐Ÿ”œ  Real-time Deployment Logs     โ€” Live streaming log output
๐Ÿ”œ  Prometheus & Grafana          โ€” Metrics, dashboards & alerting
๐Ÿ”œ  GitHub Repository Integration โ€” One-click repo imports
๐Ÿ”œ  Automatic Container Scaling   โ€” Load-based autoscaling
๐Ÿ”œ  Role-Based Access Control     โ€” Fine-grained permissions

๐Ÿ‘จโ€๐Ÿ’ป Author

Akshat Srivastava

B.Tech IT Engineering Student DevOps & Full Stack Development Enthusiast


GitHub LinkedIn

Built with โค๏ธ, countless docker compose up attempts, and way too much coffee โ˜•


๐Ÿค Contributing

Contributions are always welcome! Here's how to get started:

# 1. Fork the repository
# 2. Create your feature branch
git checkout -b feature/your-feature-name

# 3. Commit your changes
git commit -m "feat: add your feature"

# 4. Push and open a Pull Request
git push origin feature/your-feature-name

๐Ÿ“œ License

This project is open-source and available under the MIT License.

MIT License โ€” Free to use, modify, and distribute with attribution.

โญ Found this project helpful? Drop a star โ€” it means a lot! โญ


About

DockStack is a full-stack DevOps project that demonstrates containerized application deployment using Docker, CI/CD automation with GitHub Actions, infrastructure provisioning with Terraform, and server configuration using Ansible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors