A Docker-based infrastructure project that sets up a complete web application stack using Docker Compose, featuring NGINX, WordPress, and MariaDB.
This project creates a fully containerized web infrastructure with three main services:
- NGINX as a reverse proxy and web server
- WordPress as the content management system
- MariaDB as the database backend
All services are orchestrated using Docker Compose with persistent data volumes and secure secret management.
- Acts as the reverse proxy and web server
- Handles HTTPS connections on port 443
- Serves WordPress content
- Custom configuration for optimal performance
- Content Management System running on PHP-FPM
- Exposed on port 9000 internally
- Connected to MariaDB database
- Persistent storage for themes, plugins, and media
- Database server for WordPress
- Exposed on port 3306
- Persistent data storage
- Secure credential management using Docker secrets
All services communicate through a custom bridge network named bkas_network, ensuring isolation and secure inter-container communication.
The project uses bind-mount volumes for data persistence:
- WordPress data:
~/data/wordpress - MariaDB data:
~/data/mariadb - NGINX data:
~/data/nginx
- Docker Engine
- Docker Compose
- Make
- Sufficient disk space for volumes
- Root/sudo access for volume cleanup operations
git clone <repository-url>
cd inceptionCreate a .env file in the srcs/ directory with the necessary environment variables for your services.
Populate the secret files in the secrets/ directory:
secrets/admin.txt- Admin credentialssecrets/database.txt- Database credentialssecrets/user.txt- User credentials
makeThis command will:
- Create the necessary data directories
- Build all Docker images
- Start all services in detached mode
make upmake downmake remake listmake logsmake cleanStops containers, removes unused volumes, and deletes WordPress and MariaDB data.
make full_cleanPerforms a complete cleanup including all Docker images, containers, volumes, and networks.
inception/
├── Makefile # Build and management commands
├── secrets/ # Secret files for credentials
│ ├── admin.txt
│ ├── database.txt
│ └── user.txt
└── srcs/
├── docker-compose.yml # Service orchestration
└── requirements/
├── mariadb/ # MariaDB container
│ ├── Dockerfile
│ ├── conf/
│ │ └── 50-server.cnf
│ └── tools/
│ └── docker-entrypoint.sh
├── nginx/ # NGINX container
│ ├── Dockerfile
│ ├── conf/
│ │ └── config.conf
│ └── tools/
│ └── docker-entrypoint.sh
└── wordpress/ # WordPress container
├── Dockerfile
├── conf/
│ └── www.conf
└── tools/
└── docker-entrypoint.sh
- Credentials are managed through Docker secrets
- Services communicate through an isolated network
- NGINX handles HTTPS connections
- Database is not directly exposed to the host network
- Separate configuration files for each service
All critical data is persisted using Docker volumes mapped to the host filesystem:
- WordPress files and uploads are preserved across container restarts
- Database data remains intact even when containers are removed
- Configuration changes are maintained
make listmake logsdocker logs <container-name>docker exec -it <container-name> /bin/shEnsure ports 443, 9000, and 3306 are not being used by other services.
Some cleanup operations require sudo access. Ensure you have the necessary permissions.
Verify that the data directories exist and have proper permissions.
To backup your data, copy the volume directories:
cp -r ~/data/wordpress ~/backup/wordpress
cp -r ~/data/mariadb ~/backup/mariadbTo update service images:
- Stop the services:
make down - Rebuild images:
make up
This project is part of the 42 curriculum.