├── .img_readme ├── DGRB.png ├── adminer_sql.png ├── login_Adminer1.png ├── login_Adminer2.png ├── nginx_php_fpm.png ├── ssl1.png ├── ssl2.png └── web-nginx-php.png ├── Makefile ├── README.md ├── init_domain.sh └── srcs ├── .env ├── docker-compose.yml └── requirements ├── adminer ├── Dockerfile └── conf │ └── 000-default.conf ├── ftp ├── Dockerfile ├── conf │ └── vsftpd.conf └── tools │ └── script.sh ├── mariadb ├── Dockerfile ├── conf │ └── 50-server.cnf └── tools │ └── script.sh ├── minecraft ├── Dockerfile └── config │ ├── eula.txt │ └── server.jar ├── nginx ├── Dockerfile └── conf │ ├── adminer.conf │ ├── default │ ├── minecraft.conf │ ├── ssl-params.conf │ └── subdomain.conf ├── redis ├── Dockerfile └── conf │ └── redis.conf ├── static-web ├── Dockerfile ├── conf │ ├── web-404 │ │ └── 404.html │ ├── web-500 │ │ └── 505.html │ └── web-subdomain │ │ ├── .DS_Store │ │ ├── home.css │ │ ├── index.html │ │ ├── package.json │ │ ├── public │ │ ├── .DS_Store │ │ └── playground_assets │ │ │ └── hero-divider-600h.png │ │ └── style.css └── tools │ └── script.sh └── wordpress ├── Dockerfile ├── conf └── www.conf └── tools └── install.sh /.img_readme/DGRB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/DGRB.png -------------------------------------------------------------------------------- /.img_readme/adminer_sql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/adminer_sql.png -------------------------------------------------------------------------------- /.img_readme/login_Adminer1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/login_Adminer1.png -------------------------------------------------------------------------------- /.img_readme/login_Adminer2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/login_Adminer2.png -------------------------------------------------------------------------------- /.img_readme/nginx_php_fpm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/nginx_php_fpm.png -------------------------------------------------------------------------------- /.img_readme/ssl1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/ssl1.png -------------------------------------------------------------------------------- /.img_readme/ssl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/ssl2.png -------------------------------------------------------------------------------- /.img_readme/web-nginx-php.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/.img_readme/web-nginx-php.png -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: 3 | @sudo mkdir -p /home/tliot/data/db /home/tliot/data/wordpress /home/tliot/data/minecraft-server /home/tliot/data/portainer 4 | @docker-compose -f ./srcs/docker-compose.yml up --build -d 5 | 6 | install : 7 | @sudo apt-get update 8 | @sudo apt-get upgrade -y 9 | @sudo apt-get install -y curl gnupg ca-certificates lsb-release docker.io docker docker-compose 10 | @sudo mkdir -p /home/tliot/data/db /home/tliot/data/wordpress /home/tliot/data/minecraft-server /home/tliot/data/portainer 11 | @sudo ./init_domain.sh 12 | 13 | restart : 14 | @docker-compose -f ./srcs/docker-compose.yml stop 15 | @docker-compose -f ./srcs/docker-compose.yml start 16 | 17 | down: 18 | @docker-compose -f ./srcs/docker-compose.yml down 19 | 20 | clean: 21 | @docker rm -f $$(docker ps -qa) 22 | @docker volume rm -f $$(docker volume ls) 23 | @sudo rm -rf /home/tliot 24 | 25 | .PHONY: all clean fclean re 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inception 2 | 3 | This project aims to deepen the knowledge of system administration. 4 | 5 | Use of dockerfile for the creation and management of custom images, micro services. 6 | 7 | Use of docker-compose for the deployment of containers, the creation and management of the network, storage space, etc ... 8 | 9 | ## Table of contents 10 | 11 | - #### [DOCKER](#docker-1) 12 | - #### [STARTER PACK MARIADB - ADMINER ](#starter-pack--mariadb---adminer-) 13 | - #### [PHP-FPM & NGNIX](#php-fpm--ngnix-1) 14 | - #### [LOCAL DOMAINS IN LINUX](#local-domains-in-linux-2) 15 | - #### [SETUP A SELF-SIGNED SSL CERTIFICATE](#setup-a-self-signed-ssl-certificate-1) 16 | 17 | # Local Domains in Linux 18 | 19 | ## Structure of the project with the bonuses 20 | 21 | 22 | 23 | # DOCKER 24 | 25 | ## BASIC DOCKER COMMANDS 26 | 27 | * ```docker ps -a``` : List active containers (-a is for showing all containers, running and stopped) 28 | * ```docker stop /``` : Stop running containers 29 | * ```docker start /``` : Start stopped containers 30 | * ```docker rm -f /``` : Remove containers (-f is for force the removal of a running container) 31 | * ```docker exec -it bash``` : Execute a command in a running container 32 | 33 | 34 | Tips to delete all containers, use: ```docker rm -f $(docker ps -qa)``` 35 | 36 | ## DOCKER RUN 37 | 38 | ``` bash 39 | $ docker run [OPTIONS] IMAGE[:TAG] 40 | ``` 41 | 42 | | Parameters | Description | 43 | | :-------- | :-------------------------------- | 44 | | `-d` | Run container in background (daemon mode) | 45 | | `-it` | creating an interactive container | 46 | | `-p` | Publish a container port(s) to the host | 47 | | `--rm` | Automatically remove the container when it exits | 48 | | `--hostname` | Container host name | 49 | | `--name` | Assign a name to the container | 50 | 51 | #### Exemple 52 | ``` 53 | $ docker run -d -ti -p 80:80 --rm --name web-ngnix --hostname nginx-container nginx:latest 54 | ``` 55 | use ```docker ps``` to list running containers 56 | ``` bash 57 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 58 | 86335dfeaa0b nginx:latest "/docker-entrypoint.…" 7 seconds ago Up 6 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp web-ngnix 59 | ``` 60 | 61 | We can see that the container is running in daemon mode. 62 | That the exposure of the ports is well done and that the name of the container is the one that we specified in parameter 63 | 64 | ``` bash 65 | $ docker exec -it web-ngnix bash 66 | ``` 67 | The docker exec command runs a new command in a running container. 68 | 69 | ``` bash 70 | $ root@nginx-container:/# 71 | ``` 72 | 73 | We can now see that the name specified in ```--hostname``` is applied 74 | 75 | 76 | ## DOCKER VOLUMES 77 | 78 | #### The advantages of volumes : 79 | * Easy to persist data. 80 | * Convenient for making backups 81 | * Share data between multiple containers 82 | * Multi-containers and permissions 83 | 84 | 85 | #### Basic command for managed volumes : 86 | 87 | * ```docker volume ls``` : list volumes 88 | 89 | * ```docker volume create ``` : creating a new volume 90 | 91 | * ```docker volume rm ``` : delete a volume 92 | 93 | * ```docker volume inspect ``` : inspection of a volume 94 | 95 | #### The different types of volumes : 96 | * Bind Mount : ```Bind mounts are dependent on the directory structure and OS of the host machine``` 97 | * Volumes Docker : ```volumes are completely managed by Docker``` 98 | * TMPFS : ```As opposed to volumes and bind mounts, a tmpfs mount is temporary, and only persisted in the host memory. When the container stops, the tmpfs mount is removed, and files written there won’t be persisted.``` 99 | 100 | ## DOCKER RUN WITH VOLUMES 101 | 102 | #### 1. Bind Mount : 103 | 104 | ```sudo mkdir /data``` (creation of mount folder is necessary otherwise error will appear when using docker run) 105 | 106 | ```docker run -d --name TestBindMount --mount type=bind,source=/data/,target=/usr/share/nginx/html -p 80:80 nginx:latest``` 107 | 108 | ```docker exec -ti TestBindMount bash``` 109 | 110 | #### 2. Volumes Docker : 111 | 112 | ```docker volume create mynginx``` (optional because if the volume is not created, docker will do it) 113 | 114 | ```docker run -d --name TestVolume --mount type=volume,src=mynginx,destination=/usr/share/nginx/html -p 81:80 nginx:latest``` 115 | 116 | ```docker exec -ti TestVolume bash``` 117 | 118 | #### 3. Tmpfs: 119 | 120 | ```docker run -d --name TestTmpfs --mount type=tmpfs,destination=/usr/share/nginx/html -p 82:80 nginx:latest``` 121 | 122 | ```docker exec -ti TestTmpfs bash``` 123 | 124 | #### To check data persistence you can delete all containers and recreate them !! (do not recreate the volumes) 125 | 126 | ``` bash 127 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 128 | f0096643b045 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:82->80/tcp, :::82->80/tcp TestTmpfs 129 | 92260c1f5880 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:81->80/tcp, :::81->80/tcp TestVolume 130 | dcad272f7531 nginx:latest "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp TestBindMount 131 | ``` 132 | 133 | In each container modify/create the /usr/share/nginx/html/index.html, Remove containers and recreate. 134 | Now check if the changes have been saved. 135 | 136 | If you are running docker on your OS. 137 | You can admire the changes from your websites. 138 | 139 | * TestBindMount : http://localhost:80 140 | * TestVolume : http://localhost:81 141 | * TestTmpfs : http://localhost:82 142 | 143 | ## ENVIRONEMENT VARIABLE (ENV, ENVFILE...) 144 | 145 | ``` bash 146 | $ docker run -tid --name testenv --env MYVAR="123" debian:latest 147 | ``` 148 | Add to the docker environment the variable MYVAR=123 149 | ``` bash 150 | $ docker exec -ti testenv bash 151 | ``` 152 | Look in the container for the environment variables with the "env" command. 153 | ``` 154 | root@cb9e44034297:/# env 155 | HOSTNAME=cb9e44034297 156 | MYVAR=123 157 | PWD=/ 158 | HOME=/root 159 | TERM=xterm 160 | SHLVL=1 161 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 162 | _=/usr/bin/env 163 | ``` 164 | 165 | This method works but is not secure for example for passwords. 166 | To do this we will be able to add an env file ".ENV" 167 | 168 | To do this, we will create a ".ENV" file in which we will put our environment variables. 169 | "```vim .ENV```" 170 | 171 | ``` 172 | MYPASSWORD="safepassword" 173 | MYUSER="secretuser" 174 | MYDB="BDD1" 175 | ``` 176 | ``` 177 | $ docker run -tid --name testenv --env-file .ENV debian:latest 178 | $ docker exec -ti testenv bash 179 | ``` 180 | Look in the container for the environment variables with the "env" command. 181 | 182 | 183 | ``` 184 | root@553c2ac8a657:/# env 185 | HOSTNAME=553c2ac8a657 186 | PWD=/ 187 | HOME=/root 188 | MYPASSWORD="safepassword" 189 | TERM=xterm 190 | SHLVL=1 191 | MYUSER="secretuser" 192 | MYDB="BDD1" 193 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 194 | _=/usr/bin/env 195 | ``` 196 | 197 | ## DOCKER NETWORK 198 | 199 | - Communication between containers or outside 200 | - Different types : bridge, host, none, overlay 201 | - Be careful, a container does not have a fixed IP address (stop / start) 202 | 203 | 204 | #### Basic command for managed network : 205 | 206 | * ```docker network ls``` : List networks 207 | 208 | * ```docker network create ``` : Create a network 209 | 210 | * ```docker network rm ``` : Remove one or more networks 211 | 212 | * ```docker network inspect ``` : Display detailed information on one or more networks 213 | 214 | 215 | #### IPs are not static 216 | 217 | In general, IPs in a network are not static. 218 | 219 | The addressing of the Ips depends on the starting order of the containers. 220 | 221 | #### Exemple 222 | 223 | Create bridge network with name, mynetwork : 224 | ``` bash 225 | $ docker network create --driver=bridge mynetwork 226 | ``` 227 | Start two container connect to network "mynetwork" 228 | ``` bash 229 | $ docker run -d --name c1 --network mynetwork nginx:latest 230 | $ docker run -d --name c2 --network mynetwork nginx:latest 231 | ``` 232 | Container 1 will have as ip address : 172.26.0.2 233 | ``` 234 | $ docker inspect c1 --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 235 | 172.26.0.2 236 | ``` 237 | Container 2 will have as ip address : 172.26.0.3 238 | ``` 239 | $ docker inspect c2 --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 240 | 172.26.0.3 241 | ``` 242 | We will now reverse the boot order 243 | ``` 244 | sudo docker stop c1 245 | sudo docker stop c2 246 | ### reverse containers start order ### 247 | sudo docker start c2 248 | sudo docker start c1 249 | ``` 250 | We can see that the ip addresses are no longer the same 251 | ``` 252 | docker inspect c1 --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 253 | 172.26.0.3 254 | ``` 255 | 256 | ``` 257 | docker inspect c2 --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 258 | 172.26.0.2 259 | ``` 260 | ### If the ips change, how do the containers communicate ? 261 | 262 | The containers will have to communicate with their name which redirects to the ip. 263 | 264 | ``` 265 | sudo docker exec -ti c1 bash 266 | root@54bb6caca8fb:/# apt update && apt install iputils-ping -y 267 | ### ping install ### 268 | root@54bb6caca8fb:/# ping c2 269 | PING c2 (172.26.0.2) 56(84) bytes of data. 270 | 64 bytes from c2.mynetwork (172.26.0.2): icmp_seq=1 ttl=64 time=0.099 ms 271 | 64 bytes from c2.mynetwork (172.26.0.2): icmp_seq=2 ttl=64 time=0.204 ms 272 | ``` 273 | 274 | It will therefore be necessary to use the name of the containers, 275 | in our different configurations, applications, programs to communicate. 276 | Container names are used as domain names. 277 | 278 | ## DOCKERFILE 279 | 280 | Dockerfile is a configuration file for the purpose of creating an image 281 | 282 | #### Dockerfile benefit 283 | * Restart an image creation at any time 284 | * Better configuration visibility 285 | * Dockerfile editing script 286 | * Image creation, production or development 287 | 288 | 289 | ### Instructions Dockerfile 290 | 291 | | □| Instructions | Description | 292 | | :-| :------------------- | :-------------| 293 | | 1 | FROM | New build stage and sets the Base Image for subsequent instructions.| 294 | | 2 | MAINTAINER | author | 295 | | 3 | ARG | Defines a variable that users can pass when building the image | 296 | | 4 | ENV | Environment variable | 297 | | 4 | LABEL | Adding metadata | 298 | | 5 | VOLUME | Create a mount point | 299 | | 6 | RUN | Execute a command when creating the image | 300 | | 6 | COPY // ADD | Add a file and directory in the image | 301 | | 6 | WORKDIR | Allows you to change the current path | 302 | | 7 | EXPOSE | Port listened by the container (metadata) | 303 | | 9 | CMD // ENTRYPOINT | Execute a command when the container starts | 304 | 305 | 306 | 307 | ## BUILD A IMAGE 308 | #### We will now create a mariadb image 309 | 310 | Here are the different files we need to build the image 311 | 312 | ```bash 313 | $ tree 314 | . 315 | ├── 50-server.cnf # Mariadb configuration file 316 | ├── Dockerfile # The dockerfile to build the image 317 | └── script.sh # Database configuration script 318 | ``` 319 | 320 | 321 | ```Dockerfile``` 322 | ``` .Dockerfile 323 | # SPECIFIES DISTRIBUTION 324 | FROM debian:buster 325 | 326 | # UPDATE AND INSTALLATION 327 | RUN apt-get update 328 | RUN apt install -y mariadb-server 329 | 330 | # COPY THE CONF FOR THE BIND AND THE SQL SCRIPT FOR THE PRIVILEGE 331 | COPY 50-server.cnf /etc/mysql/mariadb.conf.d/ 332 | 333 | # COPY THE SCRIPT IN THE IMAGES AND MODIFY THE EXECUTION RIGHTS OF IT 334 | COPY script.sh / 335 | RUN chmod +x /script.sh 336 | 337 | ENTRYPOINT [ "/script.sh" ] 338 | ``` 339 | By default, the server does not accept external connections, or rather, it only accepts local connections (from the LoopBack address: localhost = 127.0.0.1). 340 | We need change that ! 341 | 342 | ```50-server.cnf``` 343 | ``` .cnf 344 | [server] 345 | 346 | [mysqld] 347 | 348 | user = mysql 349 | pid-file = /run/mysqld/mysqld.pid 350 | socket = /run/mysqld/mysqld.sock 351 | port = 3306 352 | basedir = /usr 353 | datadir = /var/lib/mysql 354 | tmpdir = /tmp 355 | lc-messages-dir = /usr/share/mysql 356 | lc-messages = en_US 357 | skip-external-locking 358 | 359 | # bind-address = 127.0.0.1 # You need to change this line to allow external connections 360 | bind-address = 0.0.0.0 # Now it's better :-) 361 | 362 | expire_logs_days = 10 363 | character-set-server = utf8mb4 364 | collation-server = utf8mb4_general_ci 365 | 366 | [embedded] 367 | 368 | [mariadb] 369 | 370 | [mariadb-10.5] 371 | ``` 372 | 373 | 374 | Script.sh will be executed at entrypoint at runtime. 375 | this allow us to initialize the environment variables with an ```.env```file 376 | 377 | ```script.sh``` 378 | 379 | ``` .sh 380 | #!/bin/sh 381 | service mysql start 382 | 383 | # CREATE USER # 384 | echo "CREATE USER '$BDD_USER'@'%' IDENTIFIED BY '$BDD_USER_PASSWORD';" | mysql 385 | 386 | # PRIVILGES FOR ROOT AND USER FOR ALL IP ADRESS # 387 | echo "GRANT ALL PRIVILEGES ON *.* TO '$BDD_USER'@'%' IDENTIFIED BY '$BDD_USER_PASSWORD';" | mysql 388 | echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$BDD_ROOT_PASSWORD';" | mysql 389 | echo "FLUSH PRIVILEGES;" | mysql 390 | 391 | # CREAT WORDPRESS DATABASE # 392 | echo "CREATE DATABASE $BDD_NAME;" | mysql 393 | 394 | kill $(cat /var/run/mysqld/mysqld.pid) 395 | 396 | mysqld 397 | ``` 398 | ## DOCKER BUILD : 399 | ``` 400 | $ docker build -t my-mariadb . 401 | ...... 402 | ...... 403 | Successfully built 6ad0c955aa67 404 | Successfully tagged my-mariadb:latest 👍 405 | ``` 406 | 407 | For this example, we'll change to ``\home`` and run `my-mariadb` image with an environment file. 408 | 409 | 410 | ``` bash 411 | $ cd /home 412 | ``` 413 | 414 | Create .env file in which `username`, `user`, `password`, `database name`, `root password`. 415 | 416 | This information will be embedded in the container at runtime. 417 | ``` 418 | $ vim .env 419 | BDD_USER=user 420 | BDD_USER_PASSWORD=safepwd 421 | BDD_NAME=wordpress 422 | BDD_ROOT_PASSWORD=safepwdroot 423 | ``` 424 | To run the image you will need a specific env file and image name 425 | ``` 426 | $ docker run -tid --name testmariadb --env-file .env my-mariadb 427 | ``` 428 | The container is well executed, we can check with a `docker ps` 429 | ``` 430 | $ docker ps 431 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 432 | 34e058b2f18f my-mariadb "/script.sh" 22 seconds ago Up 22 seconds testmariadb 433 | ``` 434 | Enter the container to check if our variables have integrated 435 | ``` 436 | $ docker exec -ti testmariadb bash 437 | root@34e058b2f18f:/# 438 | ``` 439 | Everything is good 🤩 440 | ``` 441 | root@34e058b2f18f:/# env 442 | HOSTNAME=34e058b2f18f 443 | PWD=/ 444 | BDD_NAME=wordpress 445 | HOME=/root 446 | BDD_USER_PASSWORD=safepwd 447 | TERM=xterm 448 | SHLVL=1 449 | BDD_ROOT_PASSWORD=safepwdroot 450 | BDD_USER=user 451 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 452 | _=/usr/bin/env 453 | ``` 454 | Check if the conf file has been copied 455 | ``` .cnf 456 | root@34e058b2f18f:/# cat /etc/mysql/mariadb.conf.d/50-server.cnf 457 | 458 | [server] 459 | 460 | [mysqld] 461 | 462 | user = mysql 463 | pid-file = /run/mysqld/mysqld.pid 464 | socket = /run/mysqld/mysqld.sock 465 | port = 3306 466 | basedir = /usr 467 | datadir = /var/lib/mysql 468 | tmpdir = /tmp 469 | lc-messages-dir = /usr/share/mysql 470 | lc-messages = en_US 471 | skip-external-locking 472 | 473 | bind-address = 0.0.0.0 474 | 475 | expire_logs_days = 10 476 | character-set-server = utf8mb4 477 | collation-server = utf8mb4_general_ci 478 | 479 | [embedded] 480 | 481 | [mariadb] 482 | ``` 483 | Let's start mysql to check users and database 484 | ``` 485 | root@34e058b2f18f:/# mysql 486 | Welcome to the MariaDB monitor. Commands end with ; or \g. 487 | Your MariaDB connection id is 8 488 | Server version: 10.3.38-MariaDB-0+deb10u1 Debian 10 489 | 490 | Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 491 | 492 | Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 493 | ``` 494 | Check if our user and root is enabled for any host 495 | ``` sql 496 | MariaDB [(none)]> SELECT user,host,password FROM mysql.user; 497 | +------+-----------+-------------------------------------------+ 498 | | user | host | password | 499 | +------+-----------+-------------------------------------------+ 500 | | root | localhost | | 501 | | user | % | *1C848575FF465642717BE88F2015E168769A62F3 | 502 | | root | % | *FDB22E6F75BD75009DEE947AFD0BD73CB7EB88DA | 503 | +------+-----------+-------------------------------------------+ 504 | 3 rows in set (0.005 sec) 505 | ``` 506 | Check if the "wordpress" database has been created 507 | ``` sql 508 | MariaDB [(none)]> SHOW databases; 509 | +--------------------+ 510 | | Database | 511 | +--------------------+ 512 | | information_schema | 513 | | mysql | 514 | | performance_schema | 515 | | wordpress | 516 | +--------------------+ 517 | 4 rows in set (0.005 sec) 518 | ``` 519 | 520 | 521 | 522 | 523 | # Starter Pack [ MariaDB - Adminer ] 524 | 525 | 526 | 527 | In the previous part we saw how to write a dockerfile and build the image using `docker build` 528 | 529 | In this part we will see how to use `docker compose` and write a `docker-compose.yml` 530 | 531 | But first, we will see the configuration and the creation of the dockerfile for Adminer. 532 | 533 | Adminer is a tool for managing content in databases. It natively supports MySQL, MariaDB, PostgreSQL, SQLite, 534 | 535 | Once installed, we will be able to connect to our database from the Web Adminer interface 😎 536 | 537 | ```Dockerfile``` (Adminer) 538 | 539 | ``` .Dockerfile 540 | # SPECIFIES DISTRIBUTION 541 | FROM debian:buster 542 | 543 | # UPDATE AND INSTALLATION 544 | RUN apt-get update 545 | RUN apt install -y adminer 546 | 547 | # COPY THE CONF FILE 548 | COPY 000-default.conf /etc/apache2/sites-available/ 549 | RUN echo 'ServerName adminer' >> /etc/apache2/apache2.conf 550 | 551 | # START AND CONF 552 | RUN service apache2 start && a2enconf adminer.conf 553 | 554 | ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] 555 | ``` 556 | 557 | ```000-default.conf``` (Adminer) 558 | ``` .conf 559 | 560 | DocumentRoot /etc/adminer 561 | Alias /adminer /etc/adminer 562 | 563 | 564 | Require all granted 565 | DirectoryIndex conf.php 566 | 567 | 568 | ErrorLog ${APACHE_LOG_DIR}/error.log 569 | CustomLog ${APACHE_LOG_DIR}/access.log combined 570 | 571 | ``` 572 | 573 | ## DOCKER-COMPOSE 574 | 575 | #### What is Docker Compose? 576 | Docker Compose is a tool that was developed to help define and share multi-container applications. 577 | 578 | With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down. 579 | ### BASIC DOCKER COMMANDS 580 | 581 | * ```docker-compose build``` : To build the images 582 | * ```docker-compose up -d``` : To run containers in daemon mode 583 | * ```docker-compose up --build -d``` : To build images and run containers in daemon mode {my favorite :-)} 584 | * ```docker-compose start/stop``` : To start and stop services 585 | * ```docker-compose down``` : To stop and delete containers 586 | 587 | 588 | It is important that the project structure is consistent with the dockerfiles and docker-compose.yml 589 | 590 | ``` bash 591 | $ tree 592 | . 593 | ├── adminer_directory 594 | │ ├── 000-default.conf 595 | │ └── Dockerfile 596 | ├── docker-compose.yml 597 | ├── .env # same .env as before 598 | ├── mariadb_directory 599 | │ ├── 50-server.cnf # Same file seen above 600 | │ ├── Dockerfile # Same file seen above 601 | │ └── script.sh # Same file seen above 602 | └── my_volume. # Persistent volume 603 | ``` 604 | 605 | ```docker-compose.yml``` 606 | 607 | ``` .yml 608 | version: '3.5' 609 | services: 610 | adminer: 611 | container_name: Adminer # Name redirect to IP -> 172.X.X.Z 612 | build: adminer_directory/. # Build the dockerfile in ./adminer_directory/Dockerfile 613 | restart: always # Restart the container if it has stopped 614 | ports: 615 | - "80:80" # Redirect port 80 of Adminer on the host 616 | networks: 617 | - mynetwork # Use mynetwork for communicate with mariadb 618 | 619 | mariadb: 620 | container_name: Mariadb 621 | build: mariadb_directory/. 622 | restart: always 623 | networks: 624 | - mynetwork 625 | volumes: 626 | - db:/var/lib/mysql 627 | env_file: .env 628 | 629 | # NETWORK 630 | networks: 631 | mynetwork: 632 | name : mynetwork 633 | driver : bridge # Remember the different types of Networks, I showed you before ??? 634 | 635 | # VOLUME 636 | volumes: 637 | db: 638 | driver: local 639 | driver_opts: # Options specific to the driver 640 | type: 'none' 641 | o: 'bind' 642 | device: ./my_volume # Persistent volume 643 | ``` 644 | The docker-compose.yml is edited. 645 | 646 | The various essential elements of the infrastructure being positioned in the right place. 647 | 648 | We will be able to launch our infrastructure using the command : `docker-compose up --build -d` . 649 | 650 | This will build and then launch the images. 651 | ``` .sh 652 | $ docker-compose up --build -d 653 | .... 654 | .... 655 | Creating Mariadb ... done 656 | Creating Adminer ... done 657 | ``` 658 | 659 | ``` .sh 660 | $ docker ps 661 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 662 | 5b1e14853a6e mdb-adm_adminer "/usr/sbin/apache2ct…" 1 minutes ago Up 1 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp Adminer 663 | 4cb7c3cb88f8 mdb-adm_mariadb "/script.sh" 1 minutes ago Up 1 minutes Mariadb 664 | ``` 665 | 666 | The launch of our containers went well. 667 | 668 | We will be able to connect to our database through the Adminer web interface using the host address. 669 | 670 | For my part, the address of my host is `192.168.64.13`, because i work remotely on a vm. 671 | 672 | Most likely your host address is `localhost` or `127.0.0.1`. 673 | 674 | Adminer will ask us for the connection information. 675 | 676 | This information corresponds to the information present in the ".env" file 677 | 678 | The server address to enter is `Mariadb` 679 | 680 | ``` 681 | USERNAME = user 682 | PASSWORD = safepwd 683 | DATABASE = wordpress 684 | ``` 685 | 686 | 687 | 688 | Great the connection works 👍🏼 689 | 690 | 691 | 692 | You can also log in as root. You just have to put in "root" in user and the password present in the env file. 693 | 694 | 695 | # PHP-FPM & NGNIX 696 | 697 | 698 | 699 | 700 | In this part we will create a simple infrastructure allowing to separate nginx and php. 701 | 702 | We will then use this same infrastructure to implement the SSL certificate and communicate only on port 443 to connect to our web server. 703 | 704 | ``` bash 705 | $ tree 706 | . 707 | ├── docker-compose.yml 708 | ├── nginx 709 | │ ├── conf 710 | │ │ └── default 711 | │ └── Dockerfile 712 | └── wordpress 713 | ├── conf 714 | │ ├── index.php 715 | │ └── www.conf 716 | └── Dockerfile 717 | ``` 718 | 719 | 720 | To work, nginx and php need to have access to the same file. 721 | 722 | This is why our "wordress" volume is common to both containers. 723 | 724 | Both will share the folder ```/var/www/html``` 725 | 726 | ``` docker-compose.yml``` 727 | 728 | ``` .yml 729 | version: '3.5' 730 | services: 731 | ngnix: 732 | container_name: ngnix 733 | build: ./nginx/ 734 | restart: always 735 | volumes: 736 | - WordPress:/var/www/html 737 | depends_on: 738 | - wordpress 739 | ports: 740 | - "80:80" 741 | networks: 742 | - mynetwork 743 | 744 | wordpress: 745 | container_name: wordpress 746 | build: ./wordpress/ 747 | restart: always 748 | volumes: 749 | - WordPress:/var/www/html 750 | networks: 751 | - mynetwork 752 | 753 | # NETWORK 754 | networks: 755 | mynetwork: 756 | name : mynetwork 757 | driver : bridge 758 | 759 | # VOLUME 760 | volumes: 761 | WordPress: 762 | driver: local 763 | driver_opts: 764 | type: 'none' 765 | o: 'bind' 766 | device: /home/tliot/data/website 767 | ``` 768 | 769 | ## Installing NGINX 770 | 771 | ```Dockerfile``` 772 | 773 | ``` .Dockerfile 774 | # SPECIFIE LA DISTRIBUTION 775 | FROM debian:buster 776 | RUN apt-get update 777 | 778 | # NGINX INSTALLATION 779 | RUN apt-get install -y nginx 780 | 781 | # Copy of default web page configuration 782 | COPY ./conf/default /etc/nginx/sites-available/default 783 | 784 | ENTRYPOINT ["nginx", "-g", "daemon off;"] 785 | ``` 786 | 787 | ```default``` 788 | 789 | ``` 790 | server { 791 | listen 80 default_server; 792 | listen [::]:80 default_server; 793 | 794 | server_name _; 795 | 796 | root /var/www/html/wordpress; 797 | index index.php ; 798 | 799 | # logging 800 | access_log /var/log/nginx/wordpress.access.log; 801 | error_log /var/log/nginx/wordpress.error.log; 802 | 803 | location / { 804 | try_files $uri $uri/ =404; 805 | } 806 | 807 | location ~ \.php$ { 808 | try_files $uri = 404; 809 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 810 | fastcgi_pass wordpress:9000; # <------------ Redirect to wordpress container 811 | fastcgi_index index.php; 812 | include fastcgi_params; 813 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 814 | fastcgi_param PATH_INFO $fastcgi_path_info; 815 | } 816 | } 817 | ``` 818 | 819 | ## Installing PHP-FPM 820 | 821 | 822 | ```dockerfile``` 823 | 824 | ``` .Dockerfile 825 | # SPECIFIE LA DISTRIBUTION 826 | FROM debian:buster 827 | RUN apt-get update 828 | 829 | # UDPATE & INSTALLATION 830 | RUN apt install php-fpm -y 831 | 832 | # To create the PID file (/run/php/php7.3-fpm.pid) 833 | RUN mkdir /run/php 834 | 835 | # To allow external connections 836 | COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/ 837 | 838 | # To create index.php 839 | COPY ./conf/index.php /var/www/html/wordpress/index.php 840 | 841 | # Is optional, just a metadata 842 | EXPOSE 9000 843 | 844 | ENTRYPOINT ["/usr/sbin/php-fpm7.3","-F" ] 845 | ``` 846 | 847 | ```index.php``` 848 | ``` 849 | 850 | ``` 851 | 852 | ``` www.conf ``` 853 | 854 | ``` .conf 855 | [www] 856 | user = www-data 857 | group = www-data 858 | # listen = 127.0.0.1:9000 # Change this line 859 | listen = 9000 # Now it's better 860 | listen.owner = www-data 861 | listen.group = www-data 862 | pm = dynamic 863 | pm.max_children = 5 864 | pm.start_servers = 2 865 | pm.min_spare_servers = 1 866 | pm.max_spare_servers = 3 867 | ``` 868 | 869 | ## Connecting NGINX 870 | 871 | 872 | 873 | # Local Domains in Linux 874 | 875 | #### Configure DNS Locally Using /etc/hosts File in Linux 876 | 877 | 878 | Now open the /etc/hosts file using your editor of choice as follows 879 | 880 | ```sudo vi /etc/hosts``` 881 | 882 | Then add the lines below to the end of the file as shown in the screen shot below. 883 | 884 | ``` 885 | 127.0.0.1 localhost 886 | 255.255.255.255 broadcasthost 887 | ::1 localhost 888 | 889 | 192.168.64.13 tliot.42.fr # <--- Principal Domains 890 | 192.168.64.13 adminer.tliot.42.fr # <--- adminer subdomain (optional) 891 | 192.168.64.13 *.tliot.42.fr # <--- all subdomain (optional) 892 | 893 | ``` 894 | 895 | Next, test if everything is working well as expected, using the ping command. 896 | 897 | ``` 898 | $ ping tliot.42.fr 899 | PING tliot.42.fr (192.168.64.13): 56 data bytes 900 | 64 bytes from 192.168.64.13: icmp_seq=0 ttl=64 time=1.919 ms 901 | 64 bytes from 192.168.64.13: icmp_seq=1 ttl=64 time=2.046 ms 902 | 64 bytes from 192.168.64.13: icmp_seq=2 ttl=64 time=2.391 ms 903 | 64 bytes from 192.168.64.13: icmp_seq=3 ttl=64 time=2.017 ms 904 | 64 bytes from 192.168.64.13: icmp_seq=4 ttl=64 time=2.481 ms 905 | ^C 906 | --- tliot.42.fr ping statistics --- 907 | 5 packets transmitted, 5 packets received, 0.0% packet loss 908 | ``` 909 | 910 | # Setup a self-signed SSL certificate 911 | 912 | #### Create the self-signed SSL certificate: 913 | 914 | ``` 915 | RUN openssl req \ 916 | -x509 \ 917 | -nodes \ 918 | -days 365 \ 919 | -newkey rsa:2048 \ 920 | -keyout /etc/ssl/private/nginx-selfsigned.key \ 921 | -out /etc/ssl/certs/nginx-selfsigned.crt \ 922 | -subj '/C=FR/ST=Ile-de-France/L=Paris/O=42/OU=42Paris/CN=TLIOT/UID=TTT' 923 | ``` 924 | 925 | #### Create a new configuration snippet file for Nginx: 926 | 927 | ``` 928 | RUN echo "ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;\nssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" > /etc/nginx/snippets/self-signed.conf 929 | ``` 930 | 931 | #### Create a strong Diffie-Hellman group: 932 | 933 | ``` 934 | RUN openssl dhparam -out /etc/nginx/dhparam.pem 2048 935 | ``` 936 | #### Create a configuration snippet with strong encryption settings: 937 | ``` 938 | COPY ./conf/ssl-params.conf /etc/nginx/snippets/ 939 | ``` 940 | 941 | ```ssl-params.conf``` 942 | 943 | ``` 944 | ssl_prefer_server_ciphers on; 945 | ssl_dhparam /etc/nginx/dhparam.pem; 946 | ssl_ciphers EECDH+AESGCM:EDH+AESGCM; 947 | ssl_ecdh_curve secp384r1; 948 | ssl_session_timeout 10m; 949 | ssl_session_cache shared:SSL:10m; 950 | ssl_session_tickets off; 951 | ssl_stapling on; 952 | ssl_stapling_verify on; 953 | resolver 8.8.8.8 8.8.4.4 valid=300s; 954 | resolver_timeout 5s; 955 | add_header X-Frame-Options DENY; 956 | add_header X-Content-Type-Options nosniff; 957 | add_header X-XSS-Protection "1; mode=block"; 958 | ``` 959 | 960 | 961 | #### Configure Nginx site to use certificate: 962 | 963 | ``` 964 | server { 965 | listen 443 ssl default_server; <--- 80 to 443 966 | listen [::]:443 ssl default_server; <--- 80 to 443 967 | 968 | server_name tliot.42.fr; <--- _ to tliot.42.fr 969 | 970 | # ssl 971 | include snippets/self-signed.conf; <--- self-signed SSL 972 | include snippets/ssl-params.conf; <--- strong encryption 973 | 974 | root /var/www/html/wordpress; 975 | index index.php ; 976 | 977 | # logging 978 | access_log /var/log/nginx/wordpress.access.log; 979 | error_log /var/log/nginx/wordpress.error.log; 980 | 981 | location / { 982 | try_files $uri $uri/ =404; 983 | } 984 | 985 | location ~ \.php$ { 986 | try_files $uri = 404; 987 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 988 | fastcgi_pass wordpress:9000; 989 | fastcgi_index index.php; 990 | include fastcgi_params; 991 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 992 | fastcgi_param PATH_INFO $fastcgi_path_info; 993 | } 994 | } 995 | ``` 996 | 997 | 998 | #### Configure docker-compose.yml site to use 443: 999 | 1000 | ```docker-compose.yml``` 1001 | 1002 | ``` 1003 | ngnix: 1004 | container_name: ngnix 1005 | build: ./nginx/ 1006 | restart: always 1007 | volumes: 1008 | - WordPress:/var/www/html 1009 | depends_on: 1010 | - wordpress 1011 | ports: 1012 | - "443:443" <--- 80:80 to 443:443 1013 | networks: 1014 | - mynetwork 1015 | ``` 1016 | 1017 | 1018 | 1019 | ### Testing the SSL Server 1020 | 1021 | Next, test whether the SSL encryption is working. 1022 | 1023 | On your browser, type the prefix ```http://``` then your domain name: 1024 | 1025 | ```https://server_domain``` 1026 | 1027 | Since the certificate is not already signed by a trusted certificate authority, you will most likely get a warning like the one below: 1028 | 1029 | You will see a warning that may pop-up because the SSL certificate created earlier isn’t signed by a trusted certificate authority: 1030 | 1031 | 1032 | 1033 | It's goood 👍🏼 1034 | 1035 | -------------------------------------------------------------------------------- /init_domain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "### Enter the server IP ###" 4 | read ip; 5 | i=0 6 | 7 | while [ $i -le 10 ] 8 | do 9 | if grep -q "web$i.tliot.42.fr" /etc/hosts; then 10 | echo "web$i.tliot.42.fr exist !" 11 | else 12 | echo "web$i.tliot.42.fr create " 13 | echo "$ip web$i.tliot.42.fr" >> /etc/hosts 14 | fi 15 | ((i++)) 16 | done 17 | 18 | 19 | if grep -q "adminer.tliot.42.fr" /etc/hosts; then 20 | echo "adminer.tliot.42.fr exist !" 21 | else 22 | echo "adminer.tliot.42.fr create " 23 | echo "$ip adminer.tliot.42.fr" >> /etc/hosts 24 | fi 25 | 26 | if grep -q -E "^tliot.42.fr$" /etc/hosts; then 27 | echo "tliot.42.fr exist !" 28 | else 29 | echo "tliot.42.fr create " 30 | echo "$ip tliot.42.fr" >> /etc/hosts 31 | fi -------------------------------------------------------------------------------- /srcs/.env: -------------------------------------------------------------------------------- 1 | ----- 2 | BDD_HOST=mariadb 3 | BDD_USER=user 4 | BDD_USER_PASSWORD=Tei7WL835pKA5wy 5 | BDD_NAME=wordpress 6 | ----- 7 | BDD_ROOT_PASSWORD=Tei7WL835pKA5wy 8 | ----- 9 | WP_ADMIN_EMAIL=BarnardLeModo@wp.com 10 | WP_ADMIN_USER=BarnardLeModo 11 | WP_ADMIN_PASSWORD=Td975Q_uunN^9? 12 | ----- 13 | WP_USER_EMAIL=FredLeRedacteur@wp.com 14 | WP_USER=FredLeRedacteur 15 | WP_USER_PASSWORD=uyD6f7?Jy9-$9U 16 | WP_USER_ROLE=editor 17 | ----- 18 | FTP_USER=JeremyLeWebMaster 19 | FTP_PASSWORD=R68M3pVtFABx3b -------------------------------------------------------------------------------- /srcs/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | services: 3 | ngnix: 4 | container_name: ngnix 5 | build: requirements/nginx/ 6 | restart: always 7 | depends_on: 8 | - wordpress 9 | - server-minecraft 10 | - adminer 11 | ports: 12 | - "80:80" 13 | - "443:443" 14 | - "25565:25565" 15 | networks: 16 | - mynetwork 17 | volumes: 18 | - WordPress:/var/www/html 19 | stdin_open: true # docker run -i 20 | tty: true # docker run -t 21 | 22 | wordpress: 23 | container_name: wordpress 24 | build: requirements/wordpress/ 25 | restart: always 26 | depends_on: 27 | - mariadb 28 | networks: 29 | - mynetwork 30 | volumes: 31 | - WordPress:/var/www/html 32 | env_file: .env 33 | stdin_open: true # docker run -i 34 | tty: true # docker run -t 35 | 36 | mariadb: 37 | container_name: mariadb 38 | build: requirements/mariadb/ 39 | restart: always 40 | networks: 41 | - mynetwork 42 | volumes: 43 | - db:/var/lib/mysql 44 | env_file: .env 45 | 46 | #BONUS 47 | adminer: 48 | container_name: adminer 49 | build: requirements/adminer/ 50 | restart: always 51 | networks: 52 | - mynetwork 53 | env_file: .env 54 | 55 | redis: 56 | container_name: redis 57 | build: requirements/redis/ 58 | restart: always 59 | networks: 60 | - mynetwork 61 | env_file: .env 62 | 63 | static-web: 64 | container_name: static-web 65 | build: requirements/static-web/ 66 | volumes: 67 | - WordPress:/var/www/html 68 | networks: 69 | - mynetwork 70 | stdin_open: true # docker run -i 71 | tty: true # docker run -t 72 | 73 | ftp: 74 | container_name: ftp 75 | build: requirements/ftp/ 76 | restart: always 77 | volumes: 78 | - WordPress:/var/www/html 79 | networks: 80 | - mynetwork 81 | ports: 82 | - "21:21" 83 | - "20:20" 84 | - "40000-40050:40000-40050" 85 | env_file: .env 86 | stdin_open: true # docker run -i 87 | tty: true # docker run -t 88 | 89 | #FOR FUN 90 | server-minecraft: 91 | container_name: minecraft-server 92 | build: requirements/minecraft/ 93 | restart: always 94 | networks: 95 | - mynetwork 96 | volumes: 97 | - server_minecraft_volume:/server 98 | restart: always 99 | 100 | 101 | # NETWORK 102 | networks: 103 | mynetwork: 104 | name : mynetwork 105 | driver : bridge 106 | 107 | # VOLUME 108 | volumes: 109 | db: 110 | driver: local 111 | driver_opts: 112 | type: 'none' 113 | o: 'bind' 114 | device: /home/tliot/data/db 115 | 116 | WordPress: 117 | driver: local 118 | driver_opts: 119 | type: 'none' 120 | o: 'bind' 121 | device: /home/tliot/data/wordpress 122 | 123 | server_minecraft_volume: 124 | driver: local 125 | driver_opts: 126 | type: 'none' 127 | o: 'bind' 128 | device: /home/tliot/data/minecraft-server -------------------------------------------------------------------------------- /srcs/requirements/adminer/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIES DISTRIBUTION 2 | FROM debian:buster 3 | 4 | # UPDATE AND INSTALLATION 5 | RUN apt-get update 6 | RUN apt install -y adminer 7 | 8 | # COPY THE CONF FILE 9 | COPY ./conf/000-default.conf /etc/apache2/sites-available/ 10 | RUN echo 'ServerName adminer' >> /etc/apache2/apache2.conf 11 | 12 | # START AND CONF 13 | RUN service apache2 start && a2enconf adminer.conf 14 | 15 | ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] -------------------------------------------------------------------------------- /srcs/requirements/adminer/conf/000-default.conf: -------------------------------------------------------------------------------- 1 | 2 | DocumentRoot /etc/adminer 3 | Alias /adminer /etc/adminer 4 | 5 | 6 | Require all granted 7 | DirectoryIndex conf.php 8 | 9 | 10 | ErrorLog ${APACHE_LOG_DIR}/error.log 11 | CustomLog ${APACHE_LOG_DIR}/access.log combined 12 | -------------------------------------------------------------------------------- /srcs/requirements/ftp/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIE LA DISTRIBUTION 2 | FROM debian:buster 3 | RUN apt-get update && apt-get upgrade -y 4 | 5 | # UDPATE & INSTALLATION 6 | RUN apt-get install -y iputils-ping vim vsftpd 7 | 8 | COPY ./conf/vsftpd.conf /etc/ 9 | 10 | COPY ./tools/script.sh /home/ 11 | RUN chmod +x /home/script.sh 12 | 13 | 14 | 15 | ENTRYPOINT ["/home/script.sh" ] 16 | -------------------------------------------------------------------------------- /srcs/requirements/ftp/conf/vsftpd.conf: -------------------------------------------------------------------------------- 1 | listen=YES 2 | listen_ipv6=NO 3 | connect_from_port_20=YES 4 | anonymous_enable=NO 5 | local_enable=YES 6 | write_enable=YES 7 | chroot_local_user=YES 8 | allow_writeable_chroot=YES 9 | secure_chroot_dir=/var/run/vsftpd/empty 10 | pam_service_name=vsftpd 11 | pasv_enable=YES 12 | pasv_min_port=40000 13 | pasv_max_port=40050 14 | chroot_local_user=YES 15 | local_root=/var/www/html 16 | userlist_enable=YES 17 | userlist_file=/etc/vsftpd.userlist 18 | userlist_deny=NO -------------------------------------------------------------------------------- /srcs/requirements/ftp/tools/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | service vsftpd start 4 | 5 | useradd -m $FTP_USER 6 | echo $FTP_USER:$FTP_PASSWORD | /usr/sbin/chpasswd 7 | chown $FTP_USER:$FTP_USER -R /home/$FTP_USER/ 8 | echo $FTP_USER | tee -a /etc/vsftpd.userlist 9 | service vsftpd stop 10 | 11 | /usr/sbin/vsftpd -------------------------------------------------------------------------------- /srcs/requirements/mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIES DISTRIBUTION 2 | FROM debian:buster 3 | 4 | # UPDATE AND INSTALLATION 5 | RUN apt-get update 6 | RUN apt install -y mariadb-server 7 | 8 | # COPY THE CONF FOR THE BIND AND THE SQL SCRIPT FOR THE PRIVILEGE 9 | COPY ./conf/50-server.cnf /etc/mysql/mariadb.conf.d/ 10 | 11 | # COPY THE SCRIPT IN THE IMAGES AND MODIFY THE EXECUTION RIGHTS OF IT 12 | COPY ./tools/script.sh / 13 | RUN chmod +x /script.sh 14 | 15 | ENTRYPOINT [ "/script.sh" ] -------------------------------------------------------------------------------- /srcs/requirements/mariadb/conf/50-server.cnf: -------------------------------------------------------------------------------- 1 | [server] 2 | 3 | [mysqld] 4 | 5 | user = mysql 6 | pid-file = /run/mysqld/mysqld.pid 7 | socket = /run/mysqld/mysqld.sock 8 | port = 3306 9 | basedir = /usr 10 | datadir = /var/lib/mysql 11 | tmpdir = /tmp 12 | lc-messages-dir = /usr/share/mysql 13 | lc-messages = en_US 14 | skip-external-locking 15 | 16 | # bind-address = 127.0.0.1 # You need to change this line to allow external connections 17 | bind-address = 0.0.0.0 # Now it's better :-) 18 | 19 | expire_logs_days = 10 20 | character-set-server = utf8mb4 21 | collation-server = utf8mb4_general_ci 22 | 23 | [embedded] 24 | 25 | [mariadb] 26 | 27 | [mariadb-10.5] -------------------------------------------------------------------------------- /srcs/requirements/mariadb/tools/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | service mysql start 3 | 4 | # CREATE USER # 5 | echo "CREATE USER '$BDD_USER'@'%' IDENTIFIED BY '$BDD_USER_PASSWORD';" | mysql 6 | 7 | # PRIVILGES FOR ROOT AND USER FOR ALL IP ADRESS # 8 | echo "GRANT ALL PRIVILEGES ON *.* TO '$BDD_USER'@'%' IDENTIFIED BY '$BDD_USER_PASSWORD';" | mysql 9 | echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$BDD_ROOT_PASSWORD';" | mysql 10 | echo "FLUSH PRIVILEGES;" | mysql 11 | 12 | # CREAT WORDPRESS DATABASE # 13 | echo "CREATE DATABASE $BDD_NAME;" | mysql 14 | 15 | 16 | kill $(cat /var/run/mysqld/mysqld.pid) 17 | 18 | mysqld 19 | 20 | -------------------------------------------------------------------------------- /srcs/requirements/minecraft/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster 2 | 3 | RUN apt-get update && apt-get -y upgrade 4 | RUN apt install -y vim iputils-ping wget curl tar 5 | RUN apt install -y openjdk-11-jdk openjdk-11-jre 6 | 7 | WORKDIR /server 8 | 9 | COPY config/server.jar /usr/bin/server.jar 10 | COPY config/eula.txt . 11 | ENTRYPOINT ["java", "-Xms1024m", "-Xmx2560m","-jar","/usr/bin/server.jar","nogui;"] 12 | 13 | -------------------------------------------------------------------------------- /srcs/requirements/minecraft/config/eula.txt: -------------------------------------------------------------------------------- 1 | #By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA). 2 | #Sun Mar 19 14:13:07 UTC 2023 3 | eula=true 4 | -------------------------------------------------------------------------------- /srcs/requirements/minecraft/config/server.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/srcs/requirements/minecraft/config/server.jar -------------------------------------------------------------------------------- /srcs/requirements/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIE LA DISTRIBUTION 2 | FROM debian:buster 3 | 4 | RUN apt-get update && apt-get upgrade -y 5 | 6 | # FOR DEBUGIN 7 | RUN apt install -y iputils-ping vim 8 | 9 | # UDPATE & INSTALLATION 10 | RUN apt-get install -y nginx openssl 11 | 12 | RUN openssl req \ 13 | -x509 \ 14 | -nodes \ 15 | -days 365 \ 16 | -newkey rsa:2048 \ 17 | -keyout /etc/ssl/private/nginx-selfsigned.key \ 18 | -out /etc/ssl/certs/nginx-selfsigned.crt \ 19 | -subj '/C=FR/ST=Ile-de-France/L=Paris/O=42/OU=42Paris/CN=TLIOT/UID=TTT' 20 | 21 | RUN echo "ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;\nssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;" > /etc/nginx/snippets/self-signed.conf 22 | 23 | RUN openssl dhparam -out /etc/nginx/dhparam.pem 2048 24 | COPY ./conf/ssl-params.conf /etc/nginx/snippets/ 25 | 26 | 27 | COPY ./conf/default /etc/nginx/sites-available/ 28 | COPY ./conf/adminer.conf /etc/nginx/sites-available/ 29 | COPY ./conf/subdomain.conf /etc/nginx/sites-available/ 30 | 31 | RUN ln -s /etc/nginx/sites-available/adminer.conf /etc/nginx/sites-enabled/ 32 | RUN ln -s /etc/nginx/sites-available/subdomain.conf /etc/nginx/sites-enabled/ 33 | 34 | COPY ./conf/minecraft.conf /etc/nginx/modules-available/ 35 | RUN ln -s /etc/nginx/modules-available/minecraft.conf /etc/nginx/modules-enabled/minecraft.conf 36 | 37 | ENTRYPOINT ["nginx", "-g", "daemon off;"] 38 | -------------------------------------------------------------------------------- /srcs/requirements/nginx/conf/adminer.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | server_name adminer.tliot.42.fr; 5 | return 301 https://adminer.tliot.42.fr; 6 | } 7 | 8 | 9 | server { 10 | listen 443 ssl; 11 | listen [::]:443 ssl; 12 | 13 | ssl_protocols TLSv1.3; 14 | 15 | include snippets/self-signed.conf; 16 | include snippets/ssl-params.conf; 17 | 18 | server_name adminer.tliot.42.fr; 19 | 20 | location / { 21 | proxy_pass http://adminer/; 22 | proxy_set_header Host $host; 23 | } 24 | 25 | error_page 403 404 /404.html; 26 | location = /404.html { 27 | root /var/www/html/web-404; 28 | internal; 29 | } 30 | 31 | error_page 500 502 503 504 /505.html; 32 | location = /505.html { 33 | root /var/www/html/web-500; 34 | internal; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /srcs/requirements/nginx/conf/default: -------------------------------------------------------------------------------- 1 | 2 | server { 3 | listen 80 default_server; 4 | listen [::]:80 default_server; 5 | server_name tliot.42.fr; 6 | return 301 https://tliot.42.fr$request_uri; 7 | } 8 | 9 | 10 | server { 11 | listen 443 ssl default_server; 12 | listen [::]:443 ssl default_server; 13 | 14 | ssl_protocols TLSv1.3; 15 | 16 | include snippets/self-signed.conf; 17 | include snippets/ssl-params.conf; 18 | 19 | root /var/www/html/wordpress; 20 | index index.php ; 21 | 22 | server_name tliot.42.fr; 23 | 24 | location / { 25 | try_files $uri $uri/ =404; 26 | } 27 | 28 | location ~ \.php$ { 29 | try_files $uri = 404; 30 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 31 | fastcgi_pass wordpress:9000; 32 | fastcgi_index index.php; 33 | include fastcgi_params; 34 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 35 | fastcgi_param PATH_INFO $fastcgi_path_info; 36 | } 37 | 38 | error_page 403 404 /404.html; 39 | location = /404.html { 40 | root /var/www/html/web-404; 41 | internal; 42 | } 43 | 44 | error_page 500 502 503 504 /505.html; 45 | location = /505.html { 46 | root /var/www/html/web-500; 47 | internal; 48 | } 49 | } -------------------------------------------------------------------------------- /srcs/requirements/nginx/conf/minecraft.conf: -------------------------------------------------------------------------------- 1 | stream { 2 | server { 3 | listen 25565; # Port of Minecraft server 4 | proxy_pass minecraft; 5 | } 6 | 7 | upstream minecraft { 8 | server minecraft-server:25565; # IP of the VM hosting Minecraft, port of Minecraft server. 9 | } 10 | } -------------------------------------------------------------------------------- /srcs/requirements/nginx/conf/ssl-params.conf: -------------------------------------------------------------------------------- 1 | #ssl_protocols TLSv1.3; 2 | ssl_prefer_server_ciphers on; 3 | ssl_dhparam /etc/nginx/dhparam.pem; 4 | ssl_ciphers EECDH+AESGCM:EDH+AESGCM; 5 | ssl_ecdh_curve secp384r1; 6 | ssl_session_timeout 10m; 7 | ssl_session_cache shared:SSL:10m; 8 | ssl_session_tickets off; 9 | ssl_stapling on; 10 | ssl_stapling_verify on; 11 | resolver 8.8.8.8 8.8.4.4 valid=300s; 12 | resolver_timeout 5s; 13 | # Disable strict transport security for now. You can uncomment the following 14 | # line if you understand the implications. 15 | #add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; 16 | add_header X-Frame-Options DENY; 17 | add_header X-Content-Type-Options nosniff; 18 | add_header X-XSS-Protection "1; mode=block"; 19 | -------------------------------------------------------------------------------- /srcs/requirements/nginx/conf/subdomain.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | server_name *.tliot.42.fr; 5 | return 301 https://$http_host; 6 | } 7 | 8 | server { 9 | listen 443 ssl; 10 | listen [::]:443 ssl; 11 | 12 | ssl_protocols TLSv1.3; 13 | 14 | include snippets/self-signed.conf; 15 | include snippets/ssl-params.conf; 16 | 17 | server_name *.tliot.42.fr; 18 | 19 | root /var/www/html/web-subdomain; 20 | index index.html ; 21 | location / { 22 | try_files $uri $uri/ =404; 23 | } 24 | 25 | error_page 403 404 /404.html; 26 | location = /404.html { 27 | root /var/www/html/web-404; 28 | internal; 29 | } 30 | 31 | error_page 500 502 503 504 /505.html; 32 | location = /505.html { 33 | root /var/www/html/web-500; 34 | internal; 35 | } 36 | 37 | 38 | } -------------------------------------------------------------------------------- /srcs/requirements/redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster 2 | 3 | RUN apt-get update && apt-get upgrade -y 4 | 5 | RUN apt install -y vim iputils-ping 6 | 7 | RUN apt install -y redis 8 | COPY /conf/redis.conf /etc/redis/ 9 | 10 | CMD ["redis-server", "--protected-mode", "no"] 11 | 12 | -------------------------------------------------------------------------------- /srcs/requirements/redis/conf/redis.conf: -------------------------------------------------------------------------------- 1 | 2 | bind 127.0.0.0 3 | protected-mode yes 4 | port 6379 5 | tcp-backlog 511 6 | timeout 0 7 | tcp-keepalive 300 8 | daemonize no 9 | supervised yes 10 | pidfile /var/run/redis_6379.pid 11 | loglevel notice 12 | logfile "" 13 | databases 16 14 | always-show-logo yes 15 | save 900 1 16 | save 300 10 17 | save 60 10000 18 | stop-writes-on-bgsave-error yes 19 | rdbcompression yes 20 | rdbchecksum yes 21 | dbfilename dump.rdb 22 | dir ./ 23 | slave-serve-stale-data yes 24 | slave-read-only yes 25 | repl-diskless-sync no 26 | repl-diskless-sync-delay 5 27 | repl-disable-tcp-nodelay no 28 | slave-priority 100 29 | lazyfree-lazy-eviction no 30 | lazyfree-lazy-expire no 31 | lazyfree-lazy-server-del no 32 | slave-lazy-flush no 33 | maxmemory 256mb 34 | maxmemory-policy allkeys-lru 35 | unixsocket /var/run/redis/redis.sock 36 | unixsocketperm 777 37 | ############################## APPEND ONLY MODE ############################### 38 | 39 | # By default Redis asynchronously dumps the dataset on disk. This mode is 40 | # good enough in many applications, but an issue with the Redis process or 41 | # a power outage may result into a few minutes of writes lost (depending on 42 | # the configured save points). 43 | # 44 | # The Append Only File is an alternative persistence mode that provides 45 | # much better durability. For instance using the default data fsync policy 46 | # (see later in the config file) Redis can lose just one second of writes in a 47 | # dramatic event like a server power outage, or a single write if something 48 | # wrong with the Redis process itself happens, but the operating system is 49 | # still running correctly. 50 | # 51 | # AOF and RDB persistence can be enabled at the same time without problems. 52 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 53 | # with the better durability guarantees. 54 | # 55 | # Please check http://redis.io/topics/persistence for more information. 56 | 57 | appendonly no 58 | 59 | # The name of the append only file (default: "appendonly.aof") 60 | 61 | appendfilename "appendonly.aof" 62 | 63 | # The fsync() call tells the Operating System to actually write data on disk 64 | # instead of waiting for more data in the output buffer. Some OS will really flush 65 | # data on disk, some other OS will just try to do it ASAP. 66 | # 67 | # Redis supports three different modes: 68 | # 69 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 70 | # always: fsync after every write to the append only log. Slow, Safest. 71 | # everysec: fsync only one time every second. Compromise. 72 | # 73 | # The default is "everysec", as that's usually the right compromise between 74 | # speed and data safety. It's up to you to understand if you can relax this to 75 | # "no" that will let the operating system flush the output buffer when 76 | # it wants, for better performances (but if you can live with the idea of 77 | # some data loss consider the default persistence mode that's snapshotting), 78 | # or on the contrary, use "always" that's very slow but a bit safer than 79 | # everysec. 80 | # 81 | # More details please check the following article: 82 | # http://antirez.com/post/redis-persistence-demystified.html 83 | # 84 | # If unsure, use "everysec". 85 | 86 | # appendfsync always 87 | appendfsync everysec 88 | # appendfsync no 89 | 90 | # When the AOF fsync policy is set to always or everysec, and a background 91 | # saving process (a background save or AOF log background rewriting) is 92 | # performing a lot of I/O against the disk, in some Linux configurations 93 | # Redis may block too long on the fsync() call. Note that there is no fix for 94 | # this currently, as even performing fsync in a different thread will block 95 | # our synchronous write(2) call. 96 | # 97 | # In order to mitigate this problem it's possible to use the following option 98 | # that will prevent fsync() from being called in the main process while a 99 | # BGSAVE or BGREWRITEAOF is in progress. 100 | # 101 | # This means that while another child is saving, the durability of Redis is 102 | # the same as "appendfsync none". In practical terms, this means that it is 103 | # possible to lose up to 30 seconds of log in the worst scenario (with the 104 | # default Linux settings). 105 | # 106 | # If you have latency problems turn this to "yes". Otherwise leave it as 107 | # "no" that is the safest pick from the point of view of durability. 108 | 109 | no-appendfsync-on-rewrite no 110 | 111 | # Automatic rewrite of the append only file. 112 | # Redis is able to automatically rewrite the log file implicitly calling 113 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 114 | # 115 | # This is how it works: Redis remembers the size of the AOF file after the 116 | # latest rewrite (if no rewrite has happened since the restart, the size of 117 | # the AOF at startup is used). 118 | # 119 | # This base size is compared to the current size. If the current size is 120 | # bigger than the specified percentage, the rewrite is triggered. Also 121 | # you need to specify a minimal size for the AOF file to be rewritten, this 122 | # is useful to avoid rewriting the AOF file even if the percentage increase 123 | # is reached but it is still pretty small. 124 | # 125 | # Specify a percentage of zero in order to disable the automatic AOF 126 | # rewrite feature. 127 | 128 | auto-aof-rewrite-percentage 100 129 | auto-aof-rewrite-min-size 64mb 130 | 131 | # An AOF file may be found to be truncated at the end during the Redis 132 | # startup process, when the AOF data gets loaded back into memory. 133 | # This may happen when the system where Redis is running 134 | # crashes, especially when an ext4 filesystem is mounted without the 135 | # data=ordered option (however this can't happen when Redis itself 136 | # crashes or aborts but the operating system still works correctly). 137 | # 138 | # Redis can either exit with an error when this happens, or load as much 139 | # data as possible (the default now) and start if the AOF file is found 140 | # to be truncated at the end. The following option controls this behavior. 141 | # 142 | # If aof-load-truncated is set to yes, a truncated AOF file is loaded and 143 | # the Redis server starts emitting a log to inform the user of the event. 144 | # Otherwise if the option is set to no, the server aborts with an error 145 | # and refuses to start. When the option is set to no, the user requires 146 | # to fix the AOF file using the "redis-check-aof" utility before to restart 147 | # the server. 148 | # 149 | # Note that if the AOF file will be found to be corrupted in the middle 150 | # the server will still exit with an error. This option only applies when 151 | # Redis will try to read more data from the AOF file but not enough bytes 152 | # will be found. 153 | aof-load-truncated yes 154 | 155 | # When rewriting the AOF file, Redis is able to use an RDB preamble in the 156 | # AOF file for faster rewrites and recoveries. When this option is turned 157 | # on the rewritten AOF file is composed of two different stanzas: 158 | # 159 | # [RDB file][AOF tail] 160 | # 161 | # When loading Redis recognizes that the AOF file starts with the "REDIS" 162 | # string and loads the prefixed RDB file, and continues loading the AOF 163 | # tail. 164 | # 165 | # This is currently turned off by default in order to avoid the surprise 166 | # of a format change, but will at some point be used as the default. 167 | aof-use-rdb-preamble no 168 | 169 | ################################ LUA SCRIPTING ############################### 170 | 171 | # Max execution time of a Lua script in milliseconds. 172 | # 173 | # If the maximum execution time is reached Redis will log that a script is 174 | # still in execution after the maximum allowed time and will start to 175 | # reply to queries with an error. 176 | # 177 | # When a long running script exceeds the maximum execution time only the 178 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 179 | # used to stop a script that did not yet called write commands. The second 180 | # is the only way to shut down the server in the case a write command was 181 | # already issued by the script but the user doesn't want to wait for the natural 182 | # termination of the script. 183 | # 184 | # Set it to 0 or a negative value for unlimited execution without warnings. 185 | lua-time-limit 5000 186 | 187 | ################################ REDIS CLUSTER ############################### 188 | # 189 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 190 | # WARNING EXPERIMENTAL: Redis Cluster is considered to be stable code, however 191 | # in order to mark it as "mature" we need to wait for a non trivial percentage 192 | # of users to deploy it in production. 193 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 194 | # 195 | # Normal Redis instances can't be part of a Redis Cluster; only nodes that are 196 | # started as cluster nodes can. In order to start a Redis instance as a 197 | # cluster node enable the cluster support uncommenting the following: 198 | # 199 | # cluster-enabled yes 200 | 201 | # Every cluster node has a cluster configuration file. This file is not 202 | # intended to be edited by hand. It is created and updated by Redis nodes. 203 | # Every Redis Cluster node requires a different cluster configuration file. 204 | # Make sure that instances running in the same system do not have 205 | # overlapping cluster configuration file names. 206 | # 207 | # cluster-config-file nodes-6379.conf 208 | 209 | # Cluster node timeout is the amount of milliseconds a node must be unreachable 210 | # for it to be considered in failure state. 211 | # Most other internal time limits are multiple of the node timeout. 212 | # 213 | # cluster-node-timeout 15000 214 | 215 | # A slave of a failing master will avoid to start a failover if its data 216 | # looks too old. 217 | # 218 | # There is no simple way for a slave to actually have an exact measure of 219 | # its "data age", so the following two checks are performed: 220 | # 221 | # 1) If there are multiple slaves able to failover, they exchange messages 222 | # in order to try to give an advantage to the slave with the best 223 | # replication offset (more data from the master processed). 224 | # Slaves will try to get their rank by offset, and apply to the start 225 | # of the failover a delay proportional to their rank. 226 | # 227 | # 2) Every single slave computes the time of the last interaction with 228 | # its master. This can be the last ping or command received (if the master 229 | # is still in the "connected" state), or the time that elapsed since the 230 | # disconnection with the master (if the replication link is currently down). 231 | # If the last interaction is too old, the slave will not try to failover 232 | # at all. 233 | # 234 | # The point "2" can be tuned by user. Specifically a slave will not perform 235 | # the failover if, since the last interaction with the master, the time 236 | # elapsed is greater than: 237 | # 238 | # (node-timeout * slave-validity-factor) + repl-ping-slave-period 239 | # 240 | # So for example if node-timeout is 30 seconds, and the slave-validity-factor 241 | # is 10, and assuming a default repl-ping-slave-period of 10 seconds, the 242 | # slave will not try to failover if it was not able to talk with the master 243 | # for longer than 310 seconds. 244 | # 245 | # A large slave-validity-factor may allow slaves with too old data to failover 246 | # a master, while a too small value may prevent the cluster from being able to 247 | # elect a slave at all. 248 | # 249 | # For maximum availability, it is possible to set the slave-validity-factor 250 | # to a value of 0, which means, that slaves will always try to failover the 251 | # master regardless of the last time they interacted with the master. 252 | # (However they'll always try to apply a delay proportional to their 253 | # offset rank). 254 | # 255 | # Zero is the only value able to guarantee that when all the partitions heal 256 | # the cluster will always be able to continue. 257 | # 258 | # cluster-slave-validity-factor 10 259 | 260 | # Cluster slaves are able to migrate to orphaned masters, that are masters 261 | # that are left without working slaves. This improves the cluster ability 262 | # to resist to failures as otherwise an orphaned master can't be failed over 263 | # in case of failure if it has no working slaves. 264 | # 265 | # Slaves migrate to orphaned masters only if there are still at least a 266 | # given number of other working slaves for their old master. This number 267 | # is the "migration barrier". A migration barrier of 1 means that a slave 268 | # will migrate only if there is at least 1 other working slave for its master 269 | # and so forth. It usually reflects the number of slaves you want for every 270 | # master in your cluster. 271 | # 272 | # Default is 1 (slaves migrate only if their masters remain with at least 273 | # one slave). To disable migration just set it to a very large value. 274 | # A value of 0 can be set but is useful only for debugging and dangerous 275 | # in production. 276 | # 277 | # cluster-migration-barrier 1 278 | 279 | # By default Redis Cluster nodes stop accepting queries if they detect there 280 | # is at least an hash slot uncovered (no available node is serving it). 281 | # This way if the cluster is partially down (for example a range of hash slots 282 | # are no longer covered) all the cluster becomes, eventually, unavailable. 283 | # It automatically returns available as soon as all the slots are covered again. 284 | # 285 | # However sometimes you want the subset of the cluster which is working, 286 | # to continue to accept queries for the part of the key space that is still 287 | # covered. In order to do so, just set the cluster-require-full-coverage 288 | # option to no. 289 | # 290 | # cluster-require-full-coverage yes 291 | 292 | # This option, when set to yes, prevents slaves from trying to failover its 293 | # master during master failures. However the master can still perform a 294 | # manual failover, if forced to do so. 295 | # 296 | # This is useful in different scenarios, especially in the case of multiple 297 | # data center operations, where we want one side to never be promoted if not 298 | # in the case of a total DC failure. 299 | # 300 | # cluster-slave-no-failover no 301 | 302 | # In order to setup your cluster make sure to read the documentation 303 | # available at http://redis.io web site. 304 | 305 | ########################## CLUSTER DOCKER/NAT support ######################## 306 | 307 | # In certain deployments, Redis Cluster nodes address discovery fails, because 308 | # addresses are NAT-ted or because ports are forwarded (the typical case is 309 | # Docker and other containers). 310 | # 311 | # In order to make Redis Cluster working in such environments, a static 312 | # configuration where each node knows its public address is needed. The 313 | # following two options are used for this scope, and are: 314 | # 315 | # * cluster-announce-ip 316 | # * cluster-announce-port 317 | # * cluster-announce-bus-port 318 | # 319 | # Each instruct the node about its address, client port, and cluster message 320 | # bus port. The information is then published in the header of the bus packets 321 | # so that other nodes will be able to correctly map the address of the node 322 | # publishing the information. 323 | # 324 | # If the above options are not used, the normal Redis Cluster auto-detection 325 | # will be used instead. 326 | # 327 | # Note that when remapped, the bus port may not be at the fixed offset of 328 | # clients port + 10000, so you can specify any port and bus-port depending 329 | # on how they get remapped. If the bus-port is not set, a fixed offset of 330 | # 10000 will be used as usually. 331 | # 332 | # Example: 333 | # 334 | # cluster-announce-ip 10.1.1.5 335 | # cluster-announce-port 6379 336 | # cluster-announce-bus-port 6380 337 | 338 | ################################## SLOW LOG ################################### 339 | 340 | # The Redis Slow Log is a system to log queries that exceeded a specified 341 | # execution time. The execution time does not include the I/O operations 342 | # like talking with the client, sending the reply and so forth, 343 | # but just the time needed to actually execute the command (this is the only 344 | # stage of command execution where the thread is blocked and can not serve 345 | # other requests in the meantime). 346 | # 347 | # You can configure the slow log with two parameters: one tells Redis 348 | # what is the execution time, in microseconds, to exceed in order for the 349 | # command to get logged, and the other parameter is the length of the 350 | # slow log. When a new command is logged the oldest one is removed from the 351 | # queue of logged commands. 352 | 353 | # The following time is expressed in microseconds, so 1000000 is equivalent 354 | # to one second. Note that a negative number disables the slow log, while 355 | # a value of zero forces the logging of every command. 356 | slowlog-log-slower-than 10000 357 | 358 | # There is no limit to this length. Just be aware that it will consume memory. 359 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 360 | slowlog-max-len 128 361 | 362 | ################################ LATENCY MONITOR ############################## 363 | 364 | # The Redis latency monitoring subsystem samples different operations 365 | # at runtime in order to collect data related to possible sources of 366 | # latency of a Redis instance. 367 | # 368 | # Via the LATENCY command this information is available to the user that can 369 | # print graphs and obtain reports. 370 | # 371 | # The system only logs operations that were performed in a time equal or 372 | # greater than the amount of milliseconds specified via the 373 | # latency-monitor-threshold configuration directive. When its value is set 374 | # to zero, the latency monitor is turned off. 375 | # 376 | # By default latency monitoring is disabled since it is mostly not needed 377 | # if you don't have latency issues, and collecting data has a performance 378 | # impact, that while very small, can be measured under big load. Latency 379 | # monitoring can easily be enabled at runtime using the command 380 | # "CONFIG SET latency-monitor-threshold " if needed. 381 | latency-monitor-threshold 0 382 | 383 | ############################# EVENT NOTIFICATION ############################## 384 | 385 | # Redis can notify Pub/Sub clients about events happening in the key space. 386 | # This feature is documented at http://redis.io/topics/notifications 387 | # 388 | # For instance if keyspace events notification is enabled, and a client 389 | # performs a DEL operation on key "foo" stored in the Database 0, two 390 | # messages will be published via Pub/Sub: 391 | # 392 | # PUBLISH __keyspace@0__:foo del 393 | # PUBLISH __keyevent@0__:del foo 394 | # 395 | # It is possible to select the events that Redis will notify among a set 396 | # of classes. Every class is identified by a single character: 397 | # 398 | # K Keyspace events, published with __keyspace@__ prefix. 399 | # E Keyevent events, published with __keyevent@__ prefix. 400 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 401 | # $ String commands 402 | # l List commands 403 | # s Set commands 404 | # h Hash commands 405 | # z Sorted set commands 406 | # x Expired events (events generated every time a key expires) 407 | # e Evicted events (events generated when a key is evicted for maxmemory) 408 | # A Alias for g$lshzxe, so that the "AKE" string means all the events. 409 | # 410 | # The "notify-keyspace-events" takes as argument a string that is composed 411 | # of zero or multiple characters. The empty string means that notifications 412 | # are disabled. 413 | # 414 | # Example: to enable list and generic events, from the point of view of the 415 | # event name, use: 416 | # 417 | # notify-keyspace-events Elg 418 | # 419 | # Example 2: to get the stream of the expired keys subscribing to channel 420 | # name __keyevent@0__:expired use: 421 | # 422 | # notify-keyspace-events Ex 423 | # 424 | # By default all notifications are disabled because most users don't need 425 | # this feature and the feature has some overhead. Note that if you don't 426 | # specify at least one of K or E, no events will be delivered. 427 | notify-keyspace-events "" 428 | 429 | ############################### ADVANCED CONFIG ############################### 430 | 431 | # Hashes are encoded using a memory efficient data structure when they have a 432 | # small number of entries, and the biggest entry does not exceed a given 433 | # threshold. These thresholds can be configured using the following directives. 434 | hash-max-ziplist-entries 512 435 | hash-max-ziplist-value 64 436 | 437 | # Lists are also encoded in a special way to save a lot of space. 438 | # The number of entries allowed per internal list node can be specified 439 | # as a fixed maximum size or a maximum number of elements. 440 | # For a fixed maximum size, use -5 through -1, meaning: 441 | # -5: max size: 64 Kb <-- not recommended for normal workloads 442 | # -4: max size: 32 Kb <-- not recommended 443 | # -3: max size: 16 Kb <-- probably not recommended 444 | # -2: max size: 8 Kb <-- good 445 | # -1: max size: 4 Kb <-- good 446 | # Positive numbers mean store up to _exactly_ that number of elements 447 | # per list node. 448 | # The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size), 449 | # but if your use case is unique, adjust the settings as necessary. 450 | list-max-ziplist-size -2 451 | 452 | # Lists may also be compressed. 453 | # Compress depth is the number of quicklist ziplist nodes from *each* side of 454 | # the list to *exclude* from compression. The head and tail of the list 455 | # are always uncompressed for fast push/pop operations. Settings are: 456 | # 0: disable all list compression 457 | # 1: depth 1 means "don't start compressing until after 1 node into the list, 458 | # going from either the head or tail" 459 | # So: [head]->node->node->...->node->[tail] 460 | # [head], [tail] will always be uncompressed; inner nodes will compress. 461 | # 2: [head]->[next]->node->node->...->node->[prev]->[tail] 462 | # 2 here means: don't compress head or head->next or tail->prev or tail, 463 | # but compress all nodes between them. 464 | # 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail] 465 | # etc. 466 | list-compress-depth 0 467 | 468 | # Sets have a special encoding in just one case: when a set is composed 469 | # of just strings that happen to be integers in radix 10 in the range 470 | # of 64 bit signed integers. 471 | # The following configuration setting sets the limit in the size of the 472 | # set in order to use this special memory saving encoding. 473 | set-max-intset-entries 512 474 | 475 | # Similarly to hashes and lists, sorted sets are also specially encoded in 476 | # order to save a lot of space. This encoding is only used when the length and 477 | # elements of a sorted set are below the following limits: 478 | zset-max-ziplist-entries 128 479 | zset-max-ziplist-value 64 480 | 481 | # HyperLogLog sparse representation bytes limit. The limit includes the 482 | # 16 bytes header. When an HyperLogLog using the sparse representation crosses 483 | # this limit, it is converted into the dense representation. 484 | # 485 | # A value greater than 16000 is totally useless, since at that point the 486 | # dense representation is more memory efficient. 487 | # 488 | # The suggested value is ~ 3000 in order to have the benefits of 489 | # the space efficient encoding without slowing down too much PFADD, 490 | # which is O(N) with the sparse encoding. The value can be raised to 491 | # ~ 10000 when CPU is not a concern, but space is, and the data set is 492 | # composed of many HyperLogLogs with cardinality in the 0 - 15000 range. 493 | hll-sparse-max-bytes 3000 494 | 495 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 496 | # order to help rehashing the main Redis hash table (the one mapping top-level 497 | # keys to values). The hash table implementation Redis uses (see dict.c) 498 | # performs a lazy rehashing: the more operation you run into a hash table 499 | # that is rehashing, the more rehashing "steps" are performed, so if the 500 | # server is idle the rehashing is never complete and some more memory is used 501 | # by the hash table. 502 | # 503 | # The default is to use this millisecond 10 times every second in order to 504 | # actively rehash the main dictionaries, freeing memory when possible. 505 | # 506 | # If unsure: 507 | # use "activerehashing no" if you have hard latency requirements and it is 508 | # not a good thing in your environment that Redis can reply from time to time 509 | # to queries with 2 milliseconds delay. 510 | # 511 | # use "activerehashing yes" if you don't have such hard requirements but 512 | # want to free memory asap when possible. 513 | activerehashing yes 514 | 515 | # The client output buffer limits can be used to force disconnection of clients 516 | # that are not reading data from the server fast enough for some reason (a 517 | # common reason is that a Pub/Sub client can't consume messages as fast as the 518 | # publisher can produce them). 519 | # 520 | # The limit can be set differently for the three different classes of clients: 521 | # 522 | # normal -> normal clients including MONITOR clients 523 | # slave -> slave clients 524 | # pubsub -> clients subscribed to at least one pubsub channel or pattern 525 | # 526 | # The syntax of every client-output-buffer-limit directive is the following: 527 | # 528 | # client-output-buffer-limit 529 | # 530 | # A client is immediately disconnected once the hard limit is reached, or if 531 | # the soft limit is reached and remains reached for the specified number of 532 | # seconds (continuously). 533 | # So for instance if the hard limit is 32 megabytes and the soft limit is 534 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 535 | # if the size of the output buffers reach 32 megabytes, but will also get 536 | # disconnected if the client reaches 16 megabytes and continuously overcomes 537 | # the limit for 10 seconds. 538 | # 539 | # By default normal clients are not limited because they don't receive data 540 | # without asking (in a push way), but just after a request, so only 541 | # asynchronous clients may create a scenario where data is requested faster 542 | # than it can read. 543 | # 544 | # Instead there is a default limit for pubsub and slave clients, since 545 | # subscribers and slaves receive data in a push fashion. 546 | # 547 | # Both the hard or the soft limit can be disabled by setting them to zero. 548 | client-output-buffer-limit normal 0 0 0 549 | client-output-buffer-limit slave 256mb 64mb 60 550 | client-output-buffer-limit pubsub 32mb 8mb 60 551 | 552 | # Client query buffers accumulate new commands. They are limited to a fixed 553 | # amount by default in order to avoid that a protocol desynchronization (for 554 | # instance due to a bug in the client) will lead to unbound memory usage in 555 | # the query buffer. However you can configure it here if you have very special 556 | # needs, such us huge multi/exec requests or alike. 557 | # 558 | # client-query-buffer-limit 1gb 559 | 560 | # In the Redis protocol, bulk requests, that are, elements representing single 561 | # strings, are normally limited ot 512 mb. However you can change this limit 562 | # here. 563 | # 564 | # proto-max-bulk-len 512mb 565 | 566 | # Redis calls an internal function to perform many background tasks, like 567 | # closing connections of clients in timeout, purging expired keys that are 568 | # never requested, and so forth. 569 | # 570 | # Not all tasks are performed with the same frequency, but Redis checks for 571 | # tasks to perform according to the specified "hz" value. 572 | # 573 | # By default "hz" is set to 10. Raising the value will use more CPU when 574 | # Redis is idle, but at the same time will make Redis more responsive when 575 | # there are many keys expiring at the same time, and timeouts may be 576 | # handled with more precision. 577 | # 578 | # The range is between 1 and 500, however a value over 100 is usually not 579 | # a good idea. Most users should use the default of 10 and raise this up to 580 | # 100 only in environments where very low latency is required. 581 | hz 10 582 | 583 | # When a child rewrites the AOF file, if the following option is enabled 584 | # the file will be fsync-ed every 32 MB of data generated. This is useful 585 | # in order to commit the file to the disk more incrementally and avoid 586 | # big latency spikes. 587 | aof-rewrite-incremental-fsync yes 588 | 589 | # Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good 590 | # idea to start with the default settings and only change them after investigating 591 | # how to improve the performances and how the keys LFU change over time, which 592 | # is possible to inspect via the OBJECT FREQ command. 593 | # 594 | # There are two tunable parameters in the Redis LFU implementation: the 595 | # counter logarithm factor and the counter decay time. It is important to 596 | # understand what the two parameters mean before changing them. 597 | # 598 | # The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis 599 | # uses a probabilistic increment with logarithmic behavior. Given the value 600 | # of the old counter, when a key is accessed, the counter is incremented in 601 | # this way: 602 | # 603 | # 1. A random number R between 0 and 1 is extracted. 604 | # 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1). 605 | # 3. The counter is incremented only if R < P. 606 | # 607 | # The default lfu-log-factor is 10. This is a table of how the frequency 608 | # counter changes with a different number of accesses with different 609 | # logarithmic factors: 610 | # 611 | # +--------+------------+------------+------------+------------+------------+ 612 | # | factor | 100 hits | 1000 hits | 100K hits | 1M hits | 10M hits | 613 | # +--------+------------+------------+------------+------------+------------+ 614 | # | 0 | 104 | 255 | 255 | 255 | 255 | 615 | # +--------+------------+------------+------------+------------+------------+ 616 | # | 1 | 18 | 49 | 255 | 255 | 255 | 617 | # +--------+------------+------------+------------+------------+------------+ 618 | # | 10 | 10 | 18 | 142 | 255 | 255 | 619 | # +--------+------------+------------+------------+------------+------------+ 620 | # | 100 | 8 | 11 | 49 | 143 | 255 | 621 | # +--------+------------+------------+------------+------------+------------+ 622 | # 623 | # NOTE: The above table was obtained by running the following commands: 624 | # 625 | # redis-benchmark -n 1000000 incr foo 626 | # redis-cli object freq foo 627 | # 628 | # NOTE 2: The counter initial value is 5 in order to give new objects a chance 629 | # to accumulate hits. 630 | # 631 | # The counter decay time is the time, in minutes, that must elapse in order 632 | # for the key counter to be divided by two (or decremented if it has a value 633 | # less <= 10). 634 | # 635 | # The default value for the lfu-decay-time is 1. A Special value of 0 means to 636 | # decay the counter every time it happens to be scanned. 637 | # 638 | # lfu-log-factor 10 639 | # lfu-decay-time 1 640 | 641 | ########################### ACTIVE DEFRAGMENTATION ####################### 642 | # 643 | # WARNING THIS FEATURE IS EXPERIMENTAL. However it was stress tested 644 | # even in production and manually tested by multiple engineers for some 645 | # time. 646 | # 647 | # What is active defragmentation? 648 | # ------------------------------- 649 | # 650 | # Active (online) defragmentation allows a Redis server to compact the 651 | # spaces left between small allocations and deallocations of data in memory, 652 | # thus allowing to reclaim back memory. 653 | # 654 | # Fragmentation is a natural process that happens with every allocator (but 655 | # less so with Jemalloc, fortunately) and certain workloads. Normally a server 656 | # restart is needed in order to lower the fragmentation, or at least to flush 657 | # away all the data and create it again. However thanks to this feature 658 | # implemented by Oran Agra for Redis 4.0 this process can happen at runtime 659 | # in an "hot" way, while the server is running. 660 | # 661 | # Basically when the fragmentation is over a certain level (see the 662 | # configuration options below) Redis will start to create new copies of the 663 | # values in contiguous memory regions by exploiting certain specific Jemalloc 664 | # features (in order to understand if an allocation is causing fragmentation 665 | # and to allocate it in a better place), and at the same time, will release the 666 | # old copies of the data. This process, repeated incrementally for all the keys 667 | # will cause the fragmentation to drop back to normal values. 668 | # 669 | # Important things to understand: 670 | # 671 | # 1. This feature is disabled by default, and only works if you compiled Redis 672 | # to use the copy of Jemalloc we ship with the source code of Redis. 673 | # This is the default with Linux builds. 674 | # 675 | # 2. You never need to enable this feature if you don't have fragmentation 676 | # issues. 677 | # 678 | # 3. Once you experience fragmentation, you can enable this feature when 679 | # needed with the command "CONFIG SET activedefrag yes". 680 | # 681 | # The configuration parameters are able to fine tune the behavior of the 682 | # defragmentation process. If you are not sure about what they mean it is 683 | # a good idea to leave the defaults untouched. 684 | 685 | # Enabled active defragmentation 686 | # activedefrag yes 687 | 688 | # Minimum amount of fragmentation waste to start active defrag 689 | # active-defrag-ignore-bytes 100mb 690 | 691 | # Minimum percentage of fragmentation to start active defrag 692 | # active-defrag-threshold-lower 10 693 | 694 | # Maximum percentage of fragmentation at which we use maximum effort 695 | # active-defrag-threshold-upper 100 696 | 697 | # Minimal effort for defrag in CPU percentage 698 | # active-defrag-cycle-min 25 699 | 700 | # Maximal effort for defrag in CPU percentage 701 | # active-defrag-cycle-max 75 702 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIE LA DISTRIBUTION 2 | FROM debian:buster 3 | 4 | # UDPATE & INSTALLATION 5 | RUN apt-get update && apt-get upgrade -y 6 | RUN apt-get install -y npm 7 | 8 | # FOR DEBUGIN 9 | RUN apt install -y iputils-ping vim 10 | 11 | COPY ./conf/ /home/ 12 | 13 | COPY ./tools/script.sh /bin/ 14 | RUN chmod 777 /bin/script.sh 15 | 16 | ENTRYPOINT ["/bin/script.sh"] 17 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-404/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 77 | 78 | 404 Page 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 |
175 |
176 |

404 Error

177 |

Couldn't launch :(

178 | 182 | 183 |
184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-500/505.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 77 | 78 | 500 Page 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 |
175 |
176 |

500 Error

177 |

Couldn't launch :(

178 | 182 | 183 |
184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/srcs/requirements/static-web/conf/web-subdomain/.DS_Store -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/home.css: -------------------------------------------------------------------------------- 1 | .home-container { 2 | width: 100%; 3 | display: flex; 4 | overflow: auto; 5 | min-height: 100vh; 6 | align-items: center; 7 | flex-direction: column; 8 | background-color: #27272D; 9 | } 10 | .home-hero { 11 | gap: var(--dl-space-space-fiveunits); 12 | width: 100%; 13 | height: 421px; 14 | display: flex; 15 | max-width: 1440px; 16 | align-self: center; 17 | align-items: center; 18 | padding-top: var(--dl-space-space-fourunits); 19 | padding-left: var(--dl-space-space-fiveunits); 20 | padding-right: var(--dl-space-space-fiveunits); 21 | flex-direction: column; 22 | padding-bottom: 73px; 23 | } 24 | .home-heading { 25 | gap: var(--dl-space-space-twounits); 26 | display: flex; 27 | align-items: center; 28 | flex-direction: column; 29 | } 30 | .home-header { 31 | color: rgb(255, 255, 255); 32 | font-size: 90px; 33 | max-width: 900px; 34 | font-style: normal; 35 | text-align: center; 36 | font-weight: 500; 37 | line-height: 108px; 38 | } 39 | .home-caption { 40 | color: rgb(255, 255, 255); 41 | font-size: 24px; 42 | max-width: 800px; 43 | text-align: center; 44 | line-height: 36px; 45 | } 46 | .home-divider-image { 47 | width: 100%; 48 | height: 505px; 49 | object-fit: cover; 50 | } 51 | @media(max-width: 767px) { 52 | .home-hero { 53 | padding-top: var(--dl-space-space-threeunits); 54 | padding-left: var(--dl-space-space-oneandhalfunits); 55 | padding-right: var(--dl-space-space-oneandhalfunits); 56 | padding-bottom: var(--dl-space-space-twounits); 57 | } 58 | .home-heading { 59 | gap: var(--dl-space-space-unit); 60 | } 61 | .home-header { 62 | font-size: 36px; 63 | max-width: 70%; 64 | line-height: 43px; 65 | } 66 | .home-caption { 67 | font-size: 16px; 68 | line-height: 24px; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Buy my subdomain 5 | 6 | 7 | 8 | 9 | 10 | 13 | 31 | 36 | 37 | 38 | 39 | 40 | 41 |
42 | 43 | 44 |
45 |
46 |
47 |

This subdomain is available

48 | 49 |

50 | 54 |

Contact by email : tliot@student.42.fr

55 |
56 |
57 | image 62 |
63 |
64 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "character-nft-template", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "parcel-bundler": "^1.6.1" 7 | }, 8 | "scripts": {}, 9 | "devDependencies": {} 10 | } -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/srcs/requirements/static-web/conf/web-subdomain/public/.DS_Store -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/public/playground_assets/hero-divider-600h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Theo2lt/Inception/ff21974794cc9222631e6b36ba99f80d952fb9bb/srcs/requirements/static-web/conf/web-subdomain/public/playground_assets/hero-divider-600h.png -------------------------------------------------------------------------------- /srcs/requirements/static-web/conf/web-subdomain/style.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --dl-color-gray-500: #595959; 3 | --dl-color-gray-700: #999999; 4 | --dl-color-gray-900: #D9D9D9; 5 | --dl-size-size-large: 144px; 6 | --dl-size-size-small: 48px; 7 | --dl-color-danger-300: #A22020; 8 | --dl-color-danger-500: #BF2626; 9 | --dl-color-danger-700: #E14747; 10 | --dl-color-gray-black: #000000; 11 | --dl-color-gray-white: #FFFFFF; 12 | --dl-size-size-medium: 96px; 13 | --dl-size-size-xlarge: 192px; 14 | --dl-size-size-xsmall: 16px; 15 | --dl-space-space-unit: 16px; 16 | --dl-color-primary-100: #003EB3; 17 | --dl-color-primary-300: #0074F0; 18 | --dl-color-primary-500: #14A9FF; 19 | --dl-color-primary-700: #85DCFF; 20 | --dl-color-success-300: #199033; 21 | --dl-color-success-500: #32A94C; 22 | --dl-color-success-700: #4CC366; 23 | --dl-size-size-xxlarge: 288px; 24 | --dl-size-size-maxwidth: 1400px; 25 | --dl-radius-radius-round: 50%; 26 | --dl-space-space-halfunit: 8px; 27 | --dl-space-space-sixunits: 96px; 28 | --dl-space-space-twounits: 32px; 29 | --dl-radius-radius-radius2: 2px; 30 | --dl-radius-radius-radius4: 4px; 31 | --dl-radius-radius-radius8: 8px; 32 | --dl-space-space-fiveunits: 80px; 33 | --dl-space-space-fourunits: 64px; 34 | --dl-space-space-threeunits: 48px; 35 | --dl-space-space-oneandhalfunits: 24px; 36 | } 37 | .button { 38 | color: var(--dl-color-gray-black); 39 | cursor: pointer; 40 | display: inline-block; 41 | padding: 0.5rem 1rem; 42 | font-size: 18px; 43 | box-shadow: 5px 6px 0px 0px #000000; 44 | font-style: normal; 45 | transition: 0.3s; 46 | font-weight: 500; 47 | padding-top: var(--dl-space-space-unit); 48 | border-color: var(--dl-color-gray-black); 49 | border-width: 1px; 50 | padding-left: var(--dl-space-space-oneandhalfunits); 51 | border-radius: 0px; 52 | padding-right: var(--dl-space-space-oneandhalfunits); 53 | padding-bottom: var(--dl-space-space-unit); 54 | background-color: rgb(255, 207, 119); 55 | } 56 | .button:hover { 57 | opacity: 0.5; 58 | } 59 | .input { 60 | color: var(--dl-color-gray-black); 61 | cursor: auto; 62 | padding: 0.5rem 1rem; 63 | border-color: var(--dl-color-gray-black); 64 | border-width: 1px; 65 | border-radius: 4px; 66 | background-color: var(--dl-color-gray-white); 67 | } 68 | .textarea { 69 | color: var(--dl-color-gray-black); 70 | cursor: auto; 71 | padding: 0.5rem; 72 | border-color: var(--dl-color-gray-black); 73 | border-width: 1px; 74 | border-radius: 4px; 75 | background-color: var(--dl-color-gray-white); 76 | } 77 | .list { 78 | width: 100%; 79 | margin: 1em 0px 1em 0px; 80 | display: block; 81 | padding: 0px 0px 0px 1.5rem; 82 | list-style-type: none; 83 | list-style-position: outside; 84 | } 85 | .list-item { 86 | display: list-item; 87 | } 88 | .teleport-show { 89 | display: flex !important; 90 | transform: none !important; 91 | } 92 | .social { 93 | width: 20px; 94 | display: flex; 95 | padding: 0px; 96 | box-shadow: none; 97 | align-items: center; 98 | border-width: 0px; 99 | border-radius: 0px; 100 | flex-direction: row; 101 | justify-content: center; 102 | background-color: transparent; 103 | } 104 | .button-clean { 105 | border: none; 106 | padding: 0px; 107 | box-shadow: none; 108 | padding-top: 0px; 109 | padding-left: 0px; 110 | padding-right: 0px; 111 | padding-bottom: 0px; 112 | background-color: transparent; 113 | } 114 | .button-link { 115 | color: rgb(255, 255, 255); 116 | display: flex; 117 | font-size: 24px; 118 | box-shadow: none; 119 | font-style: normal; 120 | align-items: center; 121 | font-weight: 400; 122 | line-height: 36px; 123 | padding-top: var(--dl-space-space-threeunits); 124 | border-color: rgba(255, 255, 255, 0.3); 125 | border-width: 0px; 126 | padding-left: 0px; 127 | padding-right: 0px; 128 | flex-direction: row; 129 | padding-bottom: var(--dl-space-space-threeunits); 130 | justify-content: space-between; 131 | text-decoration: none; 132 | background-color: transparent; 133 | border-top-width: 1px; 134 | border-bottom-width: 1px; 135 | } 136 | .accordion { 137 | color: rgba(255, 255, 255, 0.6); 138 | width: 100%; 139 | cursor: pointer; 140 | display: flex; 141 | align-items: center; 142 | padding-top: var(--dl-space-space-twounits); 143 | border-color: rgba(255, 255, 255, 0.2); 144 | flex-direction: row; 145 | padding-bottom: var(--dl-space-space-twounits); 146 | justify-content: space-between; 147 | border-bottom-width: 1px; 148 | } 149 | .accordion:hover { 150 | color: white; 151 | border-color: white; 152 | } 153 | .Heading { 154 | font-size: 32px; 155 | font-family: Inter; 156 | font-weight: 700; 157 | line-height: 1.15; 158 | text-transform: none; 159 | text-decoration: none; 160 | } 161 | .Content { 162 | font-size: 16px; 163 | font-family: Inter; 164 | font-weight: 400; 165 | line-height: 1.15; 166 | text-transform: none; 167 | text-decoration: none; 168 | } 169 | 170 | @media(max-width: 767px) { 171 | .button-link { 172 | padding-top: var(--dl-space-space-oneandhalfunits); 173 | padding-bottom: var(--dl-space-space-oneandhalfunits); 174 | } 175 | } 176 | @media(max-width: 479px) { 177 | .accordion { 178 | padding-top: var(--dl-space-space-oneandhalfunits); 179 | padding-bottom: var(--dl-space-space-oneandhalfunits); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /srcs/requirements/static-web/tools/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mkdir -p /var/www/html 3 | rm -rf /var/www/html/web-404 /var/www/html/web-500 /var/www/html/web-subdomain 4 | ls /home 5 | cp -r /home/* /var/www/html/ 6 | -------------------------------------------------------------------------------- /srcs/requirements/wordpress/Dockerfile: -------------------------------------------------------------------------------- 1 | # SPECIFIE LA DISTRIBUTION 2 | FROM debian:buster 3 | RUN apt-get update && apt-get upgrade -y 4 | 5 | # UDPATE & INSTALLATION 6 | RUN apt install unzip php curl wget redis php-redis php-mysqli php-fpm php-cgi php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y 7 | RUN apt install default-mysql-client -y 8 | COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/ 9 | RUN mkdir /run/php 10 | 11 | # FOR DEBUGIN 12 | RUN apt install iputils-ping -y 13 | RUN apt install vim -y 14 | 15 | 16 | # FOR WORDPRESS 17 | COPY ./tools/install.sh /home/ 18 | RUN chmod 777 /home/install.sh 19 | 20 | EXPOSE 9000 21 | 22 | ENTRYPOINT ["/home/install.sh" ] 23 | -------------------------------------------------------------------------------- /srcs/requirements/wordpress/conf/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can be used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'access.log' 9 | ; - 'slowlog' 10 | ; - 'listen' (unixsocket) 11 | ; - 'chroot' 12 | ; - 'chdir' 13 | ; - 'php_values' 14 | ; - 'php_admin_values' 15 | ; When not set, the global prefix (or /usr) applies instead. 16 | ; Note: This directive can also be relative to the global prefix. 17 | ; Default Value: none 18 | ;prefix = /path/to/pools/$pool 19 | 20 | ; Unix user/group of processes 21 | ; Note: The user is mandatory. If the group is not set, the default user's group 22 | ; will be used. 23 | user = www-data 24 | group = www-data 25 | 26 | ; The address on which to accept FastCGI requests. 27 | ; Valid syntaxes are: 28 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 29 | ; a specific port; 30 | ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 31 | ; a specific port; 32 | ; 'port' - to listen on a TCP socket to all addresses 33 | ; (IPv6 and IPv4-mapped) on a specific port; 34 | ; '/path/to/unix/socket' - to listen on a unix socket. 35 | ; Note: This value is mandatory. 36 | listen = 9000 37 | 38 | ; Set listen(2) backlog. 39 | ; Default Value: 511 (-1 on FreeBSD and OpenBSD) 40 | ;listen.backlog = 511 41 | 42 | ; Set permissions for unix socket, if one is used. In Linux, read/write 43 | ; permissions must be set in order to allow connections from a web server. Many 44 | ; BSD-derived systems allow connections regardless of permissions. The owner 45 | ; and group can be specified either by name or by their numeric IDs. 46 | ; Default Values: user and group are set as the running user 47 | ; mode is set to 0660 48 | listen.owner = www-data 49 | listen.group = www-data 50 | ;listen.mode = 0660 51 | ; When POSIX Access Control Lists are supported you can set them using 52 | ; these options, value is a comma separated list of user/group names. 53 | ; When set, listen.owner and listen.group are ignored 54 | ;listen.acl_users = 55 | ;listen.acl_groups = 56 | 57 | ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. 58 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 59 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 60 | ; must be separated by a comma. If this value is left blank, connections will be 61 | ; accepted from any ip address. 62 | ; Default Value: any 63 | ;listen.allowed_clients = 127.0.0.1 64 | 65 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 66 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 67 | ; Note: - It will only work if the FPM master process is launched as root 68 | ; - The pool processes will inherit the master process priority 69 | ; unless it specified otherwise 70 | ; Default Value: no set 71 | ; process.priority = -19 72 | 73 | ; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user 74 | ; or group is differrent than the master process user. It allows to create process 75 | ; core dump and ptrace the process for the pool user. 76 | ; Default Value: no 77 | ; process.dumpable = yes 78 | 79 | ; Choose how the process manager will control the number of child processes. 80 | ; Possible Values: 81 | ; static - a fixed number (pm.max_children) of child processes; 82 | ; dynamic - the number of child processes are set dynamically based on the 83 | ; following directives. With this process management, there will be 84 | ; always at least 1 children. 85 | ; pm.max_children - the maximum number of children that can 86 | ; be alive at the same time. 87 | ; pm.start_servers - the number of children created on startup. 88 | ; pm.min_spare_servers - the minimum number of children in 'idle' 89 | ; state (waiting to process). If the number 90 | ; of 'idle' processes is less than this 91 | ; number then some children will be created. 92 | ; pm.max_spare_servers - the maximum number of children in 'idle' 93 | ; state (waiting to process). If the number 94 | ; of 'idle' processes is greater than this 95 | ; number then some children will be killed. 96 | ; ondemand - no children are created at startup. Children will be forked when 97 | ; new requests will connect. The following parameter are used: 98 | ; pm.max_children - the maximum number of children that 99 | ; can be alive at the same time. 100 | ; pm.process_idle_timeout - The number of seconds after which 101 | ; an idle process will be killed. 102 | ; Note: This value is mandatory. 103 | pm = dynamic 104 | 105 | ; The number of child processes to be created when pm is set to 'static' and the 106 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 107 | ; This value sets the limit on the number of simultaneous requests that will be 108 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 109 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 110 | ; CGI. The below defaults are based on a server without much resources. Don't 111 | ; forget to tweak pm.* to fit your needs. 112 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 113 | ; Note: This value is mandatory. 114 | pm.max_children = 5 115 | 116 | ; The number of child processes created on startup. 117 | ; Note: Used only when pm is set to 'dynamic' 118 | ; Default Value: (min_spare_servers + max_spare_servers) / 2 119 | pm.start_servers = 2 120 | 121 | ; The desired minimum number of idle server processes. 122 | ; Note: Used only when pm is set to 'dynamic' 123 | ; Note: Mandatory when pm is set to 'dynamic' 124 | pm.min_spare_servers = 1 125 | 126 | ; The desired maximum number of idle server processes. 127 | ; Note: Used only when pm is set to 'dynamic' 128 | ; Note: Mandatory when pm is set to 'dynamic' 129 | pm.max_spare_servers = 3 130 | 131 | ; The number of seconds after which an idle process will be killed. 132 | ; Note: Used only when pm is set to 'ondemand' 133 | ; Default Value: 10s 134 | ;pm.process_idle_timeout = 10s; 135 | 136 | ; The number of requests each child process should execute before respawning. 137 | ; This can be useful to work around memory leaks in 3rd party libraries. For 138 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 139 | ; Default Value: 0 140 | ;pm.max_requests = 500 141 | 142 | ; The URI to view the FPM status page. If this value is not set, no URI will be 143 | ; recognized as a status page. It shows the following informations: 144 | ; pool - the name of the pool; 145 | ; process manager - static, dynamic or ondemand; 146 | ; start time - the date and time FPM has started; 147 | ; start since - number of seconds since FPM has started; 148 | ; accepted conn - the number of request accepted by the pool; 149 | ; listen queue - the number of request in the queue of pending 150 | ; connections (see backlog in listen(2)); 151 | ; max listen queue - the maximum number of requests in the queue 152 | ; of pending connections since FPM has started; 153 | ; listen queue len - the size of the socket queue of pending connections; 154 | ; idle processes - the number of idle processes; 155 | ; active processes - the number of active processes; 156 | ; total processes - the number of idle + active processes; 157 | ; max active processes - the maximum number of active processes since FPM 158 | ; has started; 159 | ; max children reached - number of times, the process limit has been reached, 160 | ; when pm tries to start more children (works only for 161 | ; pm 'dynamic' and 'ondemand'); 162 | ; Value are updated in real time. 163 | ; Example output: 164 | ; pool: www 165 | ; process manager: static 166 | ; start time: 01/Jul/2011:17:53:49 +0200 167 | ; start since: 62636 168 | ; accepted conn: 190460 169 | ; listen queue: 0 170 | ; max listen queue: 1 171 | ; listen queue len: 42 172 | ; idle processes: 4 173 | ; active processes: 11 174 | ; total processes: 15 175 | ; max active processes: 12 176 | ; max children reached: 0 177 | ; 178 | ; By default the status page output is formatted as text/plain. Passing either 179 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 180 | ; output syntax. Example: 181 | ; http://www.foo.bar/status 182 | ; http://www.foo.bar/status?json 183 | ; http://www.foo.bar/status?html 184 | ; http://www.foo.bar/status?xml 185 | ; 186 | ; By default the status page only outputs short status. Passing 'full' in the 187 | ; query string will also return status for each pool process. 188 | ; Example: 189 | ; http://www.foo.bar/status?full 190 | ; http://www.foo.bar/status?json&full 191 | ; http://www.foo.bar/status?html&full 192 | ; http://www.foo.bar/status?xml&full 193 | ; The Full status returns for each process: 194 | ; pid - the PID of the process; 195 | ; state - the state of the process (Idle, Running, ...); 196 | ; start time - the date and time the process has started; 197 | ; start since - the number of seconds since the process has started; 198 | ; requests - the number of requests the process has served; 199 | ; request duration - the duration in µs of the requests; 200 | ; request method - the request method (GET, POST, ...); 201 | ; request URI - the request URI with the query string; 202 | ; content length - the content length of the request (only with POST); 203 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 204 | ; script - the main script called (or '-' if not set); 205 | ; last request cpu - the %cpu the last request consumed 206 | ; it's always 0 if the process is not in Idle state 207 | ; because CPU calculation is done when the request 208 | ; processing has terminated; 209 | ; last request memory - the max amount of memory the last request consumed 210 | ; it's always 0 if the process is not in Idle state 211 | ; because memory calculation is done when the request 212 | ; processing has terminated; 213 | ; If the process is in Idle state, then informations are related to the 214 | ; last request the process has served. Otherwise informations are related to 215 | ; the current request being served. 216 | ; Example output: 217 | ; ************************ 218 | ; pid: 31330 219 | ; state: Running 220 | ; start time: 01/Jul/2011:17:53:49 +0200 221 | ; start since: 63087 222 | ; requests: 12808 223 | ; request duration: 1250261 224 | ; request method: GET 225 | ; request URI: /test_mem.php?N=10000 226 | ; content length: 0 227 | ; user: - 228 | ; script: /home/fat/web/docs/php/test_mem.php 229 | ; last request cpu: 0.00 230 | ; last request memory: 0 231 | ; 232 | ; Note: There is a real-time FPM status monitoring sample web page available 233 | ; It's available in: /usr/share/php/7.4/fpm/status.html 234 | ; 235 | ; Note: The value must start with a leading slash (/). The value can be 236 | ; anything, but it may not be a good idea to use the .php extension or it 237 | ; may conflict with a real PHP file. 238 | ; Default Value: not set 239 | ;pm.status_path = /status 240 | 241 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 242 | ; URI will be recognized as a ping page. This could be used to test from outside 243 | ; that FPM is alive and responding, or to 244 | ; - create a graph of FPM availability (rrd or such); 245 | ; - remove a server from a group if it is not responding (load balancing); 246 | ; - trigger alerts for the operating team (24/7). 247 | ; Note: The value must start with a leading slash (/). The value can be 248 | ; anything, but it may not be a good idea to use the .php extension or it 249 | ; may conflict with a real PHP file. 250 | ; Default Value: not set 251 | ;ping.path = /ping 252 | 253 | ; This directive may be used to customize the response of a ping request. The 254 | ; response is formatted as text/plain with a 200 response code. 255 | ; Default Value: pong 256 | ;ping.response = pong 257 | 258 | ; The access log file 259 | ; Default: not set 260 | ;access.log = log/$pool.access.log 261 | 262 | ; The access log format. 263 | ; The following syntax is allowed 264 | ; %%: the '%' character 265 | ; %C: %CPU used by the request 266 | ; it can accept the following format: 267 | ; - %{user}C for user CPU only 268 | ; - %{system}C for system CPU only 269 | ; - %{total}C for user + system CPU (default) 270 | ; %d: time taken to serve the request 271 | ; it can accept the following format: 272 | ; - %{seconds}d (default) 273 | ; - %{miliseconds}d 274 | ; - %{mili}d 275 | ; - %{microseconds}d 276 | ; - %{micro}d 277 | ; %e: an environment variable (same as $_ENV or $_SERVER) 278 | ; it must be associated with embraces to specify the name of the env 279 | ; variable. Some exemples: 280 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 281 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 282 | ; %f: script filename 283 | ; %l: content-length of the request (for POST request only) 284 | ; %m: request method 285 | ; %M: peak of memory allocated by PHP 286 | ; it can accept the following format: 287 | ; - %{bytes}M (default) 288 | ; - %{kilobytes}M 289 | ; - %{kilo}M 290 | ; - %{megabytes}M 291 | ; - %{mega}M 292 | ; %n: pool name 293 | ; %o: output header 294 | ; it must be associated with embraces to specify the name of the header: 295 | ; - %{Content-Type}o 296 | ; - %{X-Powered-By}o 297 | ; - %{Transfert-Encoding}o 298 | ; - .... 299 | ; %p: PID of the child that serviced the request 300 | ; %P: PID of the parent of the child that serviced the request 301 | ; %q: the query string 302 | ; %Q: the '?' character if query string exists 303 | ; %r: the request URI (without the query string, see %q and %Q) 304 | ; %R: remote IP address 305 | ; %s: status (response code) 306 | ; %t: server time the request was received 307 | ; it can accept a strftime(3) format: 308 | ; %d/%b/%Y:%H:%M:%S %z (default) 309 | ; The strftime(3) format must be encapsuled in a %{}t tag 310 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 311 | ; %T: time the log has been written (the request has finished) 312 | ; it can accept a strftime(3) format: 313 | ; %d/%b/%Y:%H:%M:%S %z (default) 314 | ; The strftime(3) format must be encapsuled in a %{}t tag 315 | ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 316 | ; %u: remote user 317 | ; 318 | ; Default: "%R - %u %t \"%m %r\" %s" 319 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" 320 | 321 | ; The log file for slow requests 322 | ; Default Value: not set 323 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 324 | ;slowlog = log/$pool.log.slow 325 | 326 | ; The timeout for serving a single request after which a PHP backtrace will be 327 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 328 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 329 | ; Default Value: 0 330 | ;request_slowlog_timeout = 0 331 | 332 | ; Depth of slow log stack trace. 333 | ; Default Value: 20 334 | ;request_slowlog_trace_depth = 20 335 | 336 | ; The timeout for serving a single request after which the worker process will 337 | ; be killed. This option should be used when the 'max_execution_time' ini option 338 | ; does not stop script execution for some reason. A value of '0' means 'off'. 339 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 340 | ; Default Value: 0 341 | ;request_terminate_timeout = 0 342 | 343 | ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 344 | ; application calls 'fastcgi_finish_request' or when application has finished and 345 | ; shutdown functions are being called (registered via register_shutdown_function). 346 | ; This option will enable timeout limit to be applied unconditionally 347 | ; even in such cases. 348 | ; Default Value: no 349 | ;request_terminate_timeout_track_finished = no 350 | 351 | ; Set open file descriptor rlimit. 352 | ; Default Value: system defined value 353 | ;rlimit_files = 1024 354 | 355 | ; Set max core size rlimit. 356 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 357 | ; Default Value: system defined value 358 | ;rlimit_core = 0 359 | 360 | ; Chroot to this directory at the start. This value must be defined as an 361 | ; absolute path. When this value is not set, chroot is not used. 362 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 363 | ; of its subdirectories. If the pool prefix is not set, the global prefix 364 | ; will be used instead. 365 | ; Note: chrooting is a great security feature and should be used whenever 366 | ; possible. However, all PHP paths will be relative to the chroot 367 | ; (error_log, sessions.save_path, ...). 368 | ; Default Value: not set 369 | ;chroot = 370 | 371 | ; Chdir to this directory at the start. 372 | ; Note: relative path can be used. 373 | ; Default Value: current directory or / when chroot 374 | ;chdir = /var/www 375 | 376 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 377 | ; stderr will be redirected to /dev/null according to FastCGI specs. 378 | ; Note: on highloaded environement, this can cause some delay in the page 379 | ; process time (several ms). 380 | ; Default Value: no 381 | ;catch_workers_output = yes 382 | 383 | ; Decorate worker output with prefix and suffix containing information about 384 | ; the child that writes to the log and if stdout or stderr is used as well as 385 | ; log level and time. This options is used only if catch_workers_output is yes. 386 | ; Settings to "no" will output data as written to the stdout or stderr. 387 | ; Default value: yes 388 | ;decorate_workers_output = no 389 | 390 | ; Clear environment in FPM workers 391 | ; Prevents arbitrary environment variables from reaching FPM worker processes 392 | ; by clearing the environment in workers before env vars specified in this 393 | ; pool configuration are added. 394 | ; Setting to "no" will make all environment variables available to PHP code 395 | ; via getenv(), $_ENV and $_SERVER. 396 | ; Default Value: yes 397 | ;clear_env = no 398 | 399 | ; Limits the extensions of the main script FPM will allow to parse. This can 400 | ; prevent configuration mistakes on the web server side. You should only limit 401 | ; FPM to .php extensions to prevent malicious users to use other extensions to 402 | ; execute php code. 403 | ; Note: set an empty value to allow all extensions. 404 | ; Default Value: .php 405 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 406 | 407 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 408 | ; the current environment. 409 | ; Default Value: clean env 410 | ;env[HOSTNAME] = $HOSTNAME 411 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 412 | ;env[TMP] = /tmp 413 | ;env[TMPDIR] = /tmp 414 | ;env[TEMP] = /tmp 415 | 416 | ; Additional php.ini defines, specific to this pool of workers. These settings 417 | ; overwrite the values previously defined in the php.ini. The directives are the 418 | ; same as the PHP SAPI: 419 | ; php_value/php_flag - you can set classic ini defines which can 420 | ; be overwritten from PHP call 'ini_set'. 421 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 422 | ; PHP call 'ini_set' 423 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 424 | 425 | ; Defining 'extension' will load the corresponding shared extension from 426 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 427 | ; overwrite previously defined php.ini values, but will append the new value 428 | ; instead. 429 | 430 | ; Note: path INI options can be relative and will be expanded with the prefix 431 | ; (pool, global or /usr) 432 | 433 | ; Default Value: nothing is defined by default except the values in php.ini and 434 | ; specified at startup with the -d argument 435 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 436 | ;php_flag[display_errors] = off 437 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 438 | ;php_admin_flag[log_errors] = on 439 | ;php_admin_value[memory_limit] = 32M -------------------------------------------------------------------------------- /srcs/requirements/wordpress/tools/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | FILE=wordpress 3 | cd /var/www/html 4 | 5 | if [ -d "$FILE" ]; then 6 | echo "$FILE exists." 7 | else 8 | echo "$FILE not exists." 9 | mkdir -p wordpress 10 | cd wordpress 11 | 12 | curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar 13 | php wp-cli.phar --info 14 | chmod +x wp-cli.phar 15 | mv wp-cli.phar /usr/local/bin/wp 16 | wp core download --allow-root 17 | 18 | sleep 5 19 | wp config create --dbname=$BDD_NAME --dbuser=$BDD_USER --dbpass=$BDD_USER_PASSWORD --dbhost=$BDD_HOST --allow-root 20 | sleep 5 21 | 22 | wp core install --url=tliot.42.fr --title=INCEPTION --admin_user=$WP_ADMIN_USER --admin_password=$WP_ADMIN_PASSWORD --admin_email=$WP_ADMIN_EMAIL --allow-root 23 | wp user create $WP_USER $WP_USER_EMAIL --user_pass=$WP_USER_PASSWORD --role=$WP_USER_ROLE --porcelain --allow-root 24 | wp theme install neve --activate --allow-root 25 | 26 | wp config set WP_REDIS_HOST redis --add --allow-root 27 | wp config set WP_REDIS_PORT 6379 --add --allow-root 28 | wp config set WP_CACHE true --add --allow-root 29 | wp plugin install redis-cache --activate --allow-root 30 | wp plugin update --all --allow-root 31 | wp redis enable --allow-root 32 | echo "END" 33 | fi 34 | 35 | /usr/sbin/php-fpm7.3 -F --------------------------------------------------------------------------------