build from inception
This commit is contained in:
51
.gitignore
vendored
Normal file
51
.gitignore
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# These are some examples of commonly ignored file patterns.
|
||||||
|
# You should customize this list as applicable to your project.
|
||||||
|
# Learn more about .gitignore:
|
||||||
|
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
||||||
|
|
||||||
|
# Node artifact files
|
||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Compiled Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Compiled Python bytecode
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Package files
|
||||||
|
*.jar
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# JetBrains IDE
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Unit test reports
|
||||||
|
TEST*.xml
|
||||||
|
|
||||||
|
# Generated by MacOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Generated by Windows
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Applications
|
||||||
|
*.app
|
||||||
|
*.exe
|
||||||
|
*.war
|
||||||
|
|
||||||
|
# Large media files
|
||||||
|
*.mp4
|
||||||
|
*.tiff
|
||||||
|
*.avi
|
||||||
|
*.flv
|
||||||
|
*.mov
|
||||||
|
*.wmv
|
||||||
|
*.iso
|
||||||
|
|
||||||
93
Makefile
Normal file
93
Makefile
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
|
||||||
|
GRAY = "\e[0;30m"
|
||||||
|
RED = "\e[0;31m"
|
||||||
|
GREEN = "\e[0;32m"
|
||||||
|
YELLOW = "\e[0;33m"
|
||||||
|
BLUE = "\e[0;34m"
|
||||||
|
PURPLE = "\e[0;35m"
|
||||||
|
CYAN = "\e[0;36m"
|
||||||
|
WHITE = "\e[0;37m"
|
||||||
|
|
||||||
|
B_GRAY = "\e[1;30m"
|
||||||
|
B_RED = "\e[1;31m"
|
||||||
|
B_GREEN = "\e[1;32m"
|
||||||
|
B_YELLOW = "\e[1;33m"
|
||||||
|
B_BLUE = "\e[1;34m"
|
||||||
|
B_PURPLE = "\e[1;35m"
|
||||||
|
B_CYAN = "\e[1;36m"
|
||||||
|
B_WHITE = "\e[1;37m"
|
||||||
|
|
||||||
|
RESET = "\e[0m"
|
||||||
|
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
|
COMPOSE = ./srcs/docker-compose.yml
|
||||||
|
|
||||||
|
# same as 'LOGIN' var in .env file
|
||||||
|
#V_USER = hulamy
|
||||||
|
#V_USER = $(shell echo $(USER)) # gives root when make is run with sudo
|
||||||
|
#V_USER = $(shell who | head -1 | tr " " "\n" | head -1) # gives bad result when in `sudo su`
|
||||||
|
#V_USER = $(shell who | head -1 | cut -d " " -f 1) # gives bad result when in `sudo su`
|
||||||
|
V_USER = $(shell users | tr " " "\n" | head -1)
|
||||||
|
VOLUMES_D = /home/$(V_USER)/data/wp_volume \
|
||||||
|
/home/$(V_USER)/data/db_volume
|
||||||
|
WP_URL = $(shell grep "WP_URL" ./srcs/.env | cut -d "=" -f 2)
|
||||||
|
|
||||||
|
# list of running containers, see : https://stackoverflow.com/questions/10024279/how-to-use-shell-commands-in-makefile
|
||||||
|
RUNNING = $(shell docker ps -q)
|
||||||
|
# list of volumes
|
||||||
|
VOLUMES = $(shell docker volume ls -q)
|
||||||
|
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
|
all: build up
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
sed -i "s/^LOGIN=.*/LOGIN=$(V_USER)/g" ./srcs/.env
|
||||||
|
mkdir -p $(VOLUMES_D)
|
||||||
|
|
||||||
|
build:
|
||||||
|
- bash -c 'echo -e "\n# adding for inception (you can delete it)\n127.0.0.1 $(WP_URL)" >> /etc/hosts'
|
||||||
|
docker-compose -f $(COMPOSE) build
|
||||||
|
|
||||||
|
up: volumes
|
||||||
|
docker-compose -f $(COMPOSE) up -d
|
||||||
|
|
||||||
|
down:
|
||||||
|
docker-compose -f $(COMPOSE) down
|
||||||
|
|
||||||
|
# list images, containers, volumes
|
||||||
|
list:
|
||||||
|
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
||||||
|
@docker images -a
|
||||||
|
@echo $(B_YELLOW)"\nvolumes:"$(RESET)
|
||||||
|
@docker volume ls
|
||||||
|
@echo $(B_YELLOW)"\nvolumes content:"$(RESET)
|
||||||
|
- @ls $(VOLUMES_D)
|
||||||
|
@echo $(B_YELLOW)"\nnetworks:"$(RESET)
|
||||||
|
@docker network ls
|
||||||
|
@echo $(B_YELLOW)"\ncontainers:"$(RESET)
|
||||||
|
@docker ps -a
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
# remove project images and containers not used
|
||||||
|
clean:
|
||||||
|
- docker stop $(RUNNING)
|
||||||
|
docker network prune -f
|
||||||
|
docker system prune -f
|
||||||
|
|
||||||
|
# remove everything
|
||||||
|
fclean-images: clean
|
||||||
|
- docker stop $(RUNNING)
|
||||||
|
docker system prune -af
|
||||||
|
fclean-volumes: clean
|
||||||
|
- docker volume rm $(VOLUMES)
|
||||||
|
- rm -rf $(VOLUMES_D)
|
||||||
|
fclean: fclean-images fclean-volumes
|
||||||
|
|
||||||
|
re: fclean all
|
||||||
|
|
||||||
|
.PHONY : all $(VOLUMES_D) build up list clean fclean re
|
||||||
|
|
||||||
216
README.md
Normal file
216
README.md
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
|
||||||
|
# inception
|
||||||
|
|
||||||
|
- change host file in virtual machine to connect to hulamy.42.fr instead of localhost
|
||||||
|
- need to put the virtual machine on sgoinfre/goinfre/user/hulamy
|
||||||
|
|
||||||
|
---
|
||||||
|
## questions
|
||||||
|
|
||||||
|
- ? will healthcheck continue after success, every 1 secondes ?
|
||||||
|
- ? why http to https redirection doesn't works ?
|
||||||
|
|
||||||
|
---
|
||||||
|
#### docker :
|
||||||
|
- [docker compose man](https://docs.docker.com/compose/compose-file/#volumes)
|
||||||
|
- [Dockerfile man](https://docs.docker.com/engine/reference/builder/)
|
||||||
|
- [determine the parent image](https://forums.docker.com/t/determine-the-parent-image/48611)
|
||||||
|
- [docker image from scratch](https://codeburst.io/docker-from-scratch-2a84552470c8)
|
||||||
|
- [build context and image context](https://stackoverflow.com/questions/55108649/what-is-app-working-directory-for-a-dockerfile/55109065#55109065)
|
||||||
|
- [run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||||
|
- [run docker deamon rootless](https://docs.docker.com/engine/security/rootless/)
|
||||||
|
- [dangling images '<none>'](https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/)
|
||||||
|
- [go inside docker to debug it](https://docs.docker.com/engine/reference/commandline/container_exec/)
|
||||||
|
- [docker debug image with "docker run -it"](https://blog.devgenius.io/how-to-debug-docker-build-6c2588401188)
|
||||||
|
- `docker exec -ti <container-name> bash` to run bash inside a running container
|
||||||
|
- [docker CMD vs ENTRYPOINT](https://phoenixnap.com/kb/docker-cmd-vs-entrypoint)
|
||||||
|
- [use env variable with compose](https://docs.docker.com/compose/environment-variables/)
|
||||||
|
- [using DEBIAN_FRONTEND=noninteractive disouraged in dockerfile](https://bobcares.com/blog/debian_frontendnoninteractive-docker/)
|
||||||
|
- [docker network](https://docs.docker.com/network/)
|
||||||
|
- [depends_on](https://docs.docker.com/compose/compose-file/#depends_on)
|
||||||
|
- [compose and env var](https://docs.docker.com/compose/environment-variables/)
|
||||||
|
- [specify path to named volumes](https://docs.docker.com/compose/compose-file/#volumes-top-level-element)
|
||||||
|
- [pass secret to container](https://medium.com/@zdk/simple-and-secure-way-to-pass-secrets-and-credentials-into-docker-containers-c2f66175b0a4)
|
||||||
|
|
||||||
|
###### Docker basics
|
||||||
|
- the container posess its own filesystem
|
||||||
|
- we need to copy the files it uses inside this filesystem
|
||||||
|
- we can do that with COPY
|
||||||
|
|
||||||
|
###### build and run a docker image
|
||||||
|
- `sudo docker build --tag <name> .`
|
||||||
|
- `sudo docker run <name>`
|
||||||
|
- `sudo docker images` to list docker images
|
||||||
|
- `sudo docker image rm <number>`
|
||||||
|
- `sudo docker ps` to list docker processes
|
||||||
|
- `sudo docker ps rm <name>`
|
||||||
|
|
||||||
|
###### execute a docker-compose file
|
||||||
|
- `sudo docker-compose up`
|
||||||
|
- or `sudo docker-compose -f ./path up` to specify a path
|
||||||
|
|
||||||
|
###### docker pid 1
|
||||||
|
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
|
||||||
|
- when the first process of a docker container exit, the container exit (doc ?)
|
||||||
|
- so we must tell nginx to not go background : "-g 'daemon off'"
|
||||||
|
- [pid1 docker problem](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/)
|
||||||
|
- [official nginx docker image](https://hub.docker.com/_/nginx/)
|
||||||
|
- "If you add a custom CMD in the Dockerfile, be sure to include -g daemon off; in the CMD in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!"
|
||||||
|
- [SO discussion on "-g 'daemon off'"](https://stackoverflow.com/questions/18861300/how-to-run-nginx-within-a-docker-container-without-halting)
|
||||||
|
- "When PID 1 exits, the container will exit" (where is says in the doc ?)
|
||||||
|
- ["By design, containers started in detached mode exit when the root process used to run the container exits"](https://docs.docker.com/engine/reference/run/#detached--d)
|
||||||
|
|
||||||
|
###### install and use docker and compose
|
||||||
|
- [how to install docker engine](https://docs.docker.com/engine/install/ubuntu/)
|
||||||
|
- [github releases](https://github.com/docker/compose/releases)
|
||||||
|
- [install last version of compose manually](https://docs.docker.com/compose/install/compose-plugin/#install-the-plugin-manually)
|
||||||
|
- [install manually SO discussion](https://stackoverflow.com/questions/57456212/error-version-in-docker-compose-yml-is-unsupported)
|
||||||
|
- [correct release version name for download with a 'v'](https://stackoverflow.com/questions/58747879/docker-compose-usr-local-bin-docker-compose-line-1-not-command-not-found)
|
||||||
|
- the version installed with apt is 1.17.1, way out of date
|
||||||
|
|
||||||
|
###### remove old versions
|
||||||
|
- `sudo apt remove docker docker-engine docker.io containerd runc`
|
||||||
|
|
||||||
|
###### preparing directory
|
||||||
|
- `sudo apt update`
|
||||||
|
- `sudo apt install ca-certificates curl gnupg lsb-release`
|
||||||
|
- `sudo mkdir -p /etc/apt/keyrings`
|
||||||
|
- `curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg`
|
||||||
|
- `echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null`
|
||||||
|
|
||||||
|
###### installing docker engine
|
||||||
|
- `sudo apt update`
|
||||||
|
- `sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin`
|
||||||
|
|
||||||
|
###### check if installation worked
|
||||||
|
- `sudo docker run hello-world`
|
||||||
|
|
||||||
|
###### installing docker compose (checked version on github release, see above)
|
||||||
|
- notice the 'v' below, before the version name (docker doc has it wong)
|
||||||
|
- `sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose`
|
||||||
|
- `sudo chmod +x /usr/local/bin/docker-compose`
|
||||||
|
|
||||||
|
###### run docker without sudo on linux (https://docs.docker.com/engine/install/linux-postinstall/)
|
||||||
|
- `sudo groupadd docker`
|
||||||
|
- `sudo usermod -aG docker $USER`
|
||||||
|
- `newgrp docker`
|
||||||
|
|
||||||
|
###### volumes vs bind mounts :
|
||||||
|
- [docker doc: use volumes](https://docs.docker.com/storage/volumes/)
|
||||||
|
- [docker doc: use bind mounts](https://docs.docker.com/storage/bind-mounts/)
|
||||||
|
- [comparison volume vs bind mounts](https://devopscook.com/docker-volumes-vs-bind-mounts/)
|
||||||
|
- [fundamentals use of volumes and bind mounts](https://medium.com/dlt-labs-publication/bind-mounts-volumes-in-docker-81523303cbb4)
|
||||||
|
- [how volumes and bind mounts are really differents](https://serverfault.com/questions/996785/docker-volumes-vs-mount-binds-what-are-the-use-cases)
|
||||||
|
- bind mounts are normal files anywhere on the computer, that docker container can access with absolut path and modify. They can also be modified without docker, since they are juste files
|
||||||
|
- volumes are only modifiable by docker, they don't need an absolut path, and they are not dependent of host architecture
|
||||||
|
|
||||||
|
###### use password in container :
|
||||||
|
- [with env variables in compose](https://docs.docker.com/compose/environment-variables/)
|
||||||
|
- [it's not safe to use arg to pass secret, since they are available through "docker history"](https://docs.docker.com/engine/reference/builder/#arg)
|
||||||
|
- [better use docker build --secret tag](https://docs.docker.com/develop/develop-images/build_enhancements/#new-docker-build-secret-information)
|
||||||
|
- [so discussion](https://stackoverflow.com/questions/22651647/docker-and-securing-passwords)
|
||||||
|
- [engine ref secret](https://docs.docker.com/engine/reference/commandline/secret/)
|
||||||
|
- [compose secret](https://docs.docker.com/compose/compose-file/compose-file-v3/#secrets)
|
||||||
|
- [use secret with docker](https://www.rockyourcode.com/using-docker-secrets-with-docker-compose/)
|
||||||
|
- [use secret with docker SO](https://stackoverflow.com/questions/42139605/how-do-you-manage-secret-values-with-docker-compose-v3-1)
|
||||||
|
- [four ways to use secrets](https://blog.mikesir87.io/2017/05/using-docker-secrets-during-development/)
|
||||||
|
- it seems that using "secrets" only improve security for a swarm, when you must share your secrets with others, but if not the case, .env is as much secure ?
|
||||||
|
- to use secret in docker-compose, we need to use swarm, but it doesn't allow to use build, or up, so everything is different then and I don't have time to understand it fully
|
||||||
|
|
||||||
|
---
|
||||||
|
#### nginx
|
||||||
|
- [nginx begginer guide](https://hub.docker.com/_/nginx/)
|
||||||
|
- [nginx all directives for conf file](https://nginx.org/en/docs/dirindex.html)
|
||||||
|
- [conf file in conf.d or sites-available ?](https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx#answer-870709)
|
||||||
|
- [command line parameters](https://nginx.org/en/docs/switches.html)
|
||||||
|
- `sudo nginx -t` will launch a test to evaluate config file
|
||||||
|
- [configuring nginx with php-fpm](https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/#connecting-nginx-to-php-fpm)
|
||||||
|
- [configuring nginx with alpine](https://wiki.alpinelinux.org/wiki/Nginx)
|
||||||
|
|
||||||
|
###### nginx basics
|
||||||
|
- `sudo netstat -tulpn` to print network connections and see if nginx is running
|
||||||
|
- or : `ps -ax | grep nginx`
|
||||||
|
- `sudo nginx -s quit` to stop it
|
||||||
|
- `sudo docker system prune -af --volumes` -> `-a` also unused images, `-f` without prompt for confirmation
|
||||||
|
- remove stopped containers
|
||||||
|
- remove unused networks
|
||||||
|
- remove unused images
|
||||||
|
- remove build cache
|
||||||
|
- `sudo docker ps -q` all runnings containers
|
||||||
|
- `sudo docker stop $(sudo docker ps -q)` stop all runnings containers
|
||||||
|
|
||||||
|
---
|
||||||
|
#### openssl
|
||||||
|
- [openssl faq](https://www.openssl.org/docs/faq.html)
|
||||||
|
- [openssl req man](https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html)
|
||||||
|
- [SO discussion about ssl self signed certificate and becoming a CA](https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl)
|
||||||
|
|
||||||
|
---
|
||||||
|
#### mariadb
|
||||||
|
- [mariadb tutorial](https://www.mariadbtutorial.com/)
|
||||||
|
- server vs client :
|
||||||
|
- "server" runs in the background and listen for inputs
|
||||||
|
- "client" interpret the commands to communicate with "server"
|
||||||
|
- sudo apt install mariadb-client mariadb-server
|
||||||
|
- [wiki ubuntu mariadb](https://doc.ubuntu-fr.org/mariadb)
|
||||||
|
- [list of directives](https://mariadb.com/kb/en/sql-statements/)
|
||||||
|
- [ERROR 1698 (28000): Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost)
|
||||||
|
- [ERROR 1698 (28000): Access denied for user 'root'@'localhost' 2](https://askubuntu.com/questions/763336/cannot-enter-phpmyadmin-as-root-mysql-5-7#answer-1003892)
|
||||||
|
- [meaning of % SO](https://stackoverflow.com/questions/12931991/mysql-what-does-stand-for-in-host-column-and-how-to-change-users-password)
|
||||||
|
- [meaning of % doc](https://doc.ubuntu-fr.org/mysql#connexions_entrantes)
|
||||||
|
- `%` means all entrant connections, while `localhost` means only localhost connections
|
||||||
|
- [mysql commande line](https://mariadb.com/kb/en/mysql-command-line-client/)
|
||||||
|
- [use mysql in script](https://stackoverflow.com/questions/59608632/mariadb-create-database-and-execute-sql-script-without-character-from-the)
|
||||||
|
- [no need to use FLUSH PRIVILEGES after GRANT](https://stackoverflow.com/questions/36463966/mysql-when-is-flush-privileges-in-mysql-really-needed)
|
||||||
|
|
||||||
|
- [can't connect to local server through socket](]https://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysq#23485424)
|
||||||
|
```
|
||||||
|
Can't connect to local server through socket '/run/mysqld/mysqld.sock'
|
||||||
|
|
||||||
|
sudo / find -type s
|
||||||
|
/var/lib/mysql/mysql.sock
|
||||||
|
```
|
||||||
|
- [mysqld](https://dev.mysql.com/doc/refman/8.0/en/mysqld.html)
|
||||||
|
|
||||||
|
###### mariadb basic commands :
|
||||||
|
- create user :
|
||||||
|
```
|
||||||
|
# mysql -u root
|
||||||
|
use mysql;
|
||||||
|
CREATE USER 'some_user'@'%' IDENTIFIED BY 'some_pass';
|
||||||
|
GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'%' WITH GRANT OPTION;
|
||||||
|
```
|
||||||
|
- show users :
|
||||||
|
```
|
||||||
|
SELECT User, Host, plugin FROM mysql.user;
|
||||||
|
```
|
||||||
|
- delete user :
|
||||||
|
```
|
||||||
|
DROP USER <name>;
|
||||||
|
```
|
||||||
|
- show databases :
|
||||||
|
```
|
||||||
|
SHOW DATABASES;
|
||||||
|
```
|
||||||
|
- delete database :
|
||||||
|
```
|
||||||
|
DROP DATABASE <name>;
|
||||||
|
```
|
||||||
|
---
|
||||||
|
#### wordpress
|
||||||
|
- [install wp](https://wordpress.org/support/article/how-to-install-wordpress/#detailed-instructions)
|
||||||
|
|
||||||
|
###### install wp
|
||||||
|
- wget https://wordpress.org/latest.tar.gz
|
||||||
|
- tar -xzvf latest.tar.gz
|
||||||
|
|
||||||
|
- [php-fpm : Fastcgi Process Manager](https://en.wikipedia.org/wiki/FastCGI)
|
||||||
|
- [install wp-cli](https://wp-cli.org/#installing)
|
||||||
|
- [alternatives install](https://make.wordpress.org/cli/handbook/guides/installing/)
|
||||||
|
- [exemple install with composer](https://github.com/aestetype/alpine-wp-cli/blob/master/Dockerfile)
|
||||||
|
- [cli commands](https://developer.wordpress.org/cli/commands/)
|
||||||
|
- [cli install wordpress](https://make.wordpress.org/cli/handbook/how-to-install/)
|
||||||
|
- `/wp-admin`
|
||||||
|
- [alias localhost](https://stackoverflow.com/questions/19425086/alias-hostname-for-localhost)
|
||||||
|
- `sudo /etc/hosts` -> `127.0.0.1 hulamy.42.fr`
|
||||||
|
|
||||||
BIN
docs/inception_correction.png
Normal file
BIN
docs/inception_correction.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
BIN
docs/inception_en.subject.pdf
Normal file
BIN
docs/inception_en.subject.pdf
Normal file
Binary file not shown.
BIN
docs/inception_fr.subject.pdf
Normal file
BIN
docs/inception_fr.subject.pdf
Normal file
Binary file not shown.
26
srcs/.env
Normal file
26
srcs/.env
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
# DOCKER-COMPOSE
|
||||||
|
|
||||||
|
LOGIN=lenovo
|
||||||
|
|
||||||
|
# MARIADB SETUP
|
||||||
|
|
||||||
|
DB_HOST=mariadb
|
||||||
|
DB_NAME=db_wp_inception
|
||||||
|
DB_USER=user_wp_inception
|
||||||
|
DB_PSWD="too bad you have read this now i have to erase your memory"
|
||||||
|
|
||||||
|
# WORDPRESS SETUP
|
||||||
|
|
||||||
|
WP_URL=local_lejourduprof.com
|
||||||
|
WP_DIR=/var/www/html
|
||||||
|
WP_TITLE=title
|
||||||
|
|
||||||
|
WP_ADMIN=hulamy
|
||||||
|
WP_ADMIN_PSWD="you shall not password !"
|
||||||
|
WP_ADMIN_EMAIL=hulamy@42.fr
|
||||||
|
|
||||||
|
WP_USER=moehu36
|
||||||
|
WP_USER_PSWD="it's a secret for nobody"
|
||||||
|
WP_USER_EMAIL=moehu36@42.fr
|
||||||
|
|
||||||
96
srcs/docker-compose.yml
Normal file
96
srcs/docker-compose.yml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
# doc : https://docs.docker.com/compose/compose-file/compose-versioning/
|
||||||
|
# version : https://docs.docker.com/compose/compose-file/compose-versioning/
|
||||||
|
# version to download : https://github.com/docker/compose/releases/
|
||||||
|
# had to remove the apt version because it was not up to date (sudo apt remove docker-compose)
|
||||||
|
# then install as recommended : curl -SL https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
|
||||||
|
# or (neat) : https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
# ---------------------------------
|
||||||
|
# test:
|
||||||
|
# build:
|
||||||
|
# context: ./requirements/test
|
||||||
|
# dockerfile: Dockerfile
|
||||||
|
# image: test
|
||||||
|
# container_name: test_container
|
||||||
|
# ---------------------------------
|
||||||
|
nginx:
|
||||||
|
restart: on-failure
|
||||||
|
networks:
|
||||||
|
- inception
|
||||||
|
ports:
|
||||||
|
- "443:443"
|
||||||
|
#- "80:80"
|
||||||
|
volumes:
|
||||||
|
- wp_volume:/var/www/html
|
||||||
|
build:
|
||||||
|
context: ./requirements/nginx
|
||||||
|
args:
|
||||||
|
- WP_URL=${WP_URL}
|
||||||
|
image: nginx
|
||||||
|
container_name: nginx_container
|
||||||
|
depends_on:
|
||||||
|
wordpress:
|
||||||
|
condition: service_started
|
||||||
|
# ---------------------------------
|
||||||
|
mariadb:
|
||||||
|
restart: on-failure
|
||||||
|
env_file: .env
|
||||||
|
networks:
|
||||||
|
- inception
|
||||||
|
volumes:
|
||||||
|
- db_volume:/var/lib/mysql
|
||||||
|
build:
|
||||||
|
context: ./requirements/mariadb
|
||||||
|
args:
|
||||||
|
- DB_HOST=${DB_HOST}
|
||||||
|
- DB_NAME=${DB_NAME}
|
||||||
|
- DB_USER=${DB_USER}
|
||||||
|
- DB_PSWD=${DB_PSWD}
|
||||||
|
healthcheck:
|
||||||
|
test: mariadb -h ${DB_HOST} -u ${DB_USER} -p"${DB_PSWD}" -e exit 2> /dev/null
|
||||||
|
interval: 1s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
||||||
|
image: mariadb
|
||||||
|
container_name: mariadb_container
|
||||||
|
# ---------------------------------
|
||||||
|
wordpress:
|
||||||
|
restart: on-failure
|
||||||
|
env_file: ./.env
|
||||||
|
networks:
|
||||||
|
- inception
|
||||||
|
volumes:
|
||||||
|
- wp_volume:/var/www/html
|
||||||
|
build:
|
||||||
|
context: ./requirements/wordpress
|
||||||
|
args:
|
||||||
|
- WP_DIR=${WP_DIR}
|
||||||
|
image: wordpress
|
||||||
|
container_name: wordpress_container
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
# specify path to named volumes : https://docs.docker.com/compose/compose-file/compose-file-v3/#volume-configuration-reference
|
||||||
|
volumes:
|
||||||
|
wp_volume:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: /home/${LOGIN}/data/wp_volume
|
||||||
|
# device: ${HOME}/data/wp_volume
|
||||||
|
db_volume:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: /home/${LOGIN}/data/db_volume
|
||||||
|
# device: ${HOME}/data/db_volume
|
||||||
|
|
||||||
|
networks:
|
||||||
|
inception:
|
||||||
|
|
||||||
51
srcs/requirements/mariadb/Dockerfile
Normal file
51
srcs/requirements/mariadb/Dockerfile
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# debian -----------------------------------------------------
|
||||||
|
|
||||||
|
# FROM debian:buster
|
||||||
|
#
|
||||||
|
# # vim and bash for debug
|
||||||
|
# RUN apt update && apt install -y \
|
||||||
|
# mariadb-client \
|
||||||
|
# mariadb-server \
|
||||||
|
# vim bash \
|
||||||
|
# && \
|
||||||
|
# rm -rf /var/lib/apt/lists/*
|
||||||
|
#
|
||||||
|
# # config file .cnf :
|
||||||
|
# COPY ./conf/50-server.cnf.debian /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
|
|
||||||
|
# alpine -----------------------------------------------------
|
||||||
|
|
||||||
|
FROM alpine:3.15
|
||||||
|
|
||||||
|
# vim and bash for debug
|
||||||
|
RUN apk update && apk add \
|
||||||
|
mariadb \
|
||||||
|
mariadb-client \
|
||||||
|
vim bash \
|
||||||
|
&& \
|
||||||
|
rm -rf /var/cache/apk*
|
||||||
|
|
||||||
|
# config file .cnf :
|
||||||
|
COPY ./conf/mariadb-server.cnf.alpine /etc/my.cnf.d/mariadb-server.cnf
|
||||||
|
|
||||||
|
# common -----------------------------------------------------
|
||||||
|
|
||||||
|
ARG DB_HOST
|
||||||
|
ARG DB_NAME
|
||||||
|
ARG DB_USER
|
||||||
|
ARG DB_PSWD
|
||||||
|
|
||||||
|
# init mysql database
|
||||||
|
RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql && \
|
||||||
|
mkdir -p /var/run/mysqld && \
|
||||||
|
chown -R mysql:root /var/run/mysqld
|
||||||
|
|
||||||
|
# configure wp database
|
||||||
|
COPY ./conf/create_db.sql /usr/bin/create_db.sql
|
||||||
|
RUN sed -i "s/\${DB_HOST}/${DB_HOST}/g" /usr/bin/create_db.sql && \
|
||||||
|
sed -i "s/\${DB_NAME}/${DB_NAME}/g" /usr/bin/create_db.sql && \
|
||||||
|
sed -i "s/\${DB_USER}/${DB_USER}/g" /usr/bin/create_db.sql && \
|
||||||
|
sed -i "s/\${DB_PSWD}/${DB_PSWD}/g" /usr/bin/create_db.sql
|
||||||
|
|
||||||
|
ENTRYPOINT [ "mysqld", "--user=mysql", "--init-file=/usr/bin/create_db.sql" ]
|
||||||
|
|
||||||
142
srcs/requirements/mariadb/conf/50-server.cnf.debian
Normal file
142
srcs/requirements/mariadb/conf/50-server.cnf.debian
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# inception modifications :
|
||||||
|
#
|
||||||
|
# [mysqld] :
|
||||||
|
# < port = 3306
|
||||||
|
# > #port = 3306
|
||||||
|
# ---
|
||||||
|
# < #bind-address = 127.0.0.1
|
||||||
|
# > bind-address = 127.0.0.1
|
||||||
|
|
||||||
|
#
|
||||||
|
# These groups are read by MariaDB server.
|
||||||
|
# Use it for options that only the server (but not clients) should see
|
||||||
|
#
|
||||||
|
# See the examples of server my.cnf files in /usr/share/mysql
|
||||||
|
|
||||||
|
# this is read by the standalone daemon and embedded servers
|
||||||
|
[server]
|
||||||
|
|
||||||
|
# this is only for the mysqld standalone daemon
|
||||||
|
[mysqld]
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Basic Settings
|
||||||
|
#
|
||||||
|
user = mysql
|
||||||
|
pid-file = /var/run/mysqld/mysqld.pid
|
||||||
|
socket = /var/run/mysqld/mysqld.sock
|
||||||
|
port = 3306
|
||||||
|
basedir = /usr
|
||||||
|
datadir = /var/lib/mysql
|
||||||
|
tmpdir = /tmp
|
||||||
|
lc-messages-dir = /usr/share/mysql
|
||||||
|
#skip-external-locking
|
||||||
|
|
||||||
|
# Instead of skip-networking the default is now to listen only on
|
||||||
|
# localhost which is more compatible and is not less secure.
|
||||||
|
#bind-address = 127.0.0.1
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Fine Tuning
|
||||||
|
#
|
||||||
|
#key_buffer_size = 16M
|
||||||
|
#max_allowed_packet = 16M
|
||||||
|
#thread_stack = 192K
|
||||||
|
#thread_cache_size = 8
|
||||||
|
# This replaces the startup script and checks MyISAM tables if needed
|
||||||
|
# the first time they are touched
|
||||||
|
#myisam_recover_options = BACKUP
|
||||||
|
#max_connections = 100
|
||||||
|
#table_cache = 64
|
||||||
|
#thread_concurrency = 10
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Query Cache Configuration
|
||||||
|
#
|
||||||
|
#query_cache_limit = 1M
|
||||||
|
query_cache_size = 16M
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Logging and Replication
|
||||||
|
#
|
||||||
|
# Both location gets rotated by the cronjob.
|
||||||
|
# Be aware that this log type is a performance killer.
|
||||||
|
# As of 5.1 you can enable the log at runtime!
|
||||||
|
#general_log_file = /var/log/mysql/mysql.log
|
||||||
|
#general_log = 1
|
||||||
|
#
|
||||||
|
# Error log - should be very few entries.
|
||||||
|
#
|
||||||
|
log_error = /var/log/mysql/error.log
|
||||||
|
#
|
||||||
|
# Enable the slow query log to see queries with especially long duration
|
||||||
|
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
|
||||||
|
#long_query_time = 10
|
||||||
|
#log_slow_rate_limit = 1000
|
||||||
|
#log_slow_verbosity = query_plan
|
||||||
|
#log-queries-not-using-indexes
|
||||||
|
#
|
||||||
|
# The following can be used as easy to replay backup logs or for replication.
|
||||||
|
# note: if you are setting up a replication slave, see README.Debian about
|
||||||
|
# other settings you may need to change.
|
||||||
|
#server-id = 1
|
||||||
|
#log_bin = /var/log/mysql/mysql-bin.log
|
||||||
|
expire_logs_days = 10
|
||||||
|
#max_binlog_size = 100M
|
||||||
|
#binlog_do_db = include_database_name
|
||||||
|
#binlog_ignore_db = exclude_database_name
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Security Features
|
||||||
|
#
|
||||||
|
# Read the manual, too, if you want chroot!
|
||||||
|
#chroot = /var/lib/mysql/
|
||||||
|
#
|
||||||
|
# For generating SSL certificates you can use for example the GUI tool "tinyca".
|
||||||
|
#
|
||||||
|
#ssl-ca = /etc/mysql/cacert.pem
|
||||||
|
#ssl-cert = /etc/mysql/server-cert.pem
|
||||||
|
#ssl-key = /etc/mysql/server-key.pem
|
||||||
|
#
|
||||||
|
# Accept only connections using the latest and most secure TLS protocol version.
|
||||||
|
# ..when MariaDB is compiled with OpenSSL:
|
||||||
|
#ssl-cipher = TLSv1.2
|
||||||
|
# ..when MariaDB is compiled with YaSSL (default in Debian):
|
||||||
|
#ssl = on
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Character sets
|
||||||
|
#
|
||||||
|
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
|
||||||
|
# utf8 4-byte character set. See also client.cnf
|
||||||
|
#
|
||||||
|
character-set-server = utf8mb4
|
||||||
|
collation-server = utf8mb4_general_ci
|
||||||
|
|
||||||
|
#
|
||||||
|
# * InnoDB
|
||||||
|
#
|
||||||
|
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
||||||
|
# Read the manual for more InnoDB related options. There are many!
|
||||||
|
|
||||||
|
#
|
||||||
|
# * Unix socket authentication plugin is built-in since 10.0.22-6
|
||||||
|
#
|
||||||
|
# Needed so the root database user can authenticate without a password but
|
||||||
|
# only when running as the unix root user.
|
||||||
|
#
|
||||||
|
# Also available for other users if required.
|
||||||
|
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
|
||||||
|
|
||||||
|
# this is only for embedded server
|
||||||
|
[embedded]
|
||||||
|
|
||||||
|
# This group is only read by MariaDB servers, not by MySQL.
|
||||||
|
# If you use the same .cnf file for MySQL and MariaDB,
|
||||||
|
# you can put MariaDB-only options here
|
||||||
|
[mariadb]
|
||||||
|
|
||||||
|
# This group is only read by MariaDB-10.3 servers.
|
||||||
|
# If you use the same .cnf file for MariaDB of different versions,
|
||||||
|
# use this group for options that older servers don't understand
|
||||||
|
[mariadb-10.3]
|
||||||
5
srcs/requirements/mariadb/conf/create_db.sql
Normal file
5
srcs/requirements/mariadb/conf/create_db.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
USE mysql;
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS ${DB_NAME};
|
||||||
|
CREATE USER IF NOT EXISTS '${DB_USER}'@'%' IDENTIFIED BY '${DB_PSWD}';
|
||||||
|
GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_USER}'@'%' with grant option;
|
||||||
70
srcs/requirements/mariadb/conf/mariadb-server.cnf.alpine
Normal file
70
srcs/requirements/mariadb/conf/mariadb-server.cnf.alpine
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# https://wiki.alpinelinux.org/wiki/MariaDB
|
||||||
|
# inception modifications :
|
||||||
|
#
|
||||||
|
# [mysqld] :
|
||||||
|
# < socket=/run/mysqld/mysqld.sock
|
||||||
|
# >
|
||||||
|
#
|
||||||
|
# [mysqld] :
|
||||||
|
# < skip-networking = false
|
||||||
|
# > skip-networking
|
||||||
|
# ---
|
||||||
|
# < datadir = /var/lib/mysql
|
||||||
|
# >
|
||||||
|
# ---
|
||||||
|
# < port = 3306
|
||||||
|
# >
|
||||||
|
# ---
|
||||||
|
# < socket=/run/mysqld/mysqld.sock
|
||||||
|
# >
|
||||||
|
|
||||||
|
#
|
||||||
|
# These groups are read by MariaDB server.
|
||||||
|
# Use it for options that only the server (but not clients) should see
|
||||||
|
|
||||||
|
# this is read by the standalone daemon and embedded servers
|
||||||
|
[server]
|
||||||
|
socket=/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
|
# this is only for the mysqld standalone daemon
|
||||||
|
[mysqld]
|
||||||
|
skip-networking = false
|
||||||
|
datadir = /var/lib/mysql
|
||||||
|
port = 3306
|
||||||
|
socket=/run/mysqld/mysqld.sock
|
||||||
|
|
||||||
|
# sock was in : /run/mysqld/mysqld.sock
|
||||||
|
# mariadb thought it was in : /var/lib/mysql/mysql.sock
|
||||||
|
# so I made : ln -s /run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock
|
||||||
|
|
||||||
|
# Galera-related settings
|
||||||
|
[galera]
|
||||||
|
# Mandatory settings
|
||||||
|
#wsrep_on=ON
|
||||||
|
#wsrep_provider=
|
||||||
|
#wsrep_cluster_address=
|
||||||
|
#binlog_format=row
|
||||||
|
#default_storage_engine=InnoDB
|
||||||
|
#innodb_autoinc_lock_mode=2
|
||||||
|
#
|
||||||
|
# Allow server to accept connections on all interfaces.
|
||||||
|
#
|
||||||
|
#bind-address=0.0.0.0
|
||||||
|
#
|
||||||
|
# Optional setting
|
||||||
|
#wsrep_slave_threads=1
|
||||||
|
#innodb_flush_log_at_trx_commit=0
|
||||||
|
|
||||||
|
# this is only for embedded server
|
||||||
|
[embedded]
|
||||||
|
|
||||||
|
# This group is only read by MariaDB servers, not by MySQL.
|
||||||
|
# If you use the same .cnf file for MySQL and MariaDB,
|
||||||
|
# you can put MariaDB-only options here
|
||||||
|
[mariadb]
|
||||||
|
|
||||||
|
# This group is only read by MariaDB-10.5 servers.
|
||||||
|
# If you use the same .cnf file for MariaDB of different versions,
|
||||||
|
# use this group for options that older servers don't understand
|
||||||
|
[mariadb-10.5]
|
||||||
|
|
||||||
87
srcs/requirements/nginx/Dockerfile
Normal file
87
srcs/requirements/nginx/Dockerfile
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# debian (~ 180s) --------------------------------------------
|
||||||
|
|
||||||
|
# FROM debian:buster
|
||||||
|
#
|
||||||
|
# # vim for debug
|
||||||
|
# RUN apt update && apt install -y \
|
||||||
|
# nginx openssl \
|
||||||
|
# vim \
|
||||||
|
# && \
|
||||||
|
# rm -rf /var/lib/apt/lists/*
|
||||||
|
#
|
||||||
|
# # nginx conf
|
||||||
|
# COPY ./conf/nginx.conf.debian /etc/nginx/nginx.conf
|
||||||
|
# COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
# alpine (~ 45s) ---------------------------------------------
|
||||||
|
|
||||||
|
FROM alpine:3.15
|
||||||
|
|
||||||
|
# vim and bash for debug
|
||||||
|
RUN apk update && apk add \
|
||||||
|
nginx openssl \
|
||||||
|
vim bash \
|
||||||
|
&& \
|
||||||
|
rm -rf /var/cache/apk*
|
||||||
|
|
||||||
|
# nginx conf
|
||||||
|
COPY ./conf/nginx.conf.alpine /etc/nginx/nginx.conf
|
||||||
|
COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
|
||||||
|
|
||||||
|
# create user www-data and assign it to group www-data
|
||||||
|
RUN adduser -S www-data && \
|
||||||
|
adduser www-data www-data
|
||||||
|
|
||||||
|
RUN mkdir -p /var/www/html
|
||||||
|
|
||||||
|
# common -----------------------------------------------------
|
||||||
|
|
||||||
|
# replace WP_URL
|
||||||
|
ARG WP_URL
|
||||||
|
RUN sed -i "s/\${WP_URL}/${WP_URL}/g" /etc/nginx/http.d/inception_nginx.conf
|
||||||
|
|
||||||
|
# personalized index.html
|
||||||
|
COPY ./conf/index.html /data/www/
|
||||||
|
|
||||||
|
# create ssl certificate
|
||||||
|
RUN mkdir -p /etc/ssl/private /etc/ssl/certs
|
||||||
|
RUN openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
|
||||||
|
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=${WP_URL}" \
|
||||||
|
-keyout /etc/ssl/private/${WP_URL}.key \
|
||||||
|
-out /etc/ssl/certs/${WP_URL}.crt
|
||||||
|
|
||||||
|
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# -g 'daemon off' :
|
||||||
|
# daemon off, to avoid the main process of nginx to quit after creating its childs, and therefore make docker exit
|
||||||
|
# https://stackoverflow.com/questions/18861300/how-to-run-nginx-within-a-docker-container-without-halting
|
||||||
|
#
|
||||||
|
# ssl certificate :
|
||||||
|
# openssl faq : https://www.openssl.org/docs/faq.html
|
||||||
|
# openssl req : create ertificate request, and optionally create self signed certificates
|
||||||
|
# openssl req man : https://www.openssl.org/docs/man1.0.2/man1/openssl-req.html
|
||||||
|
# exemple of openssl with nginx on docker : https://www.johnmackenzie.co.uk/posts/using-self-signed-ssl-certificates-with-docker-and-nginx/
|
||||||
|
#
|
||||||
|
# usually the steps are :
|
||||||
|
# - create a server private key : `openssl genrsa -out server.key 2048`
|
||||||
|
# - create a CSR (certificate signing request) with the key : `openssl req -new -key server.key -out www.exemple.com.csr`
|
||||||
|
# - it will ask for :
|
||||||
|
# - Country Name (2 letter code)
|
||||||
|
# - State or Province Name (full name)
|
||||||
|
# - Locality Name (eg, city)
|
||||||
|
# - Organization Name (eg, company)
|
||||||
|
# - Organizational Unit Name (eg, section)
|
||||||
|
# - Common Name (eg, fully qualified host name)
|
||||||
|
# - Email Address (put nothing)
|
||||||
|
# - now ask to a CA (certificate authority) for a certificate.crt by giving them your request.csr
|
||||||
|
#
|
||||||
|
# alternatively we can generate our self-signed certificate with the `openssl req` command :
|
||||||
|
# - `x509` option is used to output a certificate instead of a certificate request
|
||||||
|
# - a request is created from scratch, if it is not given with `-in`
|
||||||
|
# - `newkey` generate a new private key, unless `-key` is given
|
||||||
|
# - `nodes` create a private key without encryption (no passphrase needed)
|
||||||
|
#
|
||||||
|
# SO discussion about becomming a real CA to have a certificate that works in deployement : https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl
|
||||||
|
#
|
||||||
91
srcs/requirements/nginx/conf/default
Normal file
91
srcs/requirements/nginx/conf/default
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
##
|
||||||
|
# You should look at the following URL's in order to grasp a solid understanding
|
||||||
|
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||||
|
# https://www.nginx.com/resources/wiki/start/
|
||||||
|
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||||
|
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||||
|
#
|
||||||
|
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||||
|
# leave it as reference inside of sites-available where it will continue to be
|
||||||
|
# updated by the nginx packaging team.
|
||||||
|
#
|
||||||
|
# This file will automatically load configuration files provided by other
|
||||||
|
# applications, such as Drupal or Wordpress. These applications will be made
|
||||||
|
# available underneath a path with that package name, such as /drupal8.
|
||||||
|
#
|
||||||
|
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||||
|
##
|
||||||
|
|
||||||
|
# Default server configuration
|
||||||
|
#
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
# SSL configuration
|
||||||
|
#
|
||||||
|
# listen 443 ssl default_server;
|
||||||
|
# listen [::]:443 ssl default_server;
|
||||||
|
#
|
||||||
|
# Note: You should disable gzip for SSL traffic.
|
||||||
|
# See: https://bugs.debian.org/773332
|
||||||
|
#
|
||||||
|
# Read up on ssl_ciphers to ensure a secure configuration.
|
||||||
|
# See: https://bugs.debian.org/765782
|
||||||
|
#
|
||||||
|
# Self signed certs generated by the ssl-cert package
|
||||||
|
# Don't use them in a production server!
|
||||||
|
#
|
||||||
|
# include snippets/snakeoil.conf;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
# Add index.php to the list if you are using PHP
|
||||||
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to displaying a 404.
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# pass PHP scripts to FastCGI server
|
||||||
|
#
|
||||||
|
#location ~ \.php$ {
|
||||||
|
# include snippets/fastcgi-php.conf;
|
||||||
|
#
|
||||||
|
# # With php-fpm (or other unix sockets):
|
||||||
|
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
|
||||||
|
# # With php-cgi (or other tcp sockets):
|
||||||
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# deny access to .htaccess files, if Apache's document root
|
||||||
|
# concurs with nginx's one
|
||||||
|
#
|
||||||
|
#location ~ /\.ht {
|
||||||
|
# deny all;
|
||||||
|
#}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Virtual Host configuration for example.com
|
||||||
|
#
|
||||||
|
# You can move that to a different file under sites-available/ and symlink that
|
||||||
|
# to sites-enabled/ to enable it.
|
||||||
|
#
|
||||||
|
#server {
|
||||||
|
# listen 80;
|
||||||
|
# listen [::]:80;
|
||||||
|
#
|
||||||
|
# server_name example.com;
|
||||||
|
#
|
||||||
|
# root /var/www/example.com;
|
||||||
|
# index index.html;
|
||||||
|
#
|
||||||
|
# location / {
|
||||||
|
# try_files $uri $uri/ =404;
|
||||||
|
# }
|
||||||
|
#}
|
||||||
34
srcs/requirements/nginx/conf/inception_nginx.conf
Normal file
34
srcs/requirements/nginx/conf/inception_nginx.conf
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# doc : https://nginx.org/en/docs/dirindex.html
|
||||||
|
|
||||||
|
# WIP redirect http to https
|
||||||
|
#server {
|
||||||
|
# listen 80;
|
||||||
|
# listen [::]:80;
|
||||||
|
# server_name _;
|
||||||
|
# return 301 https://$host$request_uri;
|
||||||
|
#}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||||
|
listen [::]:443 ssl; # for ipv6
|
||||||
|
server_name ${WP_URL};
|
||||||
|
ssl_certificate /etc/ssl/certs/${WP_URL}.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
|
||||||
|
ssl_certificate_key /etc/ssl/private/${WP_URL}.key; # specifies the file with the secret key of the certificate
|
||||||
|
|
||||||
|
root /var/www/html/; # contains default nginx index.nginx-debian.html
|
||||||
|
index index.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
|
||||||
|
}
|
||||||
|
|
||||||
|
# pass PHP scripts to FastCGI (PHP-FPM) server
|
||||||
|
location ~ \.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass wordpress:9000;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
srcs/requirements/nginx/conf/index.html
Normal file
1
srcs/requirements/nginx/conf/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
hello world !
|
||||||
118
srcs/requirements/nginx/conf/nginx.conf.alpine
Normal file
118
srcs/requirements/nginx/conf/nginx.conf.alpine
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
# inception modifications :
|
||||||
|
#
|
||||||
|
# user :
|
||||||
|
# < user www-data
|
||||||
|
# > user nginx
|
||||||
|
#
|
||||||
|
# protocols :
|
||||||
|
#
|
||||||
|
# < ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
# > ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||||
|
#
|
||||||
|
# http :
|
||||||
|
# < client_max_body_size 640m;
|
||||||
|
# > client_max_body_size 1m;
|
||||||
|
|
||||||
|
# /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
user www-data;
|
||||||
|
|
||||||
|
# Set number of worker processes automatically based on number of CPU cores.
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Configures default error logger.
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
|
||||||
|
# Includes files with directives to load dynamic modules.
|
||||||
|
include /etc/nginx/modules/*.conf;
|
||||||
|
|
||||||
|
# Uncomment to include files with config snippets into the root context.
|
||||||
|
# NOTE: This will be enabled by default in Alpine 3.15.
|
||||||
|
#include /etc/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
|
events {
|
||||||
|
# The maximum number of simultaneous connections that can be opened by
|
||||||
|
# a worker process.
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
http {
|
||||||
|
# Includes mapping of file name extensions to MIME types of responses
|
||||||
|
# and defines the default type.
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
# Name servers used to resolve names of upstream servers into addresses.
|
||||||
|
# It's also needed when using tcpsocket and udpsocket in Lua modules.
|
||||||
|
#resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001;
|
||||||
|
|
||||||
|
# Don't tell nginx version to the clients. Default is 'on'.
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
# Specifies the maximum accepted body size of a client request, as
|
||||||
|
# indicated by the request header Content-Length. If the stated content
|
||||||
|
# length is greater than this size, then the client receives the HTTP
|
||||||
|
# error code 413. Set to 0 to disable. Default is '1m'.
|
||||||
|
client_max_body_size 640m;
|
||||||
|
|
||||||
|
# Sendfile copies data between one FD and other from within the kernel,
|
||||||
|
# which is more efficient than read() + write(). Default is off.
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
# Causes nginx to attempt to send its HTTP response head in one packet,
|
||||||
|
# instead of using partial frames. Default is 'off'.
|
||||||
|
tcp_nopush on;
|
||||||
|
|
||||||
|
|
||||||
|
# Enables the specified protocols. Default is TLSv1 TLSv1.1 TLSv1.2.
|
||||||
|
# TIP: If you're not obligated to support ancient clients, remove TLSv1.1.
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
|
||||||
|
# Path of the file with Diffie-Hellman parameters for EDH ciphers.
|
||||||
|
# TIP: Generate with: `openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048`
|
||||||
|
#ssl_dhparam /etc/ssl/nginx/dh2048.pem;
|
||||||
|
|
||||||
|
# Specifies that our cipher suits should be preferred over client ciphers.
|
||||||
|
# Default is 'off'.
|
||||||
|
ssl_prefer_server_ciphers on;
|
||||||
|
|
||||||
|
# Enables a shared SSL cache with size that can hold around 8000 sessions.
|
||||||
|
# Default is 'none'.
|
||||||
|
ssl_session_cache shared:SSL:2m;
|
||||||
|
|
||||||
|
# Specifies a time during which a client may reuse the session parameters.
|
||||||
|
# Default is '5m'.
|
||||||
|
ssl_session_timeout 1h;
|
||||||
|
|
||||||
|
# Disable TLS session tickets (they are insecure). Default is 'on'.
|
||||||
|
ssl_session_tickets off;
|
||||||
|
|
||||||
|
|
||||||
|
# Enable gzipping of responses.
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
# Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
|
# Helper variable for proxying websockets.
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Specifies the main log format.
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
# Sets the path, format, and configuration for a buffered log write.
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
# Includes virtual hosts configs.
|
||||||
|
include /etc/nginx/http.d/*.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
# TIP: Uncomment if you use stream module.
|
||||||
|
#include /etc/nginx/stream.conf;
|
||||||
98
srcs/requirements/nginx/conf/nginx.conf.debian
Normal file
98
srcs/requirements/nginx/conf/nginx.conf.debian
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
# inception modifications :
|
||||||
|
#
|
||||||
|
# ssl_protocols :
|
||||||
|
# < ssl_protocols TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||||
|
# > ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||||
|
# gzip :
|
||||||
|
# < gzip off;
|
||||||
|
# > gzip on;
|
||||||
|
# sites-enabled :
|
||||||
|
# < # include /etc/nginx/sites-enabled/*;
|
||||||
|
# > include /etc/nginx/sites-enabled/*;
|
||||||
|
# doc : https://nginx.org/en/docs/dirindex.html
|
||||||
|
|
||||||
|
user www-data; # process owner name, can be anything
|
||||||
|
worker_processes auto; # a worker is a process that handles incoming requests, auto to automatically adjust the number of processes available
|
||||||
|
pid /run/nginx.pid; # defines a file that will store the process id of the main process
|
||||||
|
include /etc/nginx/modules-enabled/*.conf; # include a file
|
||||||
|
|
||||||
|
events { # section for connection processing directives
|
||||||
|
worker_connections 768; # max number of connection that can be opened by a worker process
|
||||||
|
# multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http { # section for http server directives
|
||||||
|
##
|
||||||
|
# Basic Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
sendfile on; # enable the use of linux sendfil() function, that transfer data directly betzeen fd, so withour copying to intermediate memory buffer, it increases performances in most cases (https://stackoverflow.com/questions/58066785/always-use-sendfile-with-nginx-on-linux)
|
||||||
|
tcp_nopush on; # enables the socket option TCP_CORK/TCP_NOPUSH, that allows to send packets filled with more datas (https://baus.net/on-tcp_cork/)
|
||||||
|
tcp_nodelay on; # opposit of TCP_CORK, TCP_NODELAY says the application to send datas as soon as it receives it, both options are exclusives but can work together in modern kernel (https://stackoverflow.com/questions/3761276/when-should-i-use-tcp-nodelay-and-when-tcp-cork)
|
||||||
|
keepalive_timeout 65; # in seconds, defines time before closing a connexion without activity
|
||||||
|
types_hash_max_size 2048; # maximum size for the list that stores duplicates of the hash table, size of the hash table is chosen accordingly (https://nginx.org/en/docs/hash.html, hash table : https://www.youtube.com/watch?v=KyUTuwz_b7Q)
|
||||||
|
# server_tokens off;
|
||||||
|
|
||||||
|
# server_names_hash_bucket_size 64;
|
||||||
|
# server_name_in_redirect off;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types; # include a file
|
||||||
|
default_type application/octet-stream; # defines the default MIME type (default is text/plain)
|
||||||
|
|
||||||
|
##
|
||||||
|
# SSL Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.3; # Dropping SSLv3, ref: POODLE # enables the specified protocols. The TLSv1.1 and TLSv1.2 parameters works only when OpenSSL 1.0.1 or higher is used, and the TLSv1.3 only when OpenSSL 1.1.1 or higher is used
|
||||||
|
ssl_prefer_server_ciphers on; # Specifies that server ciphers should be preferred over client ciphers when using the SSLv3 and TLS protocols (a cipher is "an algorithm for performing encryption or decryption, a series of [...] steps that can be followed as a procedure" https://en.wikipedia.org/wiki/Cipher_suite)
|
||||||
|
|
||||||
|
##
|
||||||
|
# Logging Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log; # defines where to write the access logs. if gzip is used, the log will be buffered
|
||||||
|
error_log /var/log/nginx/error.log; # defines where to write the error logs. if gzip is used, the log will be buffered
|
||||||
|
|
||||||
|
##
|
||||||
|
# Gzip Settings
|
||||||
|
##
|
||||||
|
|
||||||
|
gzip off; # enable gzipping of responses. gzip is an algorithm that compress the data (disabled for security reasons : https://bugs.debian.org/773332)
|
||||||
|
|
||||||
|
# gzip_vary on;
|
||||||
|
# gzip_proxied any;
|
||||||
|
# gzip_comp_level 6;
|
||||||
|
# gzip_buffers 16 8k;
|
||||||
|
# gzip_http_version 1.1;
|
||||||
|
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
|
|
||||||
|
##
|
||||||
|
# Virtual Host Configs
|
||||||
|
##
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf; # include the *.conf files found in conf.d folder. do the same as "sites-enabled" with another approach : you put your .conf files for the site inside this folder, and if you want to disable a config file you just rename it to no have a .conf suffix
|
||||||
|
# include /etc/nginx/sites-enabled/*; # include all the (symlink) files found in sites-enabled folder. do the same as "conf.d" with another approach : you put all your configurations files into a "/etc/nginx/sites-available/" folder, and you put symlinks of a selection of thoses files that you want to use for the site, into "/etc/nginx/sites-enabled/" folder (bad practice : https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx#answer-870709)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#mail {
|
||||||
|
# # See sample authentication script at:
|
||||||
|
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
|
||||||
|
#
|
||||||
|
# # auth_http localhost/auth.php;
|
||||||
|
# # pop3_capabilities "TOP" "USER";
|
||||||
|
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:110;
|
||||||
|
# protocol pop3;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# server {
|
||||||
|
# listen localhost:143;
|
||||||
|
# protocol imap;
|
||||||
|
# proxy on;
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
|
||||||
0
srcs/requirements/test/.dockerignore
Normal file
0
srcs/requirements/test/.dockerignore
Normal file
47
srcs/requirements/test/Dockerfile
Normal file
47
srcs/requirements/test/Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
# basic test
|
||||||
|
# build with : sudo docker build --tag test .
|
||||||
|
# run with : sudo docker run test
|
||||||
|
# 'hello' in assembly found here : http://timelessname.com/elfbin/
|
||||||
|
FROM scratch
|
||||||
|
COPY tools/hello /
|
||||||
|
CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## working
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR /
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## working, when WORKDIR is absent, it's default is set to "/"
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
|
## not working, when CMD execute in shell form, instead of exec form []
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello /
|
||||||
|
#CMD /hello
|
||||||
|
|
||||||
|
## not working, because c executable need library <unistd.h>
|
||||||
|
#FROM scratch
|
||||||
|
#COPY hello_c /
|
||||||
|
#CMD [ "/hello_c" ]
|
||||||
|
|
||||||
|
## not working, when executable is copied to ".", because WORKDIR value is not "." but "/" since we gave it a relativ path so it was build in top of the implicit absolut path "/"
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR .
|
||||||
|
#COPY hello .
|
||||||
|
#CMD [ "hello" ]
|
||||||
|
|
||||||
|
## not working, when WORKDIR is set to the present directory and executable is not copied, because the workdir is not the present directory but a directory in the file system of docker : executable need to be copied there to function
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR /home/simplonco/Desktop/42/14_inception/inception/srcs/requirements/mariadb
|
||||||
|
#CMD [ "hello" ]
|
||||||
|
|
||||||
|
## working, because "hello" is copied to "/" and execute from "/"
|
||||||
|
#FROM scratch
|
||||||
|
#WORKDIR .
|
||||||
|
#COPY hello /
|
||||||
|
#CMD [ "/hello" ]
|
||||||
|
|
||||||
BIN
srcs/requirements/test/tools/hello
Executable file
BIN
srcs/requirements/test/tools/hello
Executable file
Binary file not shown.
16
srcs/requirements/test/tools/hello.asm
Normal file
16
srcs/requirements/test/tools/hello.asm
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
SECTION .data
|
||||||
|
msg: db "Hi World",10
|
||||||
|
len: equ $-msg
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
global main
|
||||||
|
main:
|
||||||
|
mov edx,len
|
||||||
|
mov ecx,msg
|
||||||
|
mov ebx,1
|
||||||
|
mov eax,4
|
||||||
|
int 0x80
|
||||||
|
mov ebx,0
|
||||||
|
mov eax,1
|
||||||
|
int 0x80
|
||||||
|
|
||||||
67
srcs/requirements/wordpress/Dockerfile
Normal file
67
srcs/requirements/wordpress/Dockerfile
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# debian -----------------------------------------------------
|
||||||
|
|
||||||
|
# FROM debian:buster
|
||||||
|
#
|
||||||
|
# # bash and vim for debug
|
||||||
|
# RUN apt update && apt install -y \
|
||||||
|
# php7.3 \
|
||||||
|
# php7.3-fpm \
|
||||||
|
# php7.3-mysqli \
|
||||||
|
# mariadb-client \
|
||||||
|
# curl \
|
||||||
|
# bash vim
|
||||||
|
# RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
#
|
||||||
|
# # fpm config
|
||||||
|
# COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
|
||||||
|
# RUN mkdir /run/php/
|
||||||
|
#
|
||||||
|
# ENV PHP_VERSION="php-fpm7.3"
|
||||||
|
|
||||||
|
# alpine -----------------------------------------------------
|
||||||
|
|
||||||
|
FROM alpine:3.15
|
||||||
|
|
||||||
|
# bash and vim for debug
|
||||||
|
RUN apk update && apk add \
|
||||||
|
php7 \
|
||||||
|
php7-fpm \
|
||||||
|
php7-mysqli \
|
||||||
|
php7-phar \
|
||||||
|
php7-json \
|
||||||
|
php7-iconv \
|
||||||
|
mariadb-client \
|
||||||
|
curl \
|
||||||
|
bash vim
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# fpm config
|
||||||
|
COPY ./conf/www.conf /etc/php7/php-fpm.d/
|
||||||
|
RUN mkdir /run/php/
|
||||||
|
|
||||||
|
# create wp directory
|
||||||
|
ARG WP_DIR
|
||||||
|
RUN mkdir -p ${WP_DIR}
|
||||||
|
|
||||||
|
# MAP for creation of map plugin
|
||||||
|
COPY ./conf/map_prof/ ${WP_DIR}/wp-content/plugins/map_prof
|
||||||
|
# modify .htaccess
|
||||||
|
COPY ./conf/htaccess ${WP_DIR}/.htaccess
|
||||||
|
|
||||||
|
# create www-data user and add to group
|
||||||
|
RUN adduser -S www-data && \
|
||||||
|
adduser www-data www-data
|
||||||
|
|
||||||
|
ENV PHP_VERSION="php-fpm7"
|
||||||
|
|
||||||
|
# common -----------------------------------------------------
|
||||||
|
|
||||||
|
# install wp-cli : https://wp-cli.org/#installing
|
||||||
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
||||||
|
chmod +x wp-cli.phar && \
|
||||||
|
mv wp-cli.phar /usr/local/bin/wp
|
||||||
|
|
||||||
|
COPY ./conf/wp_entrypoint.sh ./
|
||||||
|
|
||||||
|
ENTRYPOINT [ "sh", "wp_entrypoint.sh" ]
|
||||||
|
|
||||||
5
srcs/requirements/wordpress/conf/htaccess
Normal file
5
srcs/requirements/wordpress/conf/htaccess
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
php_value upload_max_filesize 640M
|
||||||
|
php_value post_max_size 640M
|
||||||
|
php_value memory_limit 640M
|
||||||
|
php_value max_execution_time 300
|
||||||
|
php_value max_input_time 300
|
||||||
76
srcs/requirements/wordpress/conf/map_prof/map_prof.php
Normal file
76
srcs/requirements/wordpress/conf/map_prof/map_prof.php
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package map_prof
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Plugin Name: map_prof
|
||||||
|
Plugin URI:
|
||||||
|
Description: add/remove locations on map at publication/deletion of posts
|
||||||
|
Author: hugogogo
|
||||||
|
Version: 1.0.0
|
||||||
|
Author URI:
|
||||||
|
*/
|
||||||
|
|
||||||
|
// function hello_dolly_get_lyric() {
|
||||||
|
// /** These are the lyrics to Hello Dolly */
|
||||||
|
// $lyrics = "Hello, Dolly
|
||||||
|
// ...
|
||||||
|
// Dolly'll never go away again";
|
||||||
|
//
|
||||||
|
// // Here we split it into lines.
|
||||||
|
// $lyrics = explode( "\n", $lyrics );
|
||||||
|
//
|
||||||
|
// // And then randomly choose a line.
|
||||||
|
// return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // This just echoes the chosen line, we'll position it later.
|
||||||
|
// function hello_dolly() {
|
||||||
|
// $chosen = hello_dolly_get_lyric();
|
||||||
|
// $lang = '';
|
||||||
|
// if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
|
||||||
|
// $lang = ' lang="en"';
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// printf(
|
||||||
|
// '<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
|
||||||
|
// __( 'Quote from Hello Dolly song, by Jerry Herman:' ),
|
||||||
|
// $lang,
|
||||||
|
// $chosen
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Now we set that function up to execute when the admin_notices action is called.
|
||||||
|
// add_action( 'admin_notices', 'hello_dolly' );
|
||||||
|
//
|
||||||
|
// // We need some CSS to position the paragraph.
|
||||||
|
// function dolly_css() {
|
||||||
|
// echo "
|
||||||
|
// <style type='text/css'>
|
||||||
|
// #dolly {
|
||||||
|
// float: right;
|
||||||
|
// padding: 5px 10px;
|
||||||
|
// margin: 0;
|
||||||
|
// font-size: 12px;
|
||||||
|
// line-height: 1.6666;
|
||||||
|
// }
|
||||||
|
// .rtl #dolly {
|
||||||
|
// float: left;
|
||||||
|
// }
|
||||||
|
// .block-editor-page #dolly {
|
||||||
|
// display: none;
|
||||||
|
// }
|
||||||
|
// @media screen and (max-width: 782px) {
|
||||||
|
// #dolly,
|
||||||
|
// .rtl #dolly {
|
||||||
|
// float: none;
|
||||||
|
// padding-left: 0;
|
||||||
|
// padding-right: 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// </style>
|
||||||
|
// ";
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// add_action( 'admin_head', 'dolly_css' );
|
||||||
71
srcs/requirements/wordpress/conf/wp_entrypoint.sh
Normal file
71
srcs/requirements/wordpress/conf/wp_entrypoint.sh
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
GRAY="\e[0;30m"
|
||||||
|
RED="\e[0;31m"
|
||||||
|
GREEN="\e[0;32m"
|
||||||
|
YELLOW="\e[0;33m"
|
||||||
|
BLUE="\e[0;34m"
|
||||||
|
PURPLE="\e[0;35m"
|
||||||
|
CYAN="\e[0;36m"
|
||||||
|
WHITE="\e[0;37m"
|
||||||
|
RESET="\e[0m"
|
||||||
|
|
||||||
|
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
||||||
|
# commands : https://developer.wordpress.org/cli/commands/
|
||||||
|
echo -e ${YELLOW}download wordpress :${RESET}
|
||||||
|
if ! wp core version --path="${WP_DIR}" 2> /dev/null
|
||||||
|
then
|
||||||
|
mkdir -p ${WP_DIR}
|
||||||
|
wp core download --path="${WP_DIR}" --allow-root
|
||||||
|
else
|
||||||
|
echo -e ${GREEN}already there !${RESET}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create config file :
|
||||||
|
echo -e ${YELLOW}config wordpress :${RESET}
|
||||||
|
if ! wp config path --path="${WP_DIR}" --quiet 2> /dev/null
|
||||||
|
then
|
||||||
|
wp config create \
|
||||||
|
--dbhost="${DB_HOST}" \
|
||||||
|
--dbname="${DB_NAME}" \
|
||||||
|
--dbuser="${DB_USER}" \
|
||||||
|
--dbpass="${DB_PSWD}" \
|
||||||
|
--path="${WP_DIR}" --allow-root
|
||||||
|
else
|
||||||
|
echo -e ${GREEN}already configured !${RESET}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install wordpress :
|
||||||
|
echo -e ${YELLOW}install wordpress :${RESET}
|
||||||
|
if ! wp core is-installed --path="${WP_DIR}" 2> /dev/null
|
||||||
|
then
|
||||||
|
wp core install \
|
||||||
|
--url="${WP_URL}" \
|
||||||
|
--title="${WP_TITLE}" \
|
||||||
|
--admin_user="${WP_ADMIN}" \
|
||||||
|
--admin_email="${WP_ADMIN_EMAIL}" \
|
||||||
|
--admin_password="${WP_ADMIN_PSWD}" \
|
||||||
|
--skip-email \
|
||||||
|
--path="${WP_DIR}" --allow-root
|
||||||
|
else
|
||||||
|
echo -e ${GREEN}already installed !${RESET}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create user :
|
||||||
|
echo -e ${YELLOW}create wordpress user :${RESET}
|
||||||
|
if ! wp user get ${WP_USER} --path="${WP_DIR}" --field=login 2> /dev/null
|
||||||
|
then
|
||||||
|
wp user create \
|
||||||
|
"${WP_USER}" "${WP_USER_EMAIL}" \
|
||||||
|
--user_pass="${WP_USER_PSWD}" \
|
||||||
|
--path="${WP_DIR}" --allow-root
|
||||||
|
else
|
||||||
|
echo -e ${GREEN}already created !${RESET}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# change owner and permissions to wp files
|
||||||
|
chown -R www-data:www-data /var/www/*
|
||||||
|
chmod 755 -R /var/www/*
|
||||||
|
|
||||||
|
exec "${PHP_VERSION}" -FR
|
||||||
|
|
||||||
446
srcs/requirements/wordpress/conf/www.conf
Normal file
446
srcs/requirements/wordpress/conf/www.conf
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
; inception modifications :
|
||||||
|
;
|
||||||
|
; listen :
|
||||||
|
; < listen = wordpress:9000
|
||||||
|
; > listen = /run/php/php7.3-fpm.sock
|
||||||
|
|
||||||
|
|
||||||
|
; Start a new pool named 'www'.
|
||||||
|
; the variable $pool can be used in any directive and will be replaced by the
|
||||||
|
; pool name ('www' here)
|
||||||
|
[www]
|
||||||
|
|
||||||
|
; Per pool prefix
|
||||||
|
; It only applies on the following directives:
|
||||||
|
; - 'access.log'
|
||||||
|
; - 'slowlog'
|
||||||
|
; - 'listen' (unixsocket)
|
||||||
|
; - 'chroot'
|
||||||
|
; - 'chdir'
|
||||||
|
; - 'php_values'
|
||||||
|
; - 'php_admin_values'
|
||||||
|
; When not set, the global prefix (or /usr) applies instead.
|
||||||
|
; Note: This directive can also be relative to the global prefix.
|
||||||
|
; Default Value: none
|
||||||
|
;prefix = /path/to/pools/$pool
|
||||||
|
|
||||||
|
; Unix user/group of processes
|
||||||
|
; Note: The user is mandatory. If the group is not set, the default user's group
|
||||||
|
; will be used.
|
||||||
|
user = www-data
|
||||||
|
group = www-data
|
||||||
|
|
||||||
|
; The address on which to accept FastCGI requests.
|
||||||
|
; Valid syntaxes are:
|
||||||
|
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
|
||||||
|
; a specific port;
|
||||||
|
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||||
|
; a specific port;
|
||||||
|
; 'port' - to listen on a TCP socket to all addresses
|
||||||
|
; (IPv6 and IPv4-mapped) on a specific port;
|
||||||
|
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
listen = wordpress:9000
|
||||||
|
|
||||||
|
; Set listen(2) backlog.
|
||||||
|
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
|
||||||
|
;listen.backlog = 511
|
||||||
|
|
||||||
|
; Set permissions for unix socket, if one is used. In Linux, read/write
|
||||||
|
; permissions must be set in order to allow connections from a web server. Many
|
||||||
|
; BSD-derived systems allow connections regardless of permissions. The owner
|
||||||
|
; and group can be specified either by name or by their numeric IDs.
|
||||||
|
; Default Values: user and group are set as the running user
|
||||||
|
; mode is set to 0660
|
||||||
|
listen.owner = www-data
|
||||||
|
listen.group = www-data
|
||||||
|
;listen.mode = 0660
|
||||||
|
; When POSIX Access Control Lists are supported you can set them using
|
||||||
|
; these options, value is a comma separated list of user/group names.
|
||||||
|
; When set, listen.owner and listen.group are ignored
|
||||||
|
;listen.acl_users =
|
||||||
|
;listen.acl_groups =
|
||||||
|
|
||||||
|
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
|
||||||
|
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
||||||
|
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
|
||||||
|
; must be separated by a comma. If this value is left blank, connections will be
|
||||||
|
; accepted from any ip address.
|
||||||
|
; Default Value: any
|
||||||
|
;listen.allowed_clients = 127.0.0.1
|
||||||
|
|
||||||
|
; Specify the nice(2) priority to apply to the pool processes (only if set)
|
||||||
|
; The value can vary from -19 (highest priority) to 20 (lower priority)
|
||||||
|
; Note: - It will only work if the FPM master process is launched as root
|
||||||
|
; - The pool processes will inherit the master process priority
|
||||||
|
; unless it specified otherwise
|
||||||
|
; Default Value: no set
|
||||||
|
; process.priority = -19
|
||||||
|
|
||||||
|
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
|
||||||
|
; or group is differrent than the master process user. It allows to create process
|
||||||
|
; core dump and ptrace the process for the pool user.
|
||||||
|
; Default Value: no
|
||||||
|
; process.dumpable = yes
|
||||||
|
|
||||||
|
; Choose how the process manager will control the number of child processes.
|
||||||
|
; Possible Values:
|
||||||
|
; static - a fixed number (pm.max_children) of child processes;
|
||||||
|
; dynamic - the number of child processes are set dynamically based on the
|
||||||
|
; following directives. With this process management, there will be
|
||||||
|
; always at least 1 children.
|
||||||
|
; pm.max_children - the maximum number of children that can
|
||||||
|
; be alive at the same time.
|
||||||
|
; pm.start_servers - the number of children created on startup.
|
||||||
|
; pm.min_spare_servers - the minimum number of children in 'idle'
|
||||||
|
; state (waiting to process). If the number
|
||||||
|
; of 'idle' processes is less than this
|
||||||
|
; number then some children will be created.
|
||||||
|
; pm.max_spare_servers - the maximum number of children in 'idle'
|
||||||
|
; state (waiting to process). If the number
|
||||||
|
; of 'idle' processes is greater than this
|
||||||
|
; number then some children will be killed.
|
||||||
|
; ondemand - no children are created at startup. Children will be forked when
|
||||||
|
; new requests will connect. The following parameter are used:
|
||||||
|
; pm.max_children - the maximum number of children that
|
||||||
|
; can be alive at the same time.
|
||||||
|
; pm.process_idle_timeout - The number of seconds after which
|
||||||
|
; an idle process will be killed.
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
pm = dynamic
|
||||||
|
|
||||||
|
; The number of child processes to be created when pm is set to 'static' and the
|
||||||
|
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
||||||
|
; This value sets the limit on the number of simultaneous requests that will be
|
||||||
|
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
|
||||||
|
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
|
||||||
|
; CGI. The below defaults are based on a server without much resources. Don't
|
||||||
|
; forget to tweak pm.* to fit your needs.
|
||||||
|
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||||
|
; Note: This value is mandatory.
|
||||||
|
pm.max_children = 5
|
||||||
|
|
||||||
|
; The number of child processes created on startup.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
|
||||||
|
pm.start_servers = 2
|
||||||
|
|
||||||
|
; The desired minimum number of idle server processes.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Note: Mandatory when pm is set to 'dynamic'
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
|
||||||
|
; The desired maximum number of idle server processes.
|
||||||
|
; Note: Used only when pm is set to 'dynamic'
|
||||||
|
; Note: Mandatory when pm is set to 'dynamic'
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
|
||||||
|
; The number of seconds after which an idle process will be killed.
|
||||||
|
; Note: Used only when pm is set to 'ondemand'
|
||||||
|
; Default Value: 10s
|
||||||
|
;pm.process_idle_timeout = 10s;
|
||||||
|
|
||||||
|
; The number of requests each child process should execute before respawning.
|
||||||
|
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||||
|
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||||
|
; Default Value: 0
|
||||||
|
;pm.max_requests = 500
|
||||||
|
|
||||||
|
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||||
|
; recognized as a status page. It shows the following informations:
|
||||||
|
; pool - the name of the pool;
|
||||||
|
; process manager - static, dynamic or ondemand;
|
||||||
|
; start time - the date and time FPM has started;
|
||||||
|
; start since - number of seconds since FPM has started;
|
||||||
|
; accepted conn - the number of request accepted by the pool;
|
||||||
|
; listen queue - the number of request in the queue of pending
|
||||||
|
; connections (see backlog in listen(2));
|
||||||
|
; max listen queue - the maximum number of requests in the queue
|
||||||
|
; of pending connections since FPM has started;
|
||||||
|
; listen queue len - the size of the socket queue of pending connections;
|
||||||
|
; idle processes - the number of idle processes;
|
||||||
|
; active processes - the number of active processes;
|
||||||
|
; total processes - the number of idle + active processes;
|
||||||
|
; max active processes - the maximum number of active processes since FPM
|
||||||
|
; has started;
|
||||||
|
; max children reached - number of times, the process limit has been reached,
|
||||||
|
; when pm tries to start more children (works only for
|
||||||
|
; pm 'dynamic' and 'ondemand');
|
||||||
|
; Value are updated in real time.
|
||||||
|
; Example output:
|
||||||
|
; pool: www
|
||||||
|
; process manager: static
|
||||||
|
; start time: 01/Jul/2011:17:53:49 +0200
|
||||||
|
; start since: 62636
|
||||||
|
; accepted conn: 190460
|
||||||
|
; listen queue: 0
|
||||||
|
; max listen queue: 1
|
||||||
|
; listen queue len: 42
|
||||||
|
; idle processes: 4
|
||||||
|
; active processes: 11
|
||||||
|
; total processes: 15
|
||||||
|
; max active processes: 12
|
||||||
|
; max children reached: 0
|
||||||
|
;
|
||||||
|
; By default the status page output is formatted as text/plain. Passing either
|
||||||
|
; 'html', 'xml' or 'json' in the query string will return the corresponding
|
||||||
|
; output syntax. Example:
|
||||||
|
; http://www.foo.bar/status
|
||||||
|
; http://www.foo.bar/status?json
|
||||||
|
; http://www.foo.bar/status?html
|
||||||
|
; http://www.foo.bar/status?xml
|
||||||
|
;
|
||||||
|
; By default the status page only outputs short status. Passing 'full' in the
|
||||||
|
; query string will also return status for each pool process.
|
||||||
|
; Example:
|
||||||
|
; http://www.foo.bar/status?full
|
||||||
|
; http://www.foo.bar/status?json&full
|
||||||
|
; http://www.foo.bar/status?html&full
|
||||||
|
; http://www.foo.bar/status?xml&full
|
||||||
|
; The Full status returns for each process:
|
||||||
|
; pid - the PID of the process;
|
||||||
|
; state - the state of the process (Idle, Running, ...);
|
||||||
|
; start time - the date and time the process has started;
|
||||||
|
; start since - the number of seconds since the process has started;
|
||||||
|
; requests - the number of requests the process has served;
|
||||||
|
; request duration - the duration in µs of the requests;
|
||||||
|
; request method - the request method (GET, POST, ...);
|
||||||
|
; request URI - the request URI with the query string;
|
||||||
|
; content length - the content length of the request (only with POST);
|
||||||
|
; user - the user (PHP_AUTH_USER) (or '-' if not set);
|
||||||
|
; script - the main script called (or '-' if not set);
|
||||||
|
; last request cpu - the %cpu the last request consumed
|
||||||
|
; it's always 0 if the process is not in Idle state
|
||||||
|
; because CPU calculation is done when the request
|
||||||
|
; processing has terminated;
|
||||||
|
; last request memory - the max amount of memory the last request consumed
|
||||||
|
; it's always 0 if the process is not in Idle state
|
||||||
|
; because memory calculation is done when the request
|
||||||
|
; processing has terminated;
|
||||||
|
; If the process is in Idle state, then informations are related to the
|
||||||
|
; last request the process has served. Otherwise informations are related to
|
||||||
|
; the current request being served.
|
||||||
|
; Example output:
|
||||||
|
; ************************
|
||||||
|
; pid: 31330
|
||||||
|
; state: Running
|
||||||
|
; start time: 01/Jul/2011:17:53:49 +0200
|
||||||
|
; start since: 63087
|
||||||
|
; requests: 12808
|
||||||
|
; request duration: 1250261
|
||||||
|
; request method: GET
|
||||||
|
; request URI: /test_mem.php?N=10000
|
||||||
|
; content length: 0
|
||||||
|
; user: -
|
||||||
|
; script: /home/fat/web/docs/php/test_mem.php
|
||||||
|
; last request cpu: 0.00
|
||||||
|
; last request memory: 0
|
||||||
|
;
|
||||||
|
; Note: There is a real-time FPM status monitoring sample web page available
|
||||||
|
; It's available in: /usr/share/php/7.3/fpm/status.html
|
||||||
|
;
|
||||||
|
; Note: The value must start with a leading slash (/). The value can be
|
||||||
|
; anything, but it may not be a good idea to use the .php extension or it
|
||||||
|
; may conflict with a real PHP file.
|
||||||
|
; Default Value: not set
|
||||||
|
;pm.status_path = /status
|
||||||
|
|
||||||
|
; The ping URI to call the monitoring page of FPM. If this value is not set, no
|
||||||
|
; URI will be recognized as a ping page. This could be used to test from outside
|
||||||
|
; that FPM is alive and responding, or to
|
||||||
|
; - create a graph of FPM availability (rrd or such);
|
||||||
|
; - remove a server from a group if it is not responding (load balancing);
|
||||||
|
; - trigger alerts for the operating team (24/7).
|
||||||
|
; Note: The value must start with a leading slash (/). The value can be
|
||||||
|
; anything, but it may not be a good idea to use the .php extension or it
|
||||||
|
; may conflict with a real PHP file.
|
||||||
|
; Default Value: not set
|
||||||
|
;ping.path = /ping
|
||||||
|
|
||||||
|
; This directive may be used to customize the response of a ping request. The
|
||||||
|
; response is formatted as text/plain with a 200 response code.
|
||||||
|
; Default Value: pong
|
||||||
|
;ping.response = pong
|
||||||
|
|
||||||
|
; The access log file
|
||||||
|
; Default: not set
|
||||||
|
;access.log = log/$pool.access.log
|
||||||
|
|
||||||
|
; The access log format.
|
||||||
|
; The following syntax is allowed
|
||||||
|
; %%: the '%' character
|
||||||
|
; %C: %CPU used by the request
|
||||||
|
; it can accept the following format:
|
||||||
|
; - %{user}C for user CPU only
|
||||||
|
; - %{system}C for system CPU only
|
||||||
|
; - %{total}C for user + system CPU (default)
|
||||||
|
; %d: time taken to serve the request
|
||||||
|
; it can accept the following format:
|
||||||
|
; - %{seconds}d (default)
|
||||||
|
; - %{miliseconds}d
|
||||||
|
; - %{mili}d
|
||||||
|
; - %{microseconds}d
|
||||||
|
; - %{micro}d
|
||||||
|
; %e: an environment variable (same as $_ENV or $_SERVER)
|
||||||
|
; it must be associated with embraces to specify the name of the env
|
||||||
|
; variable. Some exemples:
|
||||||
|
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
|
||||||
|
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
|
||||||
|
; %f: script filename
|
||||||
|
; %l: content-length of the request (for POST request only)
|
||||||
|
; %m: request method
|
||||||
|
; %M: peak of memory allocated by PHP
|
||||||
|
; it can accept the following format:
|
||||||
|
; - %{bytes}M (default)
|
||||||
|
; - %{kilobytes}M
|
||||||
|
; - %{kilo}M
|
||||||
|
; - %{megabytes}M
|
||||||
|
; - %{mega}M
|
||||||
|
; %n: pool name
|
||||||
|
; %o: output header
|
||||||
|
; it must be associated with embraces to specify the name of the header:
|
||||||
|
; - %{Content-Type}o
|
||||||
|
; - %{X-Powered-By}o
|
||||||
|
; - %{Transfert-Encoding}o
|
||||||
|
; - ....
|
||||||
|
; %p: PID of the child that serviced the request
|
||||||
|
; %P: PID of the parent of the child that serviced the request
|
||||||
|
; %q: the query string
|
||||||
|
; %Q: the '?' character if query string exists
|
||||||
|
; %r: the request URI (without the query string, see %q and %Q)
|
||||||
|
; %R: remote IP address
|
||||||
|
; %s: status (response code)
|
||||||
|
; %t: server time the request was received
|
||||||
|
; it can accept a strftime(3) format:
|
||||||
|
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||||
|
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||||
|
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||||
|
; %T: time the log has been written (the request has finished)
|
||||||
|
; it can accept a strftime(3) format:
|
||||||
|
; %d/%b/%Y:%H:%M:%S %z (default)
|
||||||
|
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
|
||||||
|
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
|
||||||
|
; %u: remote user
|
||||||
|
;
|
||||||
|
; Default: "%R - %u %t \"%m %r\" %s"
|
||||||
|
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
||||||
|
|
||||||
|
; The log file for slow requests
|
||||||
|
; Default Value: not set
|
||||||
|
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||||
|
;slowlog = log/$pool.log.slow
|
||||||
|
|
||||||
|
; The timeout for serving a single request after which a PHP backtrace will be
|
||||||
|
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||||
|
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||||
|
; Default Value: 0
|
||||||
|
;request_slowlog_timeout = 0
|
||||||
|
|
||||||
|
; Depth of slow log stack trace.
|
||||||
|
; Default Value: 20
|
||||||
|
;request_slowlog_trace_depth = 20
|
||||||
|
|
||||||
|
; The timeout for serving a single request after which the worker process will
|
||||||
|
; be killed. This option should be used when the 'max_execution_time' ini option
|
||||||
|
; does not stop script execution for some reason. A value of '0' means 'off'.
|
||||||
|
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||||
|
; Default Value: 0
|
||||||
|
;request_terminate_timeout = 0
|
||||||
|
|
||||||
|
; The timeout set by 'request_terminate_timeout' ini option is not engaged after
|
||||||
|
; application calls 'fastcgi_finish_request' or when application has finished and
|
||||||
|
; shutdown functions are being called (registered via register_shutdown_function).
|
||||||
|
; This option will enable timeout limit to be applied unconditionally
|
||||||
|
; even in such cases.
|
||||||
|
; Default Value: no
|
||||||
|
;request_terminate_timeout_track_finished = no
|
||||||
|
|
||||||
|
; Set open file descriptor rlimit.
|
||||||
|
; Default Value: system defined value
|
||||||
|
;rlimit_files = 1024
|
||||||
|
|
||||||
|
; Set max core size rlimit.
|
||||||
|
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
||||||
|
; Default Value: system defined value
|
||||||
|
;rlimit_core = 0
|
||||||
|
|
||||||
|
; Chroot to this directory at the start. This value must be defined as an
|
||||||
|
; absolute path. When this value is not set, chroot is not used.
|
||||||
|
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
||||||
|
; of its subdirectories. If the pool prefix is not set, the global prefix
|
||||||
|
; will be used instead.
|
||||||
|
; Note: chrooting is a great security feature and should be used whenever
|
||||||
|
; possible. However, all PHP paths will be relative to the chroot
|
||||||
|
; (error_log, sessions.save_path, ...).
|
||||||
|
; Default Value: not set
|
||||||
|
;chroot =
|
||||||
|
|
||||||
|
; Chdir to this directory at the start.
|
||||||
|
; Note: relative path can be used.
|
||||||
|
; Default Value: current directory or / when chroot
|
||||||
|
;chdir = /var/www
|
||||||
|
|
||||||
|
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||||
|
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||||
|
; Note: on highloaded environement, this can cause some delay in the page
|
||||||
|
; process time (several ms).
|
||||||
|
; Default Value: no
|
||||||
|
;catch_workers_output = yes
|
||||||
|
|
||||||
|
; Decorate worker output with prefix and suffix containing information about
|
||||||
|
; the child that writes to the log and if stdout or stderr is used as well as
|
||||||
|
; log level and time. This options is used only if catch_workers_output is yes.
|
||||||
|
; Settings to "no" will output data as written to the stdout or stderr.
|
||||||
|
; Default value: yes
|
||||||
|
;decorate_workers_output = no
|
||||||
|
|
||||||
|
; Clear environment in FPM workers
|
||||||
|
; Prevents arbitrary environment variables from reaching FPM worker processes
|
||||||
|
; by clearing the environment in workers before env vars specified in this
|
||||||
|
; pool configuration are added.
|
||||||
|
; Setting to "no" will make all environment variables available to PHP code
|
||||||
|
; via getenv(), $_ENV and $_SERVER.
|
||||||
|
; Default Value: yes
|
||||||
|
;clear_env = no
|
||||||
|
|
||||||
|
; Limits the extensions of the main script FPM will allow to parse. This can
|
||||||
|
; prevent configuration mistakes on the web server side. You should only limit
|
||||||
|
; FPM to .php extensions to prevent malicious users to use other extensions to
|
||||||
|
; execute php code.
|
||||||
|
; Note: set an empty value to allow all extensions.
|
||||||
|
; Default Value: .php
|
||||||
|
;security.limit_extensions = .php .php3 .php4 .php5 .php7
|
||||||
|
|
||||||
|
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
||||||
|
; the current environment.
|
||||||
|
; Default Value: clean env
|
||||||
|
;env[HOSTNAME] = $HOSTNAME
|
||||||
|
;env[PATH] = /usr/local/bin:/usr/bin:/bin
|
||||||
|
;env[TMP] = /tmp
|
||||||
|
;env[TMPDIR] = /tmp
|
||||||
|
;env[TEMP] = /tmp
|
||||||
|
|
||||||
|
; Additional php.ini defines, specific to this pool of workers. These settings
|
||||||
|
; overwrite the values previously defined in the php.ini. The directives are the
|
||||||
|
; same as the PHP SAPI:
|
||||||
|
; php_value/php_flag - you can set classic ini defines which can
|
||||||
|
; be overwritten from PHP call 'ini_set'.
|
||||||
|
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
||||||
|
; PHP call 'ini_set'
|
||||||
|
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
||||||
|
|
||||||
|
; Defining 'extension' will load the corresponding shared extension from
|
||||||
|
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
|
||||||
|
; overwrite previously defined php.ini values, but will append the new value
|
||||||
|
; instead.
|
||||||
|
|
||||||
|
; Note: path INI options can be relative and will be expanded with the prefix
|
||||||
|
; (pool, global or /usr)
|
||||||
|
|
||||||
|
; Default Value: nothing is defined by default except the values in php.ini and
|
||||||
|
; specified at startup with the -d argument
|
||||||
|
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
|
||||||
|
;php_flag[display_errors] = off
|
||||||
|
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
||||||
|
;php_admin_flag[log_errors] = on
|
||||||
|
;php_admin_value[memory_limit] = 32M
|
||||||
Reference in New Issue
Block a user