worpdress container is running
This commit is contained in:
@@ -21,7 +21,8 @@
|
|||||||
---
|
---
|
||||||
## questions
|
## questions
|
||||||
|
|
||||||
- ? what means mounted in "a file or directory on the host machine is mounted into a container" ?
|
- ? why http to https redirection doesn't works ?
|
||||||
|
- ? what means "a file or directory on the host machine is mounted into a container" ?
|
||||||
- ? why the volumes cannot be modify outside docker ?
|
- ? why the volumes cannot be modify outside docker ?
|
||||||
- ? `rm -rf /var/lib/apt/lists/*` ?
|
- ? `rm -rf /var/lib/apt/lists/*` ?
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@
|
|||||||
- [using DEBIAN_FRONTEND=noninteractive disouraged in dockerfile](https://bobcares.com/blog/debian_frontendnoninteractive-docker/)
|
- [using DEBIAN_FRONTEND=noninteractive disouraged in dockerfile](https://bobcares.com/blog/debian_frontendnoninteractive-docker/)
|
||||||
- [docker network](https://docs.docker.com/network/)
|
- [docker network](https://docs.docker.com/network/)
|
||||||
- [depends_on](https://docs.docker.com/compose/compose-file/#depends_on)
|
- [depends_on](https://docs.docker.com/compose/compose-file/#depends_on)
|
||||||
|
- [compose and env var](https://docs.docker.com/compose/environment-variables/)
|
||||||
|
|
||||||
###### docker pid 1
|
###### docker pid 1
|
||||||
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
|
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
|
||||||
@@ -153,6 +155,7 @@
|
|||||||
- [command line parameters](https://nginx.org/en/docs/switches.html)
|
- [command line parameters](https://nginx.org/en/docs/switches.html)
|
||||||
- `sudo nginx -t` will launch a test to evaluate config file
|
- `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 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)
|
||||||
|
|
||||||
#### openssl
|
#### openssl
|
||||||
- [openssl faq](https://www.openssl.org/docs/faq.html)
|
- [openssl faq](https://www.openssl.org/docs/faq.html)
|
||||||
|
|||||||
@@ -13,40 +13,41 @@ services:
|
|||||||
#restart: on-failure
|
#restart: on-failure
|
||||||
ports:
|
ports:
|
||||||
- "443:443"
|
- "443:443"
|
||||||
|
- "80:80"
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: mynginx
|
container_name: mynginx
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# mariadb:
|
mariadb:
|
||||||
# #restart: on-failure
|
#restart: on-failure
|
||||||
# networks:
|
networks:
|
||||||
# - inception-network
|
- inception-network
|
||||||
# env_file: .env
|
env_file: .env
|
||||||
# build:
|
build:
|
||||||
# context: ./requirements/mariadb
|
context: ./requirements/mariadb
|
||||||
# args:
|
args:
|
||||||
# - DB_NAME=${DB_NAME}
|
- DB_NAME=${DB_NAME}
|
||||||
# - DB_USER=${DB_USER}
|
- DB_USER=${DB_USER}
|
||||||
# - DB_PSWD=${DB_PSWD}
|
- DB_PSWD=${DB_PSWD}
|
||||||
# image: mariadb
|
image: mariadb
|
||||||
# container_name: mymariadb
|
container_name: mymariadb
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# wordpress:
|
wordpress:
|
||||||
# #restart: on-failure
|
#restart: on-failure
|
||||||
# networks:
|
# networks:
|
||||||
# - inception-network
|
# - inception-network
|
||||||
# env_file: .env
|
env_file: ./.env
|
||||||
# build:
|
build: ./requirements/wordpress
|
||||||
# context: ./requirements/wordpress
|
# context: ./requirements/wordpress
|
||||||
# args:
|
# args:
|
||||||
# - WP_DIR=${WP_DIR}
|
# - WP_DIR=${WP_DIR}
|
||||||
## depends_on:
|
# depends_on:
|
||||||
## mariadb:
|
# mariadb:
|
||||||
## condition: service_completed_successfully
|
# condition: service_completed_successfully
|
||||||
# image: wordpress
|
image: wordpress
|
||||||
# container_name: mywordpress
|
container_name: mywordpress
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
inception-network:
|
inception-network:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#
|
#
|
||||||
# # nginx conf
|
# # nginx conf
|
||||||
# COPY ./conf/nginx_debian.conf /etc/nginx/nginx.conf
|
# COPY ./conf/nginx_debian.conf /etc/nginx/nginx.conf
|
||||||
|
# COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
# alpine (~ 45s) ---------------------------------------------
|
# alpine (~ 45s) ---------------------------------------------
|
||||||
|
|
||||||
@@ -25,11 +26,11 @@
|
|||||||
|
|
||||||
# nginx conf
|
# nginx conf
|
||||||
COPY ./conf/nginx_alpine.conf /etc/nginx/nginx.conf
|
COPY ./conf/nginx_alpine.conf /etc/nginx/nginx.conf
|
||||||
|
COPY ./conf/inception_nginx.conf /etc/nginx/http.d/
|
||||||
|
|
||||||
# common -----------------------------------------------------
|
# common -----------------------------------------------------
|
||||||
|
|
||||||
# inception conf & personalized index.html
|
# personalized index.html
|
||||||
COPY ./conf/inception_nginx.conf /etc/nginx/conf.d/
|
|
||||||
COPY ./conf/index.html /data/www/
|
COPY ./conf/index.html /data/www/
|
||||||
|
|
||||||
# create ssl certificate
|
# create ssl certificate
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
# doc : https://nginx.org/en/docs/dirindex.html
|
# 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 {
|
server {
|
||||||
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||||
listen [::]:443 ssl; # for ipv6
|
listen [::]:443 ssl; # for ipv6
|
||||||
@@ -7,23 +15,23 @@ server {
|
|||||||
ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
|
ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt; # specifies the file with the ssl certificate (self signed here) generated by openssl
|
||||||
ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key; # specifies the file with the secret key of the certificate
|
ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key; # specifies the file with the secret key of the certificate
|
||||||
|
|
||||||
root /var/www/html/; # contains default nginx index.nginx-debian.html
|
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)
|
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 / {
|
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
|
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
|
||||||
root /data/www/;
|
root /data/www/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# pass PHP scripts to FastCGI (PHP-FPM) server
|
# pass PHP scripts to FastCGI (PHP-FPM) server
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
include /etc/nginx/fastcgi.conf;
|
include /etc/nginx/fastcgi.conf;
|
||||||
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
# fastcgi_pass wordpress:9000;
|
#fastcgi_pass wordpress:9000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
|
|
||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
|
|
||||||
|
# bash and vim for debug
|
||||||
RUN apt update && apt install -y \
|
RUN apt update && apt install -y \
|
||||||
php7.3 \
|
php7.3 \
|
||||||
php7.3-fpm \
|
php7.3-fpm \
|
||||||
php7.3-mysqli \
|
php7.3-mysqli \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
curl
|
curl \
|
||||||
|
bash vim
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# config change address to accept FastCGI requests, to worpress:9000
|
# fpm config
|
||||||
COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
|
COPY ./conf/www.conf /etc/php/7.3/fpm/pool.d/
|
||||||
RUN mkdir /run/php/
|
RUN mkdir /run/php/
|
||||||
## run service once to initialize
|
|
||||||
#RUN service php7.3-fpm start && \
|
|
||||||
# service php7.3-fpm stop
|
|
||||||
|
|
||||||
# install wp-cli : https://make.wordpress.org/cli/handbook/guides/installing/
|
# install wp-cli : https://make.wordpress.org/cli/handbook/guides/installing/
|
||||||
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
## install wordpress with cli : https://make.wordpress.org/cli/handbook/how-to-install/
|
||||||
mkdir -p ${WP_DIR}
|
mkdir -p ${WP_DIR}
|
||||||
wp core download --path="${WP_DIR}" --allow-root
|
wp core download --path="${WP_DIR}" --allow-root
|
||||||
|
|
||||||
@@ -21,10 +21,14 @@ wp core install \
|
|||||||
--admin_password="${WP_ADMIN_PSWD}" \
|
--admin_password="${WP_ADMIN_PSWD}" \
|
||||||
--skip-email \
|
--skip-email \
|
||||||
--path="${WP_DIR}" --allow-root
|
--path="${WP_DIR}" --allow-root
|
||||||
|
|
||||||
|
## create user :
|
||||||
wp user create \
|
wp user create \
|
||||||
${WP_USER} ${WP_USER_EMAIL} \
|
${WP_USER} ${WP_USER_EMAIL} \
|
||||||
--user_pass=${WP_USER_PSWD} \
|
--user_pass=${WP_USER_PSWD} \
|
||||||
--path=${WP_DIR} --allow-root
|
--path=${WP_DIR} --allow-root
|
||||||
chown -R www-data:www-data /var/www/*
|
chown -R nginx:nginx /var/www/*
|
||||||
chmod 755 -R /var/www/*
|
chmod 755 -R /var/www/*
|
||||||
|
|
||||||
|
exec php-fpm7.3 -F
|
||||||
|
#exec php-fpm7.3 --nodaemonize
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
; inception modifications :
|
||||||
|
; listen :
|
||||||
|
; < listen = wordpress:9000
|
||||||
|
; > listen = /run/php/php7.3-fpm.sock
|
||||||
|
|
||||||
|
|
||||||
; Start a new pool named 'www'.
|
; Start a new pool named 'www'.
|
||||||
; the variable $pool can be used in any directive and will be replaced by the
|
; the variable $pool can be used in any directive and will be replaced by the
|
||||||
; pool name ('www' here)
|
; pool name ('www' here)
|
||||||
|
|||||||
Reference in New Issue
Block a user