Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum by elsikira.

Description

The Inception project is a systemic introduction to virtualization and containerization. The goal is to set up a small infrastructure composed of several services—NGINX, WordPress, and MariaDB—orchestrated via Docker Compose.

Every service runs in a dedicated container, ensuring a microservices architecture that is secure, portable, and easily reproducible. This project emphasizes manual configuration: all images are built from a debian:bookworm base without using pre-made images from Docker Hub.

Project Design & Sources

The project is structured into a srcs/ directory containing:

  • docker-compose.yml: The orchestrator linking services, networks, and volumes.
  • requirements/: Dedicated subdirectories for each service, containing their Dockerfile, configuration files, and entrypoint scripts.
  • .env: Centralized configuration for ports, credentials, and persistent paths.

Main Design Choices:

  • Dynamic Port Injection: Utilizing envsubst and sed, the stack injects ports at runtime. This allows the infrastructure to be remapped to any port (e.g., changing NGINX from 443 to 1234) via a single variable change in the .env file.
  • Security First: NGINX is configured with TLS 1.3. Services like MariaDB and WordPress are isolated within a private Docker network, unreachable from the host except through the NGINX gateway.
  • Persistence: Data is maintained through volume mapping to ensure that database entries and website files survive container restarts or removals.

Technical Comparisons

Topic Comparison
VM vs Docker VMs virtualize hardware (including an entire OS), making them heavy and slow. Docker virtualizes the OS kernel, allowing containers to share the host's resources, making them lightweight and fast.
Secrets vs Env Vars Environment Variables are stored in plain text and visible via docker inspect. Secrets (often used in Swarm or via specific secure mounts) are more secure as they are encrypted or kept in-memory.
Docker Network vs Host Network Host networking makes the container share the host's IP/ports directly (less secure). Docker networks create a private, isolated bridge where containers communicate only by service name.
Docker Volumes vs Bind Mounts Bind mounts point to a specific host path (linked to host file structure). Docker Volumes are managed by Docker itself, making them more portable and abstracted from the host's filesystem.

Instructions

  1. Setup: Ensure make and docker are installed on your host machine.
  2. Domain: Add 127.0.0.1 elsikira.42.fr to your /etc/hosts file.
  3. Execution: Run make from the root of the repository. This will:
    • Create the necessary data folders on your host.
    • Build the custom images.
    • Launch the containers in detached mode.
  4. Cleanup: Use make fclean to stop containers and delete all persistent data.

Resources

AI Usage: AI (Gemini) was used as a pedagogical collaborator for the following tasks:

  • Clarifying core Docker concepts and network isolation logic.
  • Developing the "Zero Hardcode" strategy for internal networking via dynamic environment variables.
  • Structuring and refining documentation to ensure compliance with project requirements.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages