Skip to content

mhmdhussein/42-inception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Inception - Containerized Web Infrastructure

A fully containerized, production-inspired web infrastructure built with Docker and Docker Compose, featuring WordPress, MariaDB, NGINX, and multiple bonus services.

This project demonstrates modern DevOps practices including service isolation, automated deployment, secure configuration, and monitoring.


📌 Overview

This project implements a complete web stack using containerization:

  • Reverse proxy with SSL (NGINX)
  • Dynamic website (WordPress + PHP-FPM)
  • Relational database (MariaDB)
  • Caching (Redis)
  • Database management (Adminer)
  • File transfer (FTP)
  • Static website hosting
  • System monitoring (Prometheus + Node Exporter)

All services are isolated in independent containers and orchestrated using Docker Compose.


🏗️ Architecture


Client (Browser)
|
v
NGINX (HTTPS)
|
v
PHP-FPM (WordPress) <--> Redis
|
v
MariaDB

Additional services:

  • Adminer (DB management)
  • FTP (File access)
  • Prometheus + Node Exporter (Monitoring)
  • Static site (Independent NGINX)

🚀 Features

  • Fully automated WordPress installation
  • HTTPS with self-signed certificates
  • Secure environment variable management
  • Persistent data storage
  • Container health isolation
  • Automatic service orchestration
  • Performance caching with Redis
  • Infrastructure monitoring
  • Clean rebuild support

📂 Project Structure


.
├── Makefile
├── README.md (named ft_README.md here)
├── DEV_DOC.md
├── USER_DOC.md
└── srcs/
    ├── docker-compose.yml
    ├── .env.example
    └── requirements/
        ├── nginx/
        ├── wordpress/
        ├── mariadb/
        └── bonus/

Each service contains:

  • A dedicated Dockerfile
  • Configuration files
  • Startup scripts

⚙️ Technologies Used

Category Stack
Containers Docker
Orchestration Docker Compose
Web Server NGINX
Backend PHP-FPM
CMS WordPress
Database MariaDB
Cache Redis
Monitoring Prometheus, Node Exporter
OS Base Debian Bookworm

🔐 Environment Configuration

Environment variables are stored in a .env file (not committed).

Example:

DOMAIN_NAME=example.com

MYSQL_DATABASE=wordpress
MYSQL_USER=wp_user
MYSQL_PASSWORD=secret
MYSQL_ROOT_PASSWORD=rootpass

WORDPRESS_DB_NAME=wordpress
WORDPRESS_DB_USER=wp_user
WORDPRESS_DB_PASSWORD=secret
WORDPRESS_DB_HOST=mariadb

A .env.example file is provided for reference.


▶️ Getting Started

Prerequisites

  • Linux (recommended)
  • Docker
  • Docker Compose

Installation

git clone https://github.com/mhmdhussein/42-inception.git
cd inception
cp srcs/.env.example srcs/.env
make

(Don't forget to edit the .env file)


Stop Services

make down

Full Cleanup

make fclean

⚠️ This removes all data.


🌍 Accessing Services

Service URL
WordPress https://your-domain.42.fr
Adminer http://localhost:8080
Static Site http://localhost:8081
Prometheus http://localhost:9090
FTP localhost:21

💾 Data Persistence

All persistent data is stored on the host:

/home/<user>/data/
├── wordpress/
└── mariadb/

This ensures data survives container restarts and system reboots.


📊 Monitoring

Prometheus collects metrics from:

  • Node Exporter (host system)
  • Containers

Provides visibility into:

  • CPU usage
  • Memory
  • Disk
  • Network
  • Container health

🧠 DevOps Concepts Demonstrated

  • Infrastructure as Code
  • Service isolation
  • Automated provisioning
  • Environment-based configuration
  • Secure secret management
  • Zero-downtime rebuilds
  • Observability
  • Network segmentation
  • Reverse proxy design

🔍 Troubleshooting

Check running containers:

docker compose ps

View logs:

docker logs <container>

Restart stack:

make down && make

📜 License

This project is licensed under the MIT License. You are free to use, modify, and distribute this project with proper attribution.

About

Part of the 42 curriculum. A production-inspired containerized web infrastructure built with Docker and Docker Compose, featuring WordPress, NGINX, MariaDB, Redis, FTP, and monitoring with Prometheus.

Topics

Resources

License

Stars

Watchers

Forks

Contributors