Skip to content

colincle/inception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inception

A small multi-container infrastructure built from scratch with Docker and docker compose. It runs a WordPress site behind NGINX with TLS, backed by a MariaDB database, each in its own container built from a hand-written Dockerfile (no prebuilt application images). Built as the 42 "Inception" project.

Architecture

Three services on a private Docker network:

  • nginx is the only entrypoint, exposed on port 443 with TLS. A self-signed certificate is generated at build time. It proxies PHP requests to WordPress.
  • wordpress runs WordPress on PHP-FPM. It reads its database credentials and authentication salts from the environment.
  • mariadb stores the WordPress data. An entrypoint script initialises the database and users on first start.

WordPress files and the database live on named volumes so data survives a restart.

client --443--> nginx --9000--> wordpress --3306--> mariadb

Requirements

Made and tested on Linux only. You need Docker and the docker compose plugin. The containers are built from debian:12 images.

Setup

  1. Generate src/.env with fresh WordPress salts:

    make salts

    This creates src/.env from the template on first run. Then open it and set the database name/user/password and the MariaDB root password. The domain is ccolin.42.fr.

  2. Point the domain at localhost so the browser reaches nginx. Add a line to /etc/hosts:

    127.0.0.1   ccolin.42.fr
    

The WordPress and database data are bind-mounted under ~/data, which make creates automatically.

Run

make          # build (if needed) and start the stack
make down     # stop the containers
make build    # rebuild the images from scratch
make clean    # stop, remove the volumes and the ~/data files (uses sudo)
make re       # full rebuild

Then open https://ccolin.42.fr in a browser. The certificate is self-signed, so you will get a one-time browser warning to accept.

License

MIT, see LICENSE.

About

A multi-container infrastructure (NGINX, WordPress, MariaDB) built from hand-written Dockerfiles with docker-compose and TLS.

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors