wordpress

This commit is contained in:
afornerot 2024-07-05 23:01:17 +02:00
parent d512815aba
commit 244f961ce9
258 changed files with 359 additions and 209 deletions

2
.env
View File

@ -1,2 +0,0 @@
PODBIN=docker
PODCOMPOSEBIN=docker-compose

33
.gitignore vendored
View File

@ -4,14 +4,41 @@
/volume/mariadb/mysql
/volume/minio/data
/volume/nextcloud/data
/volume/nextcloud/html
/volume/nextcloud/app
/volume/ninegate/data
/volume/ninegate/data
/volume/ninegate/data/private/*
!/volume/ninegate/data/private/.gitkeep
/volume/ninegate/data/public/*
!/volume/ninegate/data/public/avatar
/volume/ninegate/data/public/avatar/*
!/volume/ninegate/data/public/avatar/admin.jpg
!/volume/ninegate/data/public/avatar/noavatar.png
!/volume/ninegate/data/public/avatar/system.jpg
!/volume/ninegate/data/public/logo
/volume/ninegate/data/public/logo/*
!/volume/ninegate/data/public/logo/logo.png
!/volume/ninegate/data/public/header
/volume/ninegate/data/public/header/*
!/volume/ninegate/data/public/header/header.png
!/volume/ninegate/data/public/icon
/volume/ninegate/data/public/icon/*
!/volume/ninegate/data/public/icon/icon_*.png
/volume/nineboard/data
/volume/nineboard/data/private/*
!/volume/nineboard/data/private/.gitkeep
/volume/nineboard/data/public/*
!/volume/nineboard/data/public/avatar
/volume/nineboard/data/public/avatar/*
!/volume/nineboard/data/public/avatar/admin.jpg
!/volume/nineboard/data/public/avatar/noavatar.png
!/volume/nineboard/data/public/avatar/system.jpg
!/volume/nineboard/data/public/logo
/volume/nineboard/data/public/logo/*
!/volume/nineboard/data/public/logo/logo.png
/volume/openldap/data

View File

@ -1,6 +1,22 @@
version: '3'
services:
nineapache:
image: reg.cadoles.com/envole/nineapache:8.1
container_name: nine-nineapache
restart: always
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
env_file: ./tmp/.env.nineapache
networks:
- nine-network
ports:
- "80:80"
volumes:
- ./volume/nineapache/nine/apache.conf:/etc/apache2/conf.d/zapp.conf
mariadb:
image: docker.io/library/mariadb
container_name: nine-mariadb
@ -18,6 +34,28 @@ services:
- ./volume/mariadb/mysql:/var/lib/mysql
- ./volume/mariadb/nine:/nine
redis:
image: redis:4.0
container_name: nine-redis
ports:
- 6379:6379
environment:
- TZ=Europe/Paris
minio:
image: minio/minio
container_name: nine-minio
restart: always
env_file: ./tmp/.env.minio
networks:
- nine-network
ports:
- '7200:9000'
- '7201:9001'
volumes:
- './volume/minio/data:/data'
command: server /data --console-address ":9001"
openldap:
image: docker.io/bitnami/openldap:2
container_name: nine-openldap
@ -127,7 +165,9 @@ services:
timeout: 60s
env_file: ./tmp/.env.wordpress
networks:
- nine-network
nine-network:
aliases:
- blog
ports:
- "9003:80"
volumes:
@ -153,20 +193,8 @@ services:
ports:
- "9101:80"
nineapache:
image: reg.cadoles.com/envole/nineapache:7.4
container_name: nine-nineapache
restart: always
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
env_file: ./tmp/.env.nineapache
networks:
- nine-network
ports:
- "9102:80"
networks:
nine-network:
name: nine-network

40
env/.env vendored
View File

@ -5,6 +5,7 @@
# votre localhost devra aussi disposer d'un certificat
# si vous changer le web_url penser à modifier nine.local par votre web_url dans volume/keycloak/nine/realm-export.json
# sinon il vous faudra vous connecter à keycloak pour changer l'url du client nine
# Si vous souhaitez faire marcher wordpress il est indispensable que nineapache écoute soit le port 80 ou 443
# RELEASE SYSTEM = linux ou eole si eole le réseau du compose sera supprimé et regénéré à chaque UP
RELEASE_SYSTEM=linux
@ -12,7 +13,7 @@ RELEASE_SYSTEM=linux
# GLOBAL
APP_ENV=PROD
WEB_URL=nine.local
PROTOCOLE=https
PROTOCOLE=http
# ADMIN USER
ADMIN_USER=admin
@ -24,7 +25,13 @@ MASTERIDENTITY=SQL
# AUTHENTIFICATION
# SQL or CAS (todo LDAP or OPENID)
MODE_AUTH=CAS
MODE_AUTH=SQL
# NINEAPACHE
# Il sert de reverse proxy
NINEAPACHE_SERVICE_NAME=nineapache
NINEAPACHE_ACTIVATE=1
NINEAPACHE_LOCAL=1
# MARIADB
MARIADB_SERVICE_NAME=mariadb
@ -34,6 +41,20 @@ MARIADB_ROOT_PASSWORD=${ADMIN_PASSWORD}
MARIADB_USER=user
MARIADB_PASSWORD=${ADMIN_PASSWORD}
# REDIS
REDIS_SERVICE_NAME=redis
REDIS_ACTIVATE=1
REDIS_LOCAL=1
# MINIO
MINIO_SERVICE_NAME=minio
MINIO_ACTIVATE=1
MINIO_LOCAL=1
MINIO_HOST=${MINIO_SERVICE_NAME}
MINIO_PORT=7200
MINIO_URL=${PROTOCOLE}://${WEB_URL}/minio
# LDAP
# LDAP_SYNC Si MASTERIDENTITY = SQL permet la synchronisation des utilisateurs SQL vers LDAP
OPENLDAP_SERVICE_NAME=openldap
@ -60,7 +81,7 @@ LDAP_DISPLAYNAME=displayName
LDAP_EMAIL=mail
LDAP_MEMBER=memberUid
LDAP_USER_FILTER="(&(${LDAP_USERNAME}=*)(objectClass=person)(!(description=Computer)))"
LDAP_LOGIN_FILTER="(&(${LDAP_USERNAME}=%uid)(objectClass=person)(!(description=Computer)))"
LDAP_LOGIN_FILTER="(&(${LDAP_USERNAME}=%uid%)(objectClass=person)(!(description=Computer)))"
LDAP_GROUP_FILTER="(&(objectClass=posixGroup))"
SCRIBE_GROUP=1
SCRIBE_MASTER=1
@ -75,7 +96,7 @@ CAS_LOCAL=1
CAS_USER=${ADMIN_USER}-keycloak
CAS_PASSWORD=${ADMIN_PASSWORD}-keycloak
CAS_HOST=${WEB_URL}
CAS_PORT=443
CAS_PORT=8999
CAS_PATH=/auth/realms/nine/protocol/cas
CAS_URL=${PROTOCOLE}://${CAS_HOST}:${CAS_PORT}
@ -106,19 +127,12 @@ WORDPRESS_URL=${PROTOCOLE}://${WEB_URL}/wordpress
# ADMINER
ADMINER_SERVICE_NAME=adminer
ADMINER_ACTIVATE=0
ADMINER_ACTIVATE=1
ADMINER_LOCAL=1
ADMINER_URL=${PROTOCOLE}://${WEB_URL}/adminer/?server=${MARIADB_SERVICE_NAME}&username=${MARIADB_USER}
# PHPLDAPADMIN
PHPLDAPADMIN_SERVICE_NAME=phpldapadmin
PHPLDAPADMIN_ACTIVATE=0
PHPLDAPADMIN_ACTIVATE=1
PHPLDAPADMIN_LOCAL=1
PHPLDAPADMIN_URL=${PROTOCOLE}://${WEB_URL}/phpldapadmin
# NINEAPACHE
NINEAPACHE_SERVICE_NAME=nineapache
NINEAPACHE_ACTIVATE=0
NINEAPACHE_LOCAL=1
NINEAPACHE_URL=${PROTOCOLE}://${WEB_URL}:9102

3
env/.env.zapp.minio vendored Normal file
View File

@ -0,0 +1,3 @@
MINIO_ROOT_USER=${ADMIN_USER}
MINIO_ROOT_PASSWORD=${ADMIN_PASSWORD}
MINIO_DEFAULT_BUCKETS=nine

View File

@ -3,5 +3,5 @@
PHPLDAPADMIN_LDAP_HOSTS=ldap://${LDAP_HOST}:${LDAP_PORT}
PHPLDAPADMIN_HTTPS="false"
PHPLDAPADMIN_SERVER_PATH=
PHPLDAPADMIN_SERVER_PATH=/phpldapadmin

View File

@ -0,0 +1,59 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Require all granted
</Proxy>
ProxyPass /auth http://keycloak:8999/auth retry=0 keepalive=On
ProxyPassReverse /auth http://keycloak:8999/auth retry=0
ProxyPass /ninegate http://ninegate/ninegate retry=0 keepalive=On
ProxyPassReverse /ninegate http://ninegate/ninegate retry=0
ProxyPass /wssninegate ws://ninegate/wssninegate retry=0 keepalive=On
ProxyPassReverse /wssninegate ws://ninegate/wssninegate retry=0
ProxyPass /nextcloud http://nextcloud retry=0 keepalive=On
ProxyPassReverse /nextcloud http://nextcloud retry=0
ProxyPass /nineboard http://nineboard/nineboard retry=0 keepalive=On
ProxyPassReverse /nineboard http://nineboard/nineboard retry=0
ProxyPass /wssnineboard ws://nineboard/wssnineboard retry=0 keepalive=On
ProxyPassReverse /wssnineboard ws://nineboard/wssnineboard retry=0
ProxyPass /wordpress http://wordpress/wordpress retry=0 keepalive=On
ProxyPassReverse /wordpress http://wordpress/wordpress retry=0
ProxyPass /adminer http://adminer:8080 retry=0 keepalive=On
ProxyPassReverse /adminer http://adminer:8080 retry=0
ProxyPass /phpldapadmin http://phpldapadmin/phpldapadmin retry=0 keepalive=On
ProxyPassReverse /phpldapadmin http://phpldapadmin/phpldapadmin retry=0
RequestHeader set X-Forwarded-Host "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-Server "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
RequestHeader set Host "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-Proto "http"
DocumentRoot "/app/public"
<Directory "/app/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</Directory>

View File

@ -1,67 +0,0 @@
#!/bin/bash
set -eo pipefail
cd /app/public
if [[ ! -f /app/public/wp-config.php ]]
then
wp config create \
--allow-root \
--dbhost="${WORDPRESS_DB_HOST}" \
--dbname="${WORDPRESS_DB_NAME}" \
--dbuser="${WORDPRESS_DB_USER}" \
--dbpass="${WORDPRESS_DB_PASSWORD}" \
--dbcharset="utf8mb4" \
--locale="fr_FR"
fi
wp core multisite-install \
--allow-root \
--url="${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}" \
--title="${WORDPRESS_TITLE}" \
--admin_user="${WORDPRESS_USER}" \
--admin_password="${WORDPRESS_PASSWORD}" \
--admin_email="${WORDPRESS_EMAIL}" \
--skip-email
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
wp config set --allow-root WP_ALLOW_MULTISITE true
wp config set --allow-root MULTISITE true
wp config set --allow-root SUBDOMAIN_INSTALL false
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
wp config set --allow-root FORCE_ADMIN_SSL false
wp config set --allow-root SITE_ID_CURRENT_SITE 1
wp config set --allow-root BLOG_ID_CURRENT_SITE 1
# On fait croire à WP qu'il est en https
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
then
echo "FORCE HTTPS already set"
fi
else
if [[ "${WORDPRESS_PROTOCOL}" == "https" ]]
then
echo "FORCE HTTPS set"
head -n 1 "wp-config.php" > "wp-config.tmp"
echo "\$_SERVER['HTTPS']='on';" >> "wp-config.tmp"
tail -n +2 "wp-config.php" >> "wp-config.tmp"
mv "wp-config.tmp" "wp-config.php"
fi
fi
# Mise à jour theme / plugin / network
wp theme update --allow-root --all
wp plugin update --allow-root --all
wp core update-db --network
exec $@

View File

@ -8,17 +8,24 @@ Alias /wordpress /app/public
DirectoryIndex index.php
Require all granted
RewriteEngine On
RewriteBase /wordpress/
# BEGIN WordPress Multisite
# Using subfolder network type: https://wordpress.org/documentation/article/htaccess/#multisite
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress Multisite
</Directory>

View File

@ -17,22 +17,24 @@ then
fi
wp config set --allow-root DB_HOST ${WORDPRESS_DB_HOST}
wp config set --allow-root DB_NAME ${WORDPRESS_DB_NAME}
wp config set --allow-root DB_USER ${WORDPRESS_DB_USER}
wp config set --allow-root DB_PASSWORD ${WORDPRESS_DB_PASSWORD}
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS}
# le ? permet d'enlever le / à la fin de WORDPRESS_ALIAS
wp config set --allow-root WP_HOME ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS::-1}
wp config set --allow-root WP_SITEURL ${WORDPRESS_PROTOCOL}://${WORDPRESS_DOMAINE}${WORDPRESS_ALIAS::-1}
wp config set --allow-root WP_ALLOW_MULTISITE true
wp config set --allow-root MULTISITE true
wp config set --allow-root SUBDOMAIN_INSTALL false
wp config set --allow-root WP_ALLOW_MULTISITE true --raw
wp config set --allow-root MULTISITE true --raw
wp config set --allow-root SUBDOMAIN_INSTALL false --raw
wp config set --allow-root DOMAIN_CURRENT_SITE ${WORDPRESS_DOMAINE}
wp config set --allow-root PATH_CURRENT_SITE ${WORDPRESS_ALIAS}
wp config set --allow-root FORCE_ADMIN_SSL false
wp config set --allow-root SITE_ID_CURRENT_SITE 1
wp config set --allow-root BLOG_ID_CURRENT_SITE 1
wp config set --allow-root FORCE_ADMIN_SSL false --raw
wp config set --allow-root SITE_ID_CURRENT_SITE 1 --raw
wp config set --allow-root BLOG_ID_CURRENT_SITE 1 --raw
# On fait croire à WP qu'il est en https
if grep -qF "_SERVER['HTTPS']='on'" "wp-config.php"; then

View File

@ -1,6 +1,21 @@
version: '3'
services:
nineapache:
image: reg.cadoles.com/envole/nineapache:8.1
container_name: wordpress-nineapache
restart: always
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
networks:
- wordpress-network
ports:
- "80:80"
volumes:
- ./containers/nineapache/apache.conf:/etc/apache2/conf.d/zapp.conf
mariadb:
image: mariadb
container_name: wordpress-mariadb
@ -14,6 +29,8 @@ services:
MYSQL_PASSWORD: changeme
volumes:
- mariadb-data:/var/lib/mysql
networks:
- wordpress-network
wordpress:
build:
@ -34,12 +51,15 @@ services:
- WORDPRESS_USER=admin
- WORDPRESS_PASSWORD=changeme
- WORDPRESS_EMAIL=admin@noreply.fr
- WORDPRESS_PROTOCOL=https
- WORDPRESS_DOMAINE=eolebase.ac-test.fr
- WORDPRESS_PROTOCOL=http
- WORDPRESS_DOMAINE=nine.local
- WORDPRESS_ALIAS=/wordpress/
volumes:
- ./containers/wordpress/entrypoint.sh:/docker/entrypoint.sh
- ./containers/wordpress/apache.conf:/etc/apache2/conf.d/zapp.conf
#volumes:
# - ./containers/data:/app/public/wp-content/plugins/wp-cas
networks:
- wordpress-network
adminer:
image: docker.io/library/adminer
@ -47,6 +67,12 @@ services:
restart: always
ports:
- 9100:8080
networks:
- wordpress-network
volumes:
mariadb-data:
networks:
wordpress-network:
name: wordpress-network

160
nine.sh
View File

@ -7,49 +7,15 @@
rm -f ./.env.local
cat ./env/.env* >> ./.env.local
. ./misc/e-ihm.sh
. .env
. ./env/.env
. ./env/.env.local
if [ -f ./env/.env.local ]
then
. ./env/.env.local
fi
# Start script
BigTitle "NINE"
# on remplace les valeur reprise dans les autres .env car podman interprète mal
if [[ "$PODCOMPOSEBIN" == "podman-compose" ]]
then
sed -i 's#${WEB_URL}#'${WEB_URL}'#g' ./.env.local
sed -i 's#${WEB_PROTOCOL}#'${WEB_PROTOCOL}'#g' ./.env.local
. ./.env.local
sed -i 's#${ADMIN_PASSWORD}#'${ADMIN_PASSWORD}'#g' ./.env.local
sed -i 's#${ADMIN_USER}#'${ADMIN_USER}'#g' ./.env.local
sed -i 's#${CAS_HOST}#'${CAS_HOST}'#g' ./.env.local
sed -i 's#${CAS_PORT}#'${CAS_PORT}'#g' ./.env.local
sed -i 's#${CAS_USER}#'${CAS_USER}'#g' ./.env.local
sed -i 's#${CAS_PASSWORD}#'${CAS_PASSWORD}'#g' ./.env.local
sed -i 's#${OPENLDAP_SERVICE_NAME}#'${OPENLDAP_SERVICE_NAME}'#g' ./.env.local
sed -i 's#${LDAP_ADMIN_USERNAME}#'${LDAP_ADMIN_USERNAME}'#g' ./.env.local
sed -i 's#${LDAP_BASEDN}#'${LDAP_BASEDN}'#g' ./.env.local
sed -i 's#${LDAP_PASSWORD}#'${LDAP_PASSWORD}'#g' ./.env.local
sed -i 's#${LDAP_USER}#'${LDAP_USER}'#g' ./.env.local
sed -i 's#${LDAP_PORT}#'${LDAP_PORT}'#g' ./.env.local
sed -i 's#${MARIADB_SERVICE_NAME}#'${MARIADB_SERVICE_NAME}'#g' ./.env.local
sed -i 's#${MARIADB_USER}#'${MARIADB_USER}'#g' ./.env.local
sed -i 's#${MARIADB_PASSWORD}#'${MARIADB_PASSWORD}'#g' ./.env.local
sed -i 's#${ADMINER_ACTIVATE}#'${ADMINER_ACTIVATE}'#g' ./.env.local
sed -i 's#${ADMINER_URL}#'${ADMINER_URL}'#g' ./.env.local
sed -i 's#${PHPLDAPADMIN_ACTIVATE}#'${PHPLDAPADMIN_ACTIVATE}'#g' ./.env.local
sed -i 's#${PHPLDAPADMIN_URL}#'${PHPLDAPADMIN_URL}'#g' ./.env.local
sed -i 's#${NEXTCLOUD_ACTIVATE}#'${NEXTCLOUD_ACTIVATE}'#g' ./.env.local
sed -i 's#${NEXTCLOUD_URL}#'${NEXTCLOUD_URL}'#g' ./.env.local
fi
# Include
. ./.env.local
@ -62,7 +28,10 @@ destroyall(){
Question_ouinon "Souhaitez-vous supprimer l'ensemble des containers : Attention cela supprimera vraiment tout ?"
if [[ "$?" = 0 ]]
then
destroy $NINEAPACHE_SERVICE_NAME 1
destroy $MARIADB_SERVICE_NAME 1
destroy $REDIS_SERVICE_NAME 1
destroy $MINIO_SERVICE_NAME 1
destroy $OPENLDAP_SERVICE_NAME 1
destroy $KEYCLOAK_SERVICE_NAME 1
destroy $NINEGATE_SERVICE_NAME 1
@ -71,7 +40,6 @@ destroyall(){
destroy $WORDPRESS_SERVICE_NAME 1
destroy $ADMINER_SERVICE_NAME 1
destroy $PHPLDAPADMIN_SERVICE_NAME 1
destroy $NINEAPACHE_SERVICE_NAME 1
fi
}
@ -90,7 +58,10 @@ env() {
#===========================================================================================================================================
envall(){
env $NINEAPACHE_SERVICE_NAME
env $MARIADB_SERVICE_NAME
env $REDIS_SERVICE_NAME
env $MINIO_SERVICE_NAME
env $OPENLDAP_SERVICE_NAME
env $KEYCLOAK_SERVICE_NAME
env $NINEGATE_SERVICE_NAME
@ -99,7 +70,6 @@ envall(){
env $WORDPRESS_SERVICE_NAME
env $ADMINER_SERVICE_NAME
env $PHPLDAPADMIN_SERVICE_NAME
env $NINEAPACHE_SERVICE_NAME
}
#===========================================================================================================================================
@ -111,19 +81,7 @@ envall(){
stop() {
if [[ "$2" != 1 ]]; then Title "STOP"; fi
$PODCOMPOSEBIN stop $1
if [[ "$PODCOMPOSEBIN" == "podman-compose" ]]
then
if [[ "$1" == "" ]]
then
CONTAINER_NAMES=$($PODCOMPOSEBIN -f docker-compose.yml ps | awk 'NR > 1 {print $1}')
for CONTAINER_NAME in $CONTAINER_NAMES; do
$PODBIN rm -f $CONTAINER_NAME
done
else
$PODBIN rm "nine-"$1
fi
fi
docker-compose stop $1
}
#===========================================================================================================================================
@ -133,13 +91,13 @@ stop() {
wait_for_container() {
container_id="nine-$1"
container_name="$($PODBIN inspect "${container_id}" --format '{{ .Name }}')"
container_name="$(docker inspect "${container_id}" --format '{{ .Name }}')"
waiting_done="false"
while [[ "${waiting_done}" != "true" ]]; do
container_state="$($PODBIN inspect "${container_id}" --format '{{ .State.Status }}')"
container_state="$(docker inspect "${container_id}" --format '{{ .State.Status }}')"
if [[ "${container_state}" == "running" ]]; then
health_status="$($PODBIN inspect "${container_id}" --format '{{ .State.Health.Status }}')"
health_status="$(docker inspect "${container_id}" --format '{{ .State.Health.Status }}')"
if [[ ${health_status} == "healthy" ]]; then
waiting_done="true"
fi
@ -151,13 +109,23 @@ wait_for_container() {
}
upservice(){
$PODCOMPOSEBIN up -d $1
docker-compose up -d $1
if [[ $2 == "wait" ]]
then
wait_for_container $1
fi
}
function upnineapache {
if [[ $NINEAPACHE_ACTIVATE == 1 && $NINEAPACHE_LOCAL == 1 ]]
then
Title ${NINEAPACHE_SERVICE_NAME^^}
EchoVert "CONTAINER"
upservice ${NINEAPACHE_SERVICE_NAME}
Echo
fi
}
function upmariadb {
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
then
@ -168,6 +136,26 @@ function upmariadb {
fi
}
function upredis {
if [[ $REDIS_ACTIVATE == 1 && $REDIS_LOCAL == 1 ]]
then
Title "REDIS"
EchoVert "CONTAINER"
upservice $REDIS_SERVICE_NAME
Echo
fi
}
function upminio {
if [[ $MINIO_ACTIVATE == 1 && $MINIO_LOCAL == 1 ]]
then
Title "MINIO"
EchoVert "CONTAINER"
upservice $MINIO_SERVICE_NAME
Echo
fi
}
function upopenldap {
if [[ $LDAP_ACTIVATE == 1 && $LDAP_LOCAL == 1 ]]
then
@ -178,7 +166,7 @@ function upopenldap {
chmod a+wr ./volume/openldap/data
upservice $OPENLDAP_SERVICE_NAME wait
$PODCOMPOSEBIN exec $OPENLDAP_SERVICE_NAME /nine/init.sh
docker-compose exec $OPENLDAP_SERVICE_NAME /nine/init.sh
Echo
fi
}
@ -193,7 +181,7 @@ function upkeycloak {
then
EchoVert "DATABASE"
Echo ${KEYCLOAK_SERVICE_NAME^^}
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/init.sh $KEYCLOAK_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $KEYCLOAK_SERVICE_NAME
Echo
fi
@ -212,7 +200,7 @@ function upninegate {
then
EchoVert "DATABASE"
Echo ${NINEGATE_SERVICE_NAME^^}
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/init.sh $NINEGATE_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $NINEGATE_SERVICE_NAME
Echo
fi
@ -232,7 +220,7 @@ function upnineboard {
then
EchoVert "DATABASE"
Echo ${NINEBOARD_SERVICE_NAME^^}
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/init.sh $NINEBOARD_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $NINEBOARD_SERVICE_NAME
Echo
fi
@ -253,7 +241,7 @@ function upnextcloud {
EchoVert "DATABASE"
Echo ${NEXTCLOUD_SERVICE_NAME^^}
Echo
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/init.sh $NEXTCLOUD_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $NEXTCLOUD_SERVICE_NAME
fi
EchoVert "CONTAINER"
@ -272,7 +260,7 @@ function upwordpress {
then
EchoVert "DATABASE"
Echo ${WORDPRESS_SERVICE_NAME^^}
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/init.sh $WORDPRESS_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $WORDPRESS_SERVICE_NAME
Echo
fi
@ -302,15 +290,6 @@ function upphpldapadmin {
fi
}
function upnineapache {
if [[ $NINEAPACHE_ACTIVATE == 1 && $NINEAPACHE_LOCAL == 1 ]]
then
Title ${NINEAPACHE_SERVICE_NAME^^}
EchoVert "CONTAINER"
upservice ${WORDPRESS_SERVICE_NAME}
Echo
fi
}
#===========================================================================================================================================
#== UP =====================================================================================================================================
@ -338,9 +317,19 @@ up(){
iptables -P INPUT ACCEPT
fi
# NINEAPACHE
upnineapache
# MARIADB
upmariadb
# REDIS
upredis
# MINIO
upminio
# OPENLDAP
upopenldap
@ -365,8 +354,6 @@ up(){
# PHPLDAPADMIN
upphpldapadmin
# NINEAPACHE
upnineapache
else
env ${1}
up${1}
@ -381,7 +368,10 @@ destroyall(){
Question_ouinon "Souhaitez-vous supprimer l'ensemble des containers : Attention cela supprimera vraiment tout ?"
if [[ "$?" = 0 ]]
then
destroy $NINEAPACHE_SERVICE_NAME 1
destroy $MARIADB_SERVICE_NAME 1
destroy $REDIS_SERVICE_NAME 1
destroy $MINIO_SERVICE_NAME 1
destroy $OPENLDAP_SERVICE_NAME 1
destroy $KEYCLOAK_SERVICE_NAME 1
destroy $NINEGATE_SERVICE_NAME 1
@ -390,7 +380,6 @@ destroyall(){
destroy $WORDPRESS_SERVICE_NAME 1
destroy $ADMINER_SERVICE_NAME 1
destroy $PHPLDAPADMIN_SERVICE_NAME 1
destroy $NINEAPACHE_SERVICE_NAME 1
fi
}
@ -404,12 +393,7 @@ destroy(){
Title "DESTROY "${1^^}
stop $1 1
if [[ "$PODCOMPOSEBIN" == "docker-compose" ]]
then
$PODCOMPOSEBIN rm -s -v -f "$1"
fi
docker-compose rm -s -v -f "$1"
if [[ "$1" == "$MARIADB_SERVICE_NAME" && $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
then
@ -437,7 +421,7 @@ destroy(){
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
if [[ "$?" = 0 || -z $2 ]]
then
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/delete.sh $KEYCLOAK_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $KEYCLOAK_SERVICE_NAME
fi
fi
@ -446,7 +430,7 @@ destroy(){
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
if [[ "$?" = 0 || -z $2 ]]
then
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/delete.sh $NINEGATE_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $NINEGATE_SERVICE_NAME
fi
fi
@ -455,7 +439,7 @@ destroy(){
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
if [[ "$?" = 0 || -z $2 ]]
then
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/delete.sh $NINEBOARD_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $NINEBOARD_SERVICE_NAME
fi
fi
@ -464,7 +448,7 @@ destroy(){
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ainsi que les fichiers utilisateurs ?";fi
if [[ "$?" = 0 || -z $2 ]]
then
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/delete.sh $NEXTCLOUD_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $NEXTCLOUD_SERVICE_NAME
sudo rm -rf volume/nextcloud/data
sudo rm -rf volume/nextcloud/html
sudo rm -rf volume/nextcloud/app
@ -476,7 +460,7 @@ destroy(){
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
if [[ "$?" = 0 || -z $2 ]]
then
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /nine/delete.sh $WORDPRESS_SERVICE_NAME
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $WORDPRESS_SERVICE_NAME
sudo rm -rf volume/wordpress/data
fi
fi
@ -501,7 +485,7 @@ then
EchoRouge "Vous devez precisez un service"
EchoRouge "nine.sh bash monservice"
else
$PODCOMPOSEBIN exec $2 "/bin/bash"
docker-compose exec $2 "/bin/bash"
fi
elif [[ $1 == "destroyall" ]]
then
@ -517,7 +501,7 @@ then
fi
elif [[ $1 == "logs" ]]
then
$PODCOMPOSEBIN logs -f $2
docker-compose logs -f $2
elif [[ $1 == "iswait" ]]
then
wait_for_container $2

View File

@ -4,6 +4,16 @@
git clone --branch master https://forge.cadoles.com/afornerot/ninedocker.git
## Nine sur localhost
Vous devez ajouter un domaine dans votre host qui pointe sur 127.0.0.0
Sans personnalisation nine est configuré pour travailler avec nine.local et il écoute le port 7080
```
127.0.0.0 nine.local
```
## Comment personnaliser
Pour personnaliser la configuration de base
@ -18,8 +28,8 @@ De base ninedocker est configuré pour fonctionner sur nine.local en https
Exemple de faire fonctionner le docker en local et en http
```
WEB_URL=localhost
PROTOCOLE=http
WEB_URL=mondomaine
PROTOCOLE=https
```
### Ports & Services associés

View File

@ -0,0 +1,59 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Require all granted
</Proxy>
ProxyPass /auth http://keycloak:8999/auth retry=0 keepalive=On
ProxyPassReverse /auth http://keycloak:8999/auth retry=0
ProxyPass /ninegate http://ninegate/ninegate retry=0 keepalive=On
ProxyPassReverse /ninegate http://ninegate/ninegate retry=0
ProxyPass /wssninegate ws://ninegate/wssninegate retry=0 keepalive=On
ProxyPassReverse /wssninegate ws://ninegate/wssninegate retry=0
ProxyPass /nextcloud http://nextcloud retry=0 keepalive=On
ProxyPassReverse /nextcloud http://nextcloud retry=0
ProxyPass /nineboard http://nineboard/nineboard retry=0 keepalive=On
ProxyPassReverse /nineboard http://nineboard/nineboard retry=0
ProxyPass /wssnineboard ws://nineboard/wssnineboard retry=0 keepalive=On
ProxyPassReverse /wssnineboard ws://nineboard/wssnineboard retry=0
ProxyPass /wordpress http://wordpress/wordpress retry=0 keepalive=On
ProxyPassReverse /wordpress http://wordpress/wordpress retry=0
ProxyPass /adminer http://adminer:8080 retry=0 keepalive=On
ProxyPassReverse /adminer http://adminer:8080 retry=0
ProxyPass /phpldapadmin http://phpldapadmin/phpldapadmin retry=0 keepalive=On
ProxyPassReverse /phpldapadmin http://phpldapadmin/phpldapadmin retry=0
RequestHeader set X-Forwarded-Host "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-Server "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
RequestHeader set Host "%{HTTP_HOST}s"
RequestHeader set X-Forwarded-Proto "http"
DocumentRoot "/app/public"
<Directory "/app/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</Directory>

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Some files were not shown because too many files have changed in this diff Show More