Infrastructure with Docker and Docker Compose for deploying a complete web application in containers.
Project that configures a complete development and production environment using Docker and Docker Compose. It implements a stack of modern technologies to serve scalable web applications with multiple services (web server, database, application).
The project implements a microservices architecture with the following components:
- Web Server (Nginx): Reverse proxy and web server
- Database (MariaDB): Relational database
- Application (WordPress): Content management system or custom web application
- Isolated Docker containers for each service
- Orchestration with Docker Compose
- Docker networks for inter-service communication
- Persistent volumes for data
- Configurable environment variables
- SSL/TLS configuration
Docker Compose stack to deploy a WordPress site with MariaDB, Nginx and several optional (bonus) services.
This README documents the actual commands and configuration used by the Makefile and srcs/docker-compose.yml in this folder.
Key points:
- The project uses
srcs/docker-compose.ymlas the compose file and reads runtime variables from the repository.envfile. - There are core services (WordPress, MariaDB, Nginx, Redis) and bonus services (FTP, static site, Adminer, Portainer). Bonus services are activated with Docker Compose profiles.
inception/
├── Makefile
├── srcs/
│ ├── docker-compose.yml
│ ├── requirements/
│ │ ├── nginx/
│ │ ├── mariadb/
│ │ └── wordpress/
│ └── bonus/
└── .env # environment variables used by the stack
wordpress— PHP/WordPress (build:./requirements/wordpress). Useswordpress_datavolume and depends ondbandredis.db— MariaDB (build:./requirements/mariadb). Usesdb_datavolume.nginx— Reverse proxy (build:./requirements/nginx). Exposes port443.redis— Redis cache (built from./bonus/redis). Included as a dependency for WordPress.
Bonus (profile-protected) services — started only when profiles are enabled (see Makefile all target):
ftp— FTP server (build:./bonus/ftp). Binds host folder/home/jeandrad/data/wordpressinto the container and exposes ports21and passive range21100-21110.static_site— Static site container (build:./bonus/static-site).adminer— DB admin tool exposed on port8080.portainer— Portainer UI exposed on port9443and usingportainer_datavolume.
make all— Start all services, including bonus ones:docker compose --env-file .env -f srcs/docker-compose.yml --profile "*" up --build -dmake up— Start only core services (no profiles):docker compose --env-file .env -f srcs/docker-compose.yml up --build -dmake down— Stop and remove all containers (core + bonus):docker compose --env-file .env -f srcs/docker-compose.yml --profile "*" down --volumesmake clean— Stop and remove containers, volumes and images:docker compose --env-file .env -f srcs/docker-compose.yml --profile "*" down --volumes --rmi allmake logs— Follow logs for all services:docker compose --env-file .env -f srcs/docker-compose.yml logs -f
Run these targets from the inception/ repository root.
Place a .env file in the inception/ folder. The compose files reference these variables (example names used in docker-compose.yml):
MYSQL_ROOT_PASSWORD=your_root_password
MYSQL_DATABASE=wordpress_db
MYSQL_USER=wp_user
MYSQL_PASSWORD=wp_pass
MARIADB_ADMIN_USER=admin_user
MARIADB_ADMIN_PASSWORD=admin_pass
DOMAIN_NAME=example.com
WP_ADMIN_USER=admin
WP_ADMIN_PASSWORD=admin_password
Adjust values to your environment before running make up or make all.
The compose file uses bind-mounted local volumes. By default the following host paths are referenced:
wordpress_data-> host:/home/jeandrad/data/wordpress(bind mounted)db_data-> host:/home/jeandrad/data/mariadb(bind mounted)portainer_data-> host:/home/jeandrad/data/portainer(bind mounted)
If you run this on another machine, either create these host directories with appropriate permissions or edit srcs/docker-compose.yml to point the volumes to locations that exist on your host.
Note: the ftp bonus service also mounts /home/jeandrad/data/wordpress directly to serve site files over FTP.
-
Core services:
nginx:443:443(HTTPS). Nginx serves the site and should be configured with certificates via the Nginx requirement folder.- MariaDB: not published to host (internal network only)
-
Bonus services (only when started via
make all/ profiles):ftp:21and passive range21100-21110adminer:8080portainer:9443redis:6379static-site
The compose file uses Docker Compose profiles for optional services. The Makefile's all target runs with --profile "*" to enable those services. If you use make up, only core services (no profiles) are started.
- Start core services:
docker compose --env-file .env -f srcs/docker-compose.yml up --build -d - Start core + bonus services:
docker compose --env-file .env -f srcs/docker-compose.yml --profile "*" up --build -d - Stop and remove (including volumes):
docker compose --env-file .env -f srcs/docker-compose.yml --profile "*" down --volumes - View logs:
docker compose --env-file .env -f srcs/docker-compose.yml logs -f
- Ensure the
.envfile is present and contains all variables referenced by the compose file before launching the stack. - Create the host directories used by bind mounts (
/home/jeandrad/data/...) and set correct permissions for your UID/GID. - When moving the project to another host, update the
devicepaths in thevolumessection ofsrcs/docker-compose.ymlor create matching directories. - Use
make logsto follow combined service logs and troubleshoot issues.
Last updated: 2025