Skip to content

Developer Documentation (DEV_DOC)

1. Environment Setup

Prerequisites

  • Linux OS (Debian/Ubuntu/Alpine)
  • Docker & Docker Compose Plugin
  • Make
  • Git

Configuration

  1. Clone Repo: git clone ...
  2. Environment Variables: Copy srcs/.env.example (if exists) or create srcs/.env. Required variables include DOMAIN_NAME, MYSQL_ROOT_PASSWORD, MYSQL_USER, MYSQL_PASSWORD, WP_ADMIN_PASSWORD, etc.
  3. Data Directories: The Makefile automatically creates data directories at:
    • /home/${USER}/data/wordpress
    • /home/${USER}/data/mariadb

2. Build and Launch

The project uses a Makefile to simplify Docker Compose commands.

  • Build & Run:

    bash
    make all    # or just 'make'

    This runs docker compose -f srcs/docker-compose.yml up -d --build.

  • Rebuild specific service:

    bash
    docker compose -f srcs/docker-compose.yml up -d --build <service_name>

    Example: docker compose ... --build nginx

3. Container Management

  • List Containers: docker ps
  • View Logs:
    bash
    docker logs <container_name>
    # Follow logs
    docker logs -f nginx
  • Enter Container Shell:
    bash
    docker exec -it <container_name> /bin/bash
    # For Alpine containers (website) use /bin/sh
    docker exec -it website /bin/sh

4. Data Persistence

Data is persisted using Docker Bind Mounts to the host machine. This ensures data survives container removal (make down).

  • Database:

    • Container Path: /var/lib/mysql
    • Host Path: /home/${USER}/data/mariadb
  • WordPress Files:

    • Container Path: /var/www/html
    • Host Path: /home/${USER}/data/wordpress

To completely reset data (Simulate fresh install):

bash
make fclean

Warning: This deletes the data directories /home/${USER}/data/*.

Released under the MIT License.