re-added gestion for plugins volume outside folder
This commit is contained in:
1
Makefile
1
Makefile
@@ -33,6 +33,7 @@ SOURCE_ENV := . $(ENV_PATH)
|
|||||||
# list of volumes
|
# list of volumes
|
||||||
VOLUME_ENV := set | grep "^HOST_VOLUME_" | cut -d "=" -f 2
|
VOLUME_ENV := set | grep "^HOST_VOLUME_" | cut -d "=" -f 2
|
||||||
VOLUMES_D = $(shell $(SOURCE_ENV) ; $(VOLUME_ENV) )
|
VOLUMES_D = $(shell $(SOURCE_ENV) ; $(VOLUME_ENV) )
|
||||||
|
VOLUMES_D += $(shell $(SOURCE_ENV) ; echo $$HOST_VOLUMES_DIR )
|
||||||
# url for wordpress, use in makefile to change local
|
# url for wordpress, use in makefile to change local
|
||||||
WP_URL = $(shell $(SOURCE_ENV) ; echo $$WP_URL )
|
WP_URL = $(shell $(SOURCE_ENV) ; echo $$WP_URL )
|
||||||
WP_COMPLETE_URL = $(shell $(SOURCE_ENV) ; echo $$WP_COMPLETE_URL )
|
WP_COMPLETE_URL = $(shell $(SOURCE_ENV) ; echo $$WP_COMPLETE_URL )
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
### to start :
|
||||||
|
|
||||||
this repo uses submodule fo `env_generator`, so after cloning you need to do :
|
this repo uses submodule fo `env_generator`, so after cloning you need to do :
|
||||||
```
|
```
|
||||||
git submodule init
|
git submodule init
|
||||||
@@ -9,3 +11,14 @@ or
|
|||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PLUGINS :
|
||||||
|
|
||||||
|
- this wordpress container allow you to have a plugins repository outside of
|
||||||
|
- by default it's in the parent repo :
|
||||||
|
- parent-repo/
|
||||||
|
- stuff..
|
||||||
|
- plugins/
|
||||||
|
- wordpress_docker/
|
||||||
|
- stuff..
|
||||||
|
- you can change its location inside `model.env`
|
||||||
|
- this plugin repository is a volume, so changes inside of it takes immediat effect
|
||||||
|
|||||||
@@ -17,13 +17,14 @@ services:
|
|||||||
- "${WP_PORT}:443"
|
- "${WP_PORT}:443"
|
||||||
volumes:
|
volumes:
|
||||||
- wp_volume:${WP_VOLUME_DIR}
|
- wp_volume:${WP_VOLUME_DIR}
|
||||||
|
- wp_plugins:${WP_VOLUME_PLUGINS}
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
args:
|
args:
|
||||||
- WP_URL=${WP_URL}
|
- WP_URL=${WP_URL}
|
||||||
- SERVER_MAX_UPLOAD_SIZE=${SERVER_MAX_UPLOAD_SIZE}
|
- SERVER_MAX_UPLOAD_SIZE=${SERVER_MAX_UPLOAD_SIZE}
|
||||||
- WP_VOLUME_DIR=${WP_VOLUME_DIR}
|
- WP_VOLUME_DIR=${WP_VOLUME_DIR}
|
||||||
- NG_VOLUME_CERTS=${NG_VOLUME_CERTS}
|
- NG_CERTS_DIR=${NG_CERTS_DIR}
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: nginx_container
|
container_name: nginx_container
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -59,6 +60,7 @@ services:
|
|||||||
- inception
|
- inception
|
||||||
volumes:
|
volumes:
|
||||||
- wp_volume:${WP_VOLUME_DIR}
|
- wp_volume:${WP_VOLUME_DIR}
|
||||||
|
- wp_plugins:${WP_VOLUME_PLUGINS}
|
||||||
build:
|
build:
|
||||||
context: ./requirements/wordpress
|
context: ./requirements/wordpress
|
||||||
args:
|
args:
|
||||||
@@ -84,6 +86,12 @@ volumes:
|
|||||||
type: none
|
type: none
|
||||||
o: "bind"
|
o: "bind"
|
||||||
device: ${HOST_VOLUME_WP}
|
device: ${HOST_VOLUME_WP}
|
||||||
|
wp_plugins:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
type: none
|
||||||
|
o: "bind"
|
||||||
|
device: ${HOST_VOLUME_PLUGINS}
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
inception:
|
inception:
|
||||||
|
|||||||
Submodule srcs/env_generator updated: d26a2b2902...536900d1f9
@@ -12,7 +12,7 @@ SERVER_MAX_UPLOAD_SIZE=512
|
|||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# NGINX SETUP
|
# NGINX SETUP
|
||||||
|
|
||||||
NG_VOLUME_CERTS=/etc/ssl
|
NG_CERTS_DIR=/etc/ssl
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
@@ -36,7 +36,7 @@ if [ ! ${WP_PORT} -eq 443 ]; then
|
|||||||
WP_COMPLETE_URL="${WP_URL}:${WP_PORT}"
|
WP_COMPLETE_URL="${WP_URL}:${WP_PORT}"
|
||||||
fi
|
fi
|
||||||
WP_VOLUME_DIR=/var/www/html
|
WP_VOLUME_DIR=/var/www/html
|
||||||
#WP_VOLUME_PLUGINS=/home/www-data
|
WP_VOLUME_PLUGINS=/home/www-data
|
||||||
WP_TITLE=title
|
WP_TITLE=title
|
||||||
WP_ADMIN=admin
|
WP_ADMIN=admin
|
||||||
WP_ADMIN_PSWD="you shall not password !"
|
WP_ADMIN_PSWD="you shall not password !"
|
||||||
@@ -73,10 +73,17 @@ WP_ADMIN_EMAIL=admin@email.fr
|
|||||||
# - because "~username" expand in the home (~) directory of given user
|
# - because "~username" expand in the home (~) directory of given user
|
||||||
# https://stackoverflow.com/questions/77088135/makefile-subst-doesnt-use-make-variable-as-expected
|
# https://stackoverflow.com/questions/77088135/makefile-subst-doesnt-use-make-variable-as-expected
|
||||||
HOST_HOME_PATH=$(eval echo "~$SUDO_USER")
|
HOST_HOME_PATH=$(eval echo "~$SUDO_USER")
|
||||||
|
# path to the docker folder containing the srcs/ dir
|
||||||
|
HOST_DOCKER_PATH=$(realpath ${DIR_PATH}/..)
|
||||||
|
HOST_DOCKER_PARENT_PATH=$(realpath ${DIR_PATH}/../..)
|
||||||
|
|
||||||
# makefile will create the volumes folders
|
# makefile will create the volumes folders
|
||||||
# we put them inside a volumes/ dir, sibling to the srcs/ dir
|
# we put them inside a volumes/ dir, sibling to the srcs/ dir
|
||||||
HOST_VOLUMES_DIR=$(realpath ${DIR_PATH}/../volumes)
|
# there can be only one variable named "HOST_VOLUMES_DIR", or change the Makefile
|
||||||
|
HOST_VOLUMES_DIR=${HOST_DOCKER_PATH}/volumes
|
||||||
HOST_VOLUME_WP=${HOST_VOLUMES_DIR}/wp_volume
|
HOST_VOLUME_WP=${HOST_VOLUMES_DIR}/wp_volume
|
||||||
HOST_VOLUME_DB=${HOST_VOLUMES_DIR}/db_volume
|
HOST_VOLUME_DB=${HOST_VOLUMES_DIR}/db_volume
|
||||||
|
# we put the plugin folder inside the parent folder of the docker dir
|
||||||
|
HOST_VOLUME_PLUGINS=${HOST_DOCKER_PARENT_PATH}/plugins
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ RUN adduser -S www-data && \
|
|||||||
# ARG variables are not persistent after the build process, in opposite to ENV
|
# ARG variables are not persistent after the build process, in opposite to ENV
|
||||||
ARG WP_URL
|
ARG WP_URL
|
||||||
ARG WP_VOLUME_DIR
|
ARG WP_VOLUME_DIR
|
||||||
ARG NG_VOLUME_CERTS
|
ARG NG_CERTS_DIR
|
||||||
ARG SERVER_MAX_UPLOAD_SIZE
|
ARG SERVER_MAX_UPLOAD_SIZE
|
||||||
|
|
||||||
# replace WP_URL
|
# replace WP_URL
|
||||||
@@ -42,10 +42,10 @@ RUN sed -i "s/\(client_max_body_size \).*\(m;\)/\1${SERVER_MAX_UPLOAD_SIZE}\2/g"
|
|||||||
# - C, ST, L, O, OU, CN : country, state, locality, organization, organizational unit, and common name
|
# - C, ST, L, O, OU, CN : country, state, locality, organization, organizational unit, and common name
|
||||||
# - keyout : the filename for the private key file
|
# - keyout : the filename for the private key file
|
||||||
# - out : the filename for the output certificate file
|
# - out : the filename for the output certificate file
|
||||||
ARG SSL_KEY=${NG_VOLUME_CERTS}/private/${WP_URL}.key
|
ARG SSL_KEY=${NG_CERTS_DIR}/private/${WP_URL}.key
|
||||||
ARG SSL_CERT=${NG_VOLUME_CERTS}/certs/${WP_URL}.crt
|
ARG SSL_CERT=${NG_CERTS_DIR}/certs/${WP_URL}.crt
|
||||||
RUN mkdir -p ${NG_VOLUME_CERTS}; \
|
RUN mkdir -p ${NG_CERTS_DIR}; \
|
||||||
cd ${NG_VOLUME_CERTS}; \
|
cd ${NG_CERTS_DIR}; \
|
||||||
mkdir private certs; \
|
mkdir private certs; \
|
||||||
openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
|
openssl req -newkey rsa:2048 -nodes -x509 -days 365 \
|
||||||
-subj "/C=fr/ST=ile-de-france/L=paris/O=wp/OU=wp_local/CN=${WP_URL}" \
|
-subj "/C=fr/ST=ile-de-france/L=paris/O=wp/OU=wp_local/CN=${WP_URL}" \
|
||||||
|
|||||||
@@ -58,6 +58,12 @@ then
|
|||||||
chown -R www-data:www-data /var/www/*
|
chown -R www-data:www-data /var/www/*
|
||||||
chmod 755 -R /var/www/*
|
chmod 755 -R /var/www/*
|
||||||
|
|
||||||
|
echo -e ${YELLOW}plugins...${RESET}
|
||||||
|
plugins=$(ls ${WP_VOLUME_PLUGINS})
|
||||||
|
for dir in $plugins; do
|
||||||
|
ln -s ${WP_VOLUME_PLUGINS}/$dir ${WP_VOLUME_DIR}/wp-content/plugins/$dir
|
||||||
|
done
|
||||||
|
|
||||||
echo -e ${GREEN}done !${RESET}
|
echo -e ${GREEN}done !${RESET}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user