Skip to content
Seraph919Public

About

Inception is a system administration project that uses Docker Compose to run isolated services in separate Debian-based containers, connected by a private network with persistent volumes.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

This project has been created as part of the 42 curriculum by asoudani.

Description

Inception is a system administration project focused on building and running a small web infrastructure using Docker Compose. The goal is to virtualize multiple services as separate containers, built from your own Dockerfiles (Debian-based here), wired together by an isolated Docker network, and persisted using Docker volumes.

This repository provides:

  • NGINX (TLS-only) as the single entrypoint on port 443
  • WordPress running with PHP-FPM (no NGINX inside the WordPress container)
  • MariaDB as the database backend
  • Persistent storage for the WordPress files and MariaDB database
  • A private Docker network connecting services

Bonus services included in this repo:

  • Redis cache for WordPress
  • FTP server pointing to the WordPress files volume
  • Adminer
  • A simple static site
  • Portainer

Instructions

Prerequisites

  • Linux VM (project requirement)
  • Docker + Docker Compose installed
  • Your domain name mapped to the VM IP (project requirement):
    • Add an entry in the VM host file so asoudani.42.fr resolves to your VM.

Secrets

Secrets are stored as local files (ignored by git):

  • secrets/mysql_root_password.txt
  • secrets/mysql_password.txt
  • secrets/wp_admin_password.txt
  • secrets/wp_user_password.txt
  • secrets/ftp_password.txt

Environment variables

Configuration variables are stored in srcs/.env (example values already present in this repo):

  • LOGIN, DATA_PATH, DOMAIN_NAME
  • MYSQL_DATABASE, MYSQL_USER
  • WP_TITLE, WP_ADMIN_USER, WP_ADMIN_EMAIL, WP_USER, WP_USER_EMAIL
  • FTP_USER

Build and run

From the repository root:

  • Start (build + up): make
  • Stop: make clean
  • Stop + remove data directory: make fclean
  • Rebuild from scratch: make re

Access

Mandatory entrypoint:

  • WordPress via NGINX (HTTPS): https://asoudani.42.fr

Bonus services (if enabled/exposed in Compose):

  • Adminer: http://<vm-ip>:8080
  • Static site: http://<vm-ip>:8081
  • Portainer: http://<vm-ip>:9000
  • FTP: connect to <vm-ip> on port 21 (passive ports 21000-21010)

Project design choices

Docker usage & sources

  • Each service has its own Dockerfile under srcs/requirements/<service>/.
  • Images are built locally by Compose (no pre-built service images are used, except the Debian base image).
  • Services are connected through a dedicated Docker network declared in srcs/docker-compose.yml.
  • Containers run a single foreground process (no tail -f, sleep infinity, or similar hacks), respecting PID 1 best practices.

Virtual Machines vs Docker

  • Virtual Machines virtualize hardware and run full guest operating systems; they are heavier but provide strong isolation.
  • Docker containers share the host kernel and isolate processes using namespaces/cgroups; they are lighter and start faster.
  • This project is run inside a VM (as required) while services themselves run as containers inside that VM.

Secrets vs Environment Variables

  • Environment variables are convenient for non-sensitive configuration (domain, usernames, database name).
  • Secrets are used for sensitive values (passwords). In this project, passwords are provided through Docker secrets and read from /run/secrets/... inside containers.

Docker Network vs Host Network

  • A Docker network provides service-to-service connectivity using internal DNS (e.g. mariadb, wordpress) without exposing those services to the host.
  • network_mode: host is avoided (and forbidden by the subject) because it removes network isolation.

Docker Volumes vs Bind Mounts

  • Docker volumes are managed by Docker and are the standard mechanism for persistent container data.
  • Bind mounts map an explicit host path into a container.
  • This project uses named volumes in Compose (e.g. mariadb_data, wordpress_files) and configures them so their data is stored under /home/<login>/data on the host (as required by the subject). This is done via the local volume driver options (driver_opts) pointing to the DATA_PATH directories.

Resources

AI usage

AI was used as a productivity tool to:

  • Documentation and information simplification.

About

Inception is a system administration project that uses Docker Compose to run isolated services in separate Debian-based containers, connected by a private network with persistent volumes.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages