Project to setup a stack with multiple services using Docker and Docker Compose. The stack is composed of Wordpress website (with 2 users), NodeJS static website, MariaDB database, Redis cache for Wordpress, Adminer database manager, Grafana monitoring tool, FTP Server (with 1 user) and Nginx webserver with TLS (v1.2 and v1.3).
The services are deployed in containers and the data are stored in volumes. The services are linked inside a Docker Network. The stack was tested in a Linux machine.
-
Nginx + TLS
-
MariaDB
-
Wordpress + PHP
-
Redis
-
Adminer
-
FTP Server - ProFTPd
-
Grafana (without provisioning)
-
Static Website - NodeJS + Express
---
config:
curve: basis
htmlLabels: true
---
flowchart
direction TB
classDef black fill:#000,stroke:#333,stroke-width:1px;
classDef white fill:#fff,color:#555,stroke:#333,stroke-width:1px;
classDef white_border fill:#fff,color:#000,stroke:#333,stroke-width:1px, stroke-dasharray: 5, 5;
classDef green fill:#0f0,color:#555,stroke:#333,stroke-width:1px;
classDef lightblue fill:#99f,color:#fff,stroke:#333,stroke-width:1px;
classDef lightgreen fill:#9f9,color:#555,stroke:#333,stroke-width:1px;
classDef lightred fill:#f99,color:#555,stroke:#333,stroke-width:1px;
classDef lightyellow fill:#ff9,color:#555,stroke:#333,stroke-width:1px;
classDef lightorange fill:#f90,color:#555,stroke:#333,stroke-width:1px;
classDef lightpurple fill:#f0f,color:#555,stroke:#333,stroke-width:1px;
classDef lightcyan fill:#9ff,color:#555,stroke:#333,stroke-width:1px;
classDef lightpink fill:#f9f,color:#555,stroke:#333,stroke-width:1px;
classDef lightbrown fill:#963,color:#555,stroke:#333,stroke-width:1px;
classDef lightgrey fill:#999,color:#555,stroke:#333,stroke-width:1px;
classDef lightblack fill:#000,stroke:#333,stroke-width:1px;
classDef lightwhite fill:#fff,color:#555,stroke:#333,stroke-width:1px;
Project:::white_border
subgraph Project
direction TB
WorldWideWeb <-->|"`*443*`"| Nginx
WorldWideWeb((fa:fa-globe World Wide<br>Web)):::lightgreen
WorldWideWeb <-->|"`*7500*`"| Static_Website
WorldWideWeb <-->|"`*20-21*
60000-60010`"| FTP_Server
WorldWideWeb <-->|"`*7000*`"| Adminer
WorldWideWeb <-->|"`*3000*`"| Grafana
subgraph Computer_Host["fas:fa-computer Computer Host"]
Docker_Network:::lightblue
subgraph Docker_Network["fas:fa-network-wired Docker Network"]
subgraph Wordpress_Stack
MariaDB("fa:fa-database MariaDB<br>Container")
Wordpress("fab:fa-wordpress Wordpress + PHP<br>Container")
Nginx("fa:fa-server Nginx + TLS<br>Container")
MariaDB <-->|"`*3306*`"| Wordpress <-->|"`*9000*`"| Nginx
end
Static_Website("fab:fa-js Static Website<br>NodeJS + Express<br>Container")
FTP_Server("fa:fa-server FTP Server<br>ProFTPd<br>Container")
Adminer("fa:fa-database Adminer<br>Container")
Adminer <-->|"`*3306*`"| MariaDB
Redis("fa:fa-database Redis<br>Container")
Wordpress <-->|"`*6379*`"| Redis
Grafana("fa:fa-chart-line Grafana<br>Container")
Grafana <-->|"`*3306*`"| MariaDB
end
Volume_MariaDB[("fas:fa-hdd MariaDB<br>Volume<br><br>/home/login/data/...")]:::lightorange
Volume_Wordpress[("fas:fa-hdd Wordpress<br>Volume<br><br>/home/login/data/...")]:::lightorange
Volume_Grafana[("fas:fa-hdd Grafana<br>Volume<br><br>/home/login/data/...")]:::lightorange
MariaDB <-.-> Volume_MariaDB
FTP_Server <-.-> Volume_Wordpress
Wordpress <-.-> Volume_Wordpress
Nginx <-.-> Volume_Wordpress
Grafana <-.-> Volume_Grafana
end
end
linkStyle 0,1,2,3,4 stroke:lightgreen,stroke-width:4px;
linkStyle 5,6,7,8,9 stroke:lightblue,stroke-width:2px;
# Show the help
make helpDocker and Docker compose must be installed.
# Clone the repository
git clone git@github.com:Tablerase/42_Inception.git# Change directory to the project
cd 42_Inception# Change the LOGIN variable in the Makefile file
sed -i 's/rcutte/<your_login>/g' Makefile # Create the .env file from the .env.template file and create the secrets files from the secrets template files
make template
# Fill the .env file with your credentials
# Fill the secrets files with your credentials# Add the domain name to the /etc/hosts file
make add_urlEdit the configuration files if needed via the config directory or the setup scripts of the services. For major changes, you can modify the docker-compose.yml file.
# Compose the stack (containers, images, volumes, networks)
make up# Decompose the stack (containers, images, volumes, networks)
make clean# Delete the containers
make down# Stop the containers
make stop# Start the containers
make start# Show the logs of the stack
make logs# Show the status of the stack
make infos# Access to the <service> container shell (bash) / use TAB to auto-complete after shell_
make shell_<service>Website to access the services:
-
Static Website - NodeJS + Express - http://localhost:7500
Url to access the services:
-
Wordpress - https://localhost:443
-
Adminer - https://localhost:7000
-
FTP Server - ProFTPd - ftp://localhost:20
-
Grafana - http://localhost:3000
-
Static Website - NodeJS + Express - http://localhost:7500