Technical reference for the Inception Docker stack.
This document is designed for anyone who needs to understand how configuration, secrets, templates, and entrypoints behave on the Inception project implementation.
- System Model
- Configuration Model (
srcs/.env) - Secrets Model
- Configuration Sources
- Runtime Service Internals
- Make Targets
- Persistence
The stack is split across two Docker networks:
- Frontend network: internet-facing path (
client -> nginx -> php-fpm). - Backend network: data path (
php-fpm -> mariadb).
Persistence is provided by two host-backed Docker volumes:
- WordPress data (
/var/wwwin container). - MariaDB data (
/var/lib/mysqlin container).
All non-secret configuration is centralized in srcs/.env.
| Variable | Description |
|---|---|
USER_LOGIN |
Login name; used to derive domain and host data paths |
DOMAIN_NAME |
Site domain (default: ${USER_LOGIN}.42.fr) |
ROOT_DOMAIN |
Root domain used for WordPress setup |
SITE_TITLE |
WordPress site title |
COMPOSE_PROJECT_NAME |
Docker Compose project name |
Two isolated networks are created.
Frontend network (internet <-> nginx <-> php-fpm):
| Variable | Description |
|---|---|
NETWORK_FRONTEND_NAME |
Network name |
NETWORK_FRONTEND_SUBNET |
Subnet CIDR |
NETWORK_FRONTEND_GATEWAY |
Gateway IP |
NETWORK_FRONTEND_NGINX_IP |
Static IP for NGINX |
NETWORK_FRONTEND_PHPFPM_IP |
Static IP for PHP-FPM |
Backend network (php-fpm <-> mariadb):
| Variable | Description |
|---|---|
NETWORK_BACKEND_NAME |
Network name |
NETWORK_BACKEND_SUBNET |
Subnet CIDR |
NETWORK_BACKEND_GATEWAY |
Gateway IP |
NETWORK_BACKEND_PHPFPM_IP |
Static IP for PHP-FPM |
NETWORK_BACKEND_DB_IP |
Static IP for MariaDB |
| Variable | Description |
|---|---|
VOLUME_DB_NAME |
Docker volume name for MariaDB data |
VOLUME_DB_MOUNTPOINT |
Container mount point for DB data (/var/lib/mysql) |
VOLUME_DB_HOST_PATH |
Host path for DB persistence |
VOLUME_WP_NAME |
Docker volume name for WordPress data |
VOLUME_WP_MOUNTPOINT |
Container mount point for WordPress (/var/www) |
VOLUME_WP_HOST_PATH |
Host path for WordPress persistence |
| Variable | Description |
|---|---|
MDB_BUILD_CONTEXT |
Build context path |
MDB_DOCKERFILE |
Dockerfile name |
MDB_IMAGE_REPO |
Image repository |
MDB_IMAGE_TAG |
Image tag |
MDB_CONTAINER_NAME |
Container name |
MDB_CONFIG_ENV |
Env file path for the service |
MDB_ADMIN |
MariaDB admin username (stored as secret) |
MDB_CHARSET |
Default character set |
MDB_COLLATION |
Default collation |
MDB_ENGINE_PORT |
MariaDB engine port (default: 3306) |
| Variable | Description |
|---|---|
WP_BUILD_CONTEXT |
Build context path |
WP_DOCKERFILE |
Dockerfile name |
WP_IMAGE_REPO |
Image repository |
WP_IMAGE_TAG |
Image tag |
WP_CONTAINER_NAME |
Container name |
WP_CONFIG_ENV |
Env file path for the service |
WP_DB_NAME |
WordPress database name |
WP_DB_ADMIN |
DB user with privileges on WordPress DB (stored as secret) |
WP_DB_CHARSET |
WordPress DB character set |
WP_DB_COLLATION |
WordPress DB collation |
PHPFPM_LISTEN_PORT |
PHP-FPM listen port (default: 9000) |
DB_HOST |
MariaDB host reachable by WordPress |
DB_SERVICE_PORT |
MariaDB port reachable by WordPress |
DB_NAME |
Database name used by WordPress |
DB_USER |
Database user used by WordPress |
WP_VERSION |
WordPress version to install |
WP_ADMIN |
WordPress admin username (stored as secret) |
WP_ADMIN_MAIL |
WordPress admin email (stored as secret) |
WP_USER |
Additional WordPress username (stored as secret) |
WP_USER_ROLE |
Role for the additional user |
WP_USER_MAIL |
Email for the additional user (stored as secret) |
WP_WEBROOT |
Web root path inside the container |
| Variable | Description |
|---|---|
NGINX_BUILD_CONTEXT |
Build context path |
NGINX_DOCKERFILE |
Dockerfile name |
NGINX_IMAGE_REPO |
Image repository |
NGINX_IMAGE_TAG |
Image tag |
NGINX_CONTAINER_NAME |
Container name |
NGINX_CONFIG_ENV |
Env file path for the service |
NGINX_HOST_PORT |
Exposed host port (default: 443) |
NGINX_LISTEN_PORT |
Internal NGINX listen port |
NGINX_PHP_SERVICE |
PHP-FPM hostname |
NGINX_PHP_SERVICE_PORT |
PHP-FPM port used by NGINX |
WEB_DATA |
Root directory for served content |
| Variable | Description |
|---|---|
KEY_NAME |
SSL private key filename |
KEY_PATH |
Key directory in container (/run/secrets) |
KEY_SECRET_NAME |
Docker secret name for key |
CERT_NAME |
SSL certificate filename |
CERT_PATH |
Certificate directory in container (/run/secrets) |
CERT_SECRET_NAME |
Docker secret name for cert |
These values are composed automatically from repository and tag variables.
| Variable | Pattern |
|---|---|
DB_IMAGE_NAME |
${MDB_IMAGE_REPO}:${MDB_IMAGE_TAG} |
WP_IMAGE_NAME |
${WP_IMAGE_REPO}:${WP_IMAGE_TAG} |
NGINX_IMAGE_NAME |
${NGINX_IMAGE_REPO}:${NGINX_IMAGE_TAG} |
Secret values are file-based and must not be placed in srcs/.env.
Required structure:
secrets/
├── mariadb/
│ ├── mysql_root_password.secret
│ ├── mysql_wp_db_admin_password.secret
│ └── mysql_wp_db_admin_username.secret
├── wordpress-php/
│ ├── wp_admin_password.secret
│ ├── wp_admin_username.secret
│ ├── wp_admin_mail.secret
│ ├── wp_user_password.secret
│ ├── wp_user_username.secret
│ └── wp_user_mail.secret
└── ssl/
├── dbarba-v.42.fr.cert
└── dbarba-v.42.fr.key
| Service | Source file |
|---|---|
| NGINX (global) | srcs/requirements/nginx/conf/nginx.conf |
| NGINX (vhost template) | srcs/requirements/nginx/conf/server.conf.tmpl |
| PHP-FPM template | srcs/requirements/wordpress-php/conf/php-fpm.conf.tmpl |
| MariaDB template | srcs/requirements/mariadb/conf/my.cnf.tmpl |
nginx.conf is copied from /nginx-docker/conf/nginx.conf to /etc/nginx/nginx.conf.
server.conf.tmpl is rendered with envsubst into /etc/nginx/conf.d/${DOMAIN_NAME}.conf using:
${DOMAIN_NAME} ${NGINX_LISTEN_PORT} ${NGINX_HOST_PORT}
${CERT_NAME} ${KEY_NAME} ${CERT_PATH} ${KEY_PATH}
${WEB_DATA} ${WP_CONTAINER_NAME} ${PHPFPM_HOST} ${PHPFPM_LISTEN_PORT}
The resulting vhost:
- Rejects unknown hosts with HTTP
444. - Redirects HTTP (
80) to HTTPS (443). - Terminates TLS and serves content from
${WEB_DATA}/${DOMAIN_NAME}. - Proxies
*.phpto${PHPFPM_HOST}:${PHPFPM_LISTEN_PORT}. - Applies security headers (for example
X-Frame-Options,X-Content-Type-Options, CSP). - Caches static assets for 180 days.
- Denies hidden files and PHP execution in upload directories.
tools/setup.sh performs startup orchestration, then execs NGINX:
- Move
nginx.confinto/etc/nginx/nginx.conf. - Render
server.conf.tmpland remove the template. - On restart, verify rendered vhost config exists.
- Validate config using
nginx -t. exec /usr/sbin/nginxso NGINX becomes PID 1.
my.cnf.tmpl is rendered into /etc/mysql/mariadb.conf.d/99-custom.cnf with:
${MDB_CHARSET}${MDB_COLLATION}${MDB_ENGINE_PORT}
Because MariaDB loads files in that directory, the 99- prefix ensures these values apply after defaults.
tools/setup.sh initializes on first boot and starts mariadbd:
- Read secrets from
/run/secrets/mysql_root_passwordand/run/secrets/mysql_wp_db_admin_password. - Render
my.cnf.tmplinto99-custom.cnf. - First boot only: run
mariadb-install-dbon/var/lib/mysql. - Start temporary
mariadbdwith--skip-networking. - Poll readiness with
mysqladmin pingfor up to 60s. - Secure installation:
- Set
root@localhostpassword. - Remove anonymous users.
- Remove
testdatabase. FLUSH PRIVILEGES.
- Set
- Create WordPress DB and DB admin user if missing.
- Shut down temporary instance (
mysqladmin shutdown). exec /usr/sbin/mariadbd --user=mysql --datadir=/var/lib/mysql.
php-fpm.conf.tmpl is rendered into /etc/php/${PHP_FPM_VERSION}/fpm/php-fpm.conf.
Substituted variable:
${PHPFPM_LISTEN_PORT}(bind address becomes0.0.0.0:${PHPFPM_LISTEN_PORT})
tools/setup.sh installs/configures WordPress, then starts PHP-FPM:
- Read secrets from
/run/secrets(DB admin password, WP admin password, WP user password). - Render
php-fpm.conf.tmpl; fail fast if template is missing. - Install WP-CLI (
/usr/local/bin/wp) if absent. - First boot only: download WordPress core with configured
WP_VERSION. - First boot only:
- Generate
wp-config.phpusing DB credentials. - Run
wp core install. - Update plugins.
- Create secondary WordPress user.
- Install and activate
twentytwentythreetheme. - Create a static front page and set it as homepage.
- Generate
- Set ownership of
${WP_WEBROOT}towww-data:www-data. exec php-fpm${PHP_FPM_VERSION} -F; fallback tophp-fpmif needed.
| Command | Description |
|---|---|
make / make inception / make all / make up |
Start all containers in detached mode |
make down |
Stop and remove containers and networks (volumes kept) |
make stop |
Stop containers without removing them |
make restart |
Restart all containers |
| Command | Description |
|---|---|
make ps |
Show container status |
make secrets |
Verify and create missing secret files |
make shell SERVICE=<name> |
Open /bin/sh in a running container |
make config |
Show fully resolved Compose config |
| Command | Description |
|---|---|
make build |
Rebuild images using configured .env |
make clean |
Remove containers, volumes, and host data directories |
make fclean |
Full cleanup: containers, volumes, images, host data |
make re |
Rebuild from scratch (fclean + all) |
| Volume Name | Container Path | Host Path |
|---|---|---|
wordpress_data |
/var/www |
/home/${USER_LOGIN}/data/wordpress |
database_data |
/var/lib/mysql |
/home/${USER_LOGIN}/data/mariadb |