Skip to content

Docker-based system architecture project focused on containerization and orchestration. Implements a multi-container setup using Docker and Docker Compose, ideal for understanding virtualization, networking, and service management in a scalable environment.

Notifications You must be signed in to change notification settings

pin3dev/42_Inception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Inception

🗣️ Introduction

The Inception project focuses on setting up a multi-container system using Docker and Docker Compose. The goal is to create a virtualized infrastructure, managing services like NGINX, WordPress, and MariaDB, while ensuring security and scalability. This project provides hands-on experience with containerization, orchestration, and networking.

🧬 Project Structure

The Inception project follows a modular architecture where each service runs inside its own container:

  • NGINX: Serves as a reverse proxy and handles SSL/TLS encryption.
  • WordPress: A PHP-based CMS running with php-fpm.
  • MariaDB: A MySQL-compatible database engine.
  • Docker Compose: Manages the orchestration of all containers.
  • Volumes: Persistent storage for WordPress and the database.

🫥 Cloning the Repository

To clone and set up the project, run the following commands:

git clone https://github.com/pin3dev/42_Inception.git
cd 42_Inception/root

This will download the project from GitHub into your local machine. Once inside the 42_Inception directory, you can run the project using the provided Makefile.

🕹️ Running the Project

Makefile

A Makefile is provided to simplify the running process. The Makefile includes the following rules:

  • build: Builds the Docker containers.
  • run: Starts the Docker containers in detached mode.
  • exec <docker name>: Opens an interactive shell inside a running container.
  • status: Displays logs of a specific container.
  • stop: Stops and removes all running containers.
  • iclean: Stops and removes containers along with all built images.
  • vclean: Removes containers, images, and volumes.
  • fclean: Performs a full cleanup, removing all unused containers, images, and volumes.
  • dls: Lists all Docker containers.
  • vls: Lists all Docker volumes.
  • ils: Lists all Docker images.
  • nls: Lists all Docker networks.

To build and run the containers, execute:

make

To stop and clean up the containers:

make fclean

Basic Tests

With the containers running you can run the tests below:

TLS/SSL:

openssl s_client -connect localhost:443
# Look in the output for the line with “Protocol” followed by the type of protocol used
# If you try any other port, the output should be an error

PORTS:
nginx connects to wordpress via port 9000

docker exec -it nginx nc -zv wordpress 9000
# [SUCCESS MESSAGE]: Connection to wordpress (xxx.x.x.x) 9000 port [tcp/*] succeeded!
# [ERROR MESSAGE]: OCI runtime exec failed: exec failed: unable to start container process: exec: "nc"...
# If the error occurs, it means netcat isn't installed in the Docker container. To resolve this, run:
docker exec -it nginx bash
apt-get update && apt-get install -y netcat
docker exec -it nginx nc -zv wordpress 9000
exit
# Now, try the initial command again:
docker exec -it nginx nc -zv wordpress 9000

wordpress connects to mariadb via port 3306

docker exec -it wordpress nc -zv mariadb 3306
# [SUCCESS MESSAGE]: Connection to mariadb (xxx.x.x.x) 3306 port [tcp/mysql] succeeded!
# [ERROR MESSAGE]: OCI runtime exec failed: exec failed: unable to start container process: exec: "nc"...
# If the error occurs, it means netcat isn't installed in the Docker container. To resolve this, run:
docker exec -it wordpress bash
apt-get update && apt-get install -y netcat
docker exec -it wordpress nc -zv mariadb 3306
exit
# Now, try the initial command again:
docker exec -it wordpress nc -zv mariadb 3306

MARIADB:

docker exec -it mariadb bash
mariadb
SHOW DATABASES;
USE <database_name>;
SHOW TABLES;
SELECT * FROM <table_name>;

⚠️ Norms and Guidelines

This project strictly follows the 42 School Norm coding guidelines, which significantly influenced certain decisions in its implementation. These rules may sometimes lead to seemingly inefficient or unusual solutions, but they were necessary to meet the strict requirements of the school.

📚 Theoretical Background

All the theoretical material used to develop this project is organized and can be accessed directly via the link below:

🔬 Tutorial

A step-by-step tutorial is available and can be followed to complete the project. It is linked in the button below.

About

Docker-based system architecture project focused on containerization and orchestration. Implements a multi-container setup using Docker and Docker Compose, ideal for understanding virtualization, networking, and service management in a scalable environment.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published