Inception

A system administration project setting up a multi-container Docker infrastructure with Nginx, WordPress, and MariaDB from scratch.

2022-04-01

Inception

Inception

A multi-container Docker setup for hosting WordPress, built entirely from scratch. No pre-built application images from Docker Hub, every Dockerfile is written by hand. The goal was to understand how a real hosting stack fits together at the container level.

Architecture

           +----------------------------------------+
           |            Docker Network              |
           |                                        |
:443  -->  |  [NGINX]  -->  [WordPress + PHP-FPM]   |
           |                        |               |
           |                   [MariaDB]            |
           +----------------------------------------+
                    |                    |
              [Volume: wp]         [Volume: db]
ContainerWhat it does
NGINXTLS termination, reverse proxy to PHP-FPM
WordPressPHP-FPM app server
MariaDBDatabase

Services

NGINX only listens on port 443 (HTTPS). TLS is configured with a self-signed cert using TLSv1.2/1.3. PHP requests go to WordPress via FastCGI on port 9000.

WordPress is installed and configured at startup through wp-cli. PHP-FPM handles requests instead of Apache. The admin and a regular user are both created automatically from environment variables.

MariaDB has its own named volume so data survives restarts. It's not reachable outside the Docker network.

Rules this follows

  • All images built from Debian or Alpine base images
  • Containers restart automatically on failure
  • No hardcoded credentials in any Dockerfile
  • One process per container

Running it

make        # build and start everything
make down   # stop containers
make clean  # remove containers, images, volumes
make re     # full rebuild

SCREENSHOTS // 01 FRAMES

Screenshot 1
01 / 01