Skip to content

Latest commit

 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inception — Infrastructure with Docker

SysAdmin project from the 42 curriculum, built by madelvin.

A small, containerized web infrastructure: every service runs in its own isolated container, orchestrated with Docker Compose and built from scratch on Debian BookWorm.

Services

Service Role Entry point
NGINX The only public entry point. Serves TLS v1.2/v1.3 on port 443 and routes traffic to the other services. https://<domain>
WordPress CMS running on php-fpm (port 9000). https://<domain>
MariaDB Database used by WordPress. internal
Redis Cache to speed up WordPress. internal
Adminer Web interface to manage the database. https://adminer.<domain>
Static site Simple static website served behind NGINX. https://static.<domain>
Portainer Web interface to manage Docker. https://portainer.<domain>
FTP File transfer server (ports 21, 21000-21010). ftp://<domain>

Architecture

                            ┌───────────────────────┐
  HTTPS :443  ─────────────▶│         NGINX         │  TLS 1.2 / 1.3
                            │  seul point d'entrée  │
                            └───────────┬───────────┘
                                        │
          ┌──────────────┬──────────────┼──────────────┬──────────────┐  inception_network (bridge)
          ▼              ▼              ▼              ▼              ▼
    ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐
    │ WordPress │  │  Adminer  │  │Static site│  │ Portainer │  │    FTP    │
    │  php-fpm  │  │  php-fpm  │  │   proxy   │  │docker.sock│  │           │
    └─────┬─────┘  └─────┬─────┘  └───────────┘  └───────────┘  └───────────┘
          │              │
          ├───────────┐  │
          ▼           ▼  ▼
    ┌───────────┐  ┌───────────┐
    │   Redis   │  │  MariaDB  │
    │   :6379   │  │   :3306   │
    └───────────┘  └───────────┘

All containers communicate over a private Docker bridge network using their service names. Only NGINX and FTP are exposed to the host.

Design choices

  • PID 1 philosophy — every service runs in the foreground with proper signal handling. No hacky tricks like tail -f.
  • No hardcoded secrets — all passwords and configuration come from a .env file, never from the Dockerfiles.
  • Named volumes / data persistence — database and WordPress files live on the host in /home/madelvin/data, so nothing is lost on restart.
  • Healthchecks & dependency ordering — services only start when their dependencies are healthy (e.g. WordPress waits for MariaDB and Redis).

Quick start

1. Prerequisites

  • Docker and Docker Compose
  • make

2. Configure your environment

cd srcs
cp .env-exemple .env

Edit srcs/.env and set your own DOMAIN_NAME and passwords.

Then map the domain to 127.0.0.1 in your /etc/hosts:

127.0.0.1  <domain>
127.0.0.1  adminer.<domain>
127.0.0.1  static.<domain>
127.0.0.1  portainer.<domain>

3. Build & launch

make all

Everything is managed from the Makefile at the repository root:

Command Action
make all Build and start all services
make up Start the services
make stop Stop the containers
make down Stop and remove containers + network (data kept)
make clean down + delete the data in /home/madelvin/data
make fclean Full cleanup: containers, volumes, images and data
make re fclean then rebuild everything
make logs Follow the logs of all services
make ps Show container status

The site is then available at https://<domain>.

Where is the data?

Persistent data is stored on the host and survives any container restart:

  • /home/*USER*/data/mariadb — database files
  • /home/*USER*/data/wordpress — WordPress files (themes, plugins, uploads)

Use make clean or make fclean to delete it.

Resources

Developer & user guides

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages