init ninedocker

This commit is contained in:
2024-07-04 12:42:13 +02:00
commit 0a7777d6e8
194 changed files with 29944 additions and 0 deletions

186
misc/e-ihm.sh Executable file
View File

@ -0,0 +1,186 @@
#!/bin/bash
TPUT=/usr/bin/tput
#test si TPUT est utilisable
if [ ! "$TERM" = "" ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then
FANCYTTY=1
else
FANCYTTY=0
fi
Pause() {
if [ "$ModeTxt" == "yes" ];then
echo
elif [ "$ModeEad" == "yes" ];then
echo "<br>"
else
[ $FANCYTTY = 1 ] && $TPUT setaf 6
echo " Appuyez sur Entrée pour continuer ..."
[ $FANCYTTY = 1 ] && $TPUT sgr0
read BiDon
fi
}
Echo() {
if [ "$ModeEad" != "yes" ];
then
echo "$1"
else
echo "$1<br>"
fi
}
EchoColor() {
if [ "$ModeTxt" = "yes" ];then
echo "$1"
elif [ "$ModeEad" = "yes" ];then
echo "<FONT color=\"$3\"> $1 </FONT><br>"
else
[ "$FANCYTTY" = 1 ] && $TPUT setaf $2
echo "$1"
[ "$FANCYTTY" = 1 ] && $TPUT sgr0
fi
}
EchoRouge() {
EchoColor "$1" "1" "red"
}
EchoVert() {
EchoColor "$1" "2" "green"
}
EchoOrange() {
EchoColor "$1" "3" "orange"
}
EchoBleu() {
EchoColor "$1" "4" "blue"
}
EchoMagenta() {
EchoColor "$1" "5" "magenta"
}
EchoCyan() {
EchoColor "$1" "6" "cyan"
}
EchoBlanc() {
EchoColor "$1" "7" "white"
}
EchoGras() {
if [ "$ModeTxt" == "yes" ];then
echo "$1"
elif [ "$ModeEad" == "yes" ];then
echo "<b> $1 </b><br>"
else
[ $FANCYTTY = 1 ] && $TPUT bold
echo "$1"
[ $FANCYTTY = 1 ] && $TPUT sgr0
fi
}
Clear() {
if [ "$ModeEad" != "yes" -a "$ModeTxt" != "yes" ];then
clear
fi
}
Question_ouinon() {
#attention, il faut synchroniser les modifications avec /usr/share/pyshared/pyeole/ihm.py
question=$1
[ "$2" = "" ] && interactive='True' || interactive=$2
[ "$3" = "" ] && default="non" || default=$3
[ "$4" = "" ] && level="info" || level=$4
[ "$5" = "" ] && default_uninteractive=$default || default_uninteractive=$5
[ ! "$interactive" = "True" ] && [ ! "$interactive" = "False" ] && echo "Question_ouinon : interactive doit être True ou False" && exit 1
[ ! "$default" = "oui" ] && [ ! "$default" = "non" ] && echo "Question_ouinon : default doit etre oui ou non" && exit 1
[ ! "$default_uninteractive" = "oui" ] && [ ! "$default_uninteractive" = "non" ] && echo "Question_ouinon : default_uninteractive doit etre oui ou non" && exit 1
[ ! "$level" = "info" ] && [ ! "$level" = "warn" ] && [ ! "$level" = "err" ] && echo "Question_ouinon : level doit etre info, warn ou err" && exit 1
#non interactive
if [ "$interactive" = "False" ]; then
Rep=default_uninteractive
else
question="$question [oui/non]"
if [ $level = "info" ]; then
echo "$question"
elif [ $level = "warn" ]; then
EchoOrange "$question"
else
EchoRouge "$question"
fi
echo -n "[$default] : "
read Rep
#passe en minuscule
Rep=`echo $Rep | tr A-Z a-z`
fi
if [ "$default" = "non" ]; then
if [ "$Rep" = "oui" -o "$Rep" = "o" -o "$Rep" = "yes" -o "$Rep" = "y" ];then
return 0
else
return 1
fi
else
if [ "$Rep" = "non" -o "$Rep" = "n" -o "$Rep" = "no" ];then
return 1
else
return 0
fi
fi
}
EchoStart() {
for i in $(eval echo "{1..30}")
do
ligne+="="
done
clear
}
BigTitle(){
size=`tput cols`
nb=${#1}
nbchar=$(($size - $nb - 4))
ligne=""
for i in $(eval echo "{1..$size}")
do
ligne+="="
done
finligne=""
for i in $(eval echo "{1..$nbchar}")
do
finligne+="="
done
echo
EchoVert $ligne
EchoVert "== $1 $finligne"
EchoVert $ligne
echo
}
Title(){
size=`tput cols`
nb=${#1}
nbchar=$(($size - $nb - 4))
ligne=""
for i in $(eval echo "{1..$size}")
do
ligne+="="
done
finligne=""
for i in $(eval echo "{1..$nbchar}")
do
finligne+="="
done
echo
EchoCyan "== $1 $finligne"
echo
}

View File

@ -0,0 +1,22 @@
ProxyPass /auth http://nine.local:8080/auth retry=0 keepalive=On
ProxyPassReverse /auth http://nine.local:8080/auth retry=0
ProxyPass /ninegate http://nine.local:9000/ninegate retry=0 keepalive=On
ProxyPassReverse /ninegate http://nine.local:9000/ninegate retry=0
ProxyPass /wssninegate ws://nine.local:9000/wssninegate retry=0 keepalive=On
ProxyPassReverse /wssninegate ws://nine.local:9000/wssninegate retry=0
ProxyPass /nextcloud http://nine.local:9001 retry=0 keepalive=On
ProxyPassReverse /nextcloud http://nine.local:9001 retry=0
ProxyPass /adminer http://nine.local:9100 retry=0 keepalive=On
ProxyPassReverse /adminer http://nine.local:9100 retry=0
ProxyPass /phpldapadmin http://nine.local:9101/phpldapadmin retry=0 keepalive=On
ProxyPassReverse /phpldapadmin http://nine.local:9101/phpldapadmin retry=0
ProxyPass /nineapache http://nine.local:9102 retry=0 keepalive=On
ProxyPassReverse /nineapache http://nine.local:9102 retry=0

View File

@ -0,0 +1,5 @@
FROM quay.io/keycloak/keycloak:24.0.5
COPY keycloak-protocol-cas-24.0.5.jar /opt/keycloak/providers/keycloak-protocol-cas.jar
USER keycloak

View File

@ -0,0 +1,12 @@
version: '3'
services:
keycloak:
build:
context: ./containers/keycloak
image: reg.cadoles.com/envole/keycloak:24.0.5
container_name: keycloak
ports:
- "9000:8080"
command:
- start-dev

View File

@ -0,0 +1,3 @@
FROM nextcloud:apache
RUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*

View File

@ -0,0 +1,9 @@
version: '3'
services:
nextcloud:
build:
context: ./containers/nextcloud
image: reg.cadoles.com/envole/nextcloud
container_name: nextcloud

View File

@ -0,0 +1,67 @@
FROM alpine:3.15
RUN apk add --no-cache \
bash \
sed \
vim \
ca-certificates \
openldap-clients \
wget \
npm \
git \
curl \
unzip \
zip \
openssl
RUN apk add --no-cache \
apache2 \
apache2-proxy \
apache2-ssl
RUN apk add --no-cache \
php7 \
php7-apache2 \
php7-gd \
php7-zip \
php7-xml \
php7-ctype \
php7-simplexml \
php7-tokenizer \
php7-sodium \
php7-dom \
php7-pdo \
php7-pdo_pgsql \
php7-pdo_mysql \
php7-curl \
php7-ldap \
php7-pecl-igbinary \
php7-session \
php7-pecl-redis \
php7-fileinfo \
php7-xmlwriter \
php7-openssl \
php7-phar \
php7-iconv \
php7-mbstring \
php7-fpm \
php7-sockets \
php7-opcache \
php7-intl \
php7-bcmath \
php7-pecl-ssh2
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash
RUN curl -sS https://getcomposer.org/installer | php -- --1 --install-dir=/usr/local/bin --filename=composer
RUN npm install -g n
RUN npm install -g yarn
COPY apache2.sh /etc/apache2/apache2.sh
RUN chmod +x /etc/apache2/apache2.sh
COPY php.local.ini /etc/php7/conf.d/
COPY apache.conf /etc/apache2/conf.d/zapp.conf
COPY ssl.conf /etc/apache2/conf.d/ssl.conf
COPY index.php /app/public/index.php
CMD /etc/apache2/apache2.sh

View File

@ -0,0 +1,19 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
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

@ -0,0 +1,27 @@
#!/bin/bash
envfile=/etc/apache2/conf.d/env.conf
haveenv=/etc/apache2/haveenv.txt
rm -rf $envfile
rm -rf $haveenv
echo "GENERATION DES VARIABLES D'ENVIRONNEMENT"
printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile
compgen -e | while read name ; do
if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]]
then
touch $haveenv
printf " $name" >> $envfile
fi
done
printf "\n" >> $envfile
if [[ ! -f $haveenv ]]
then
rm -rf $envfile
fi
rm -rf $haveenv
echo "START HTTPD"
httpd -DFOREGROUND

View File

@ -0,0 +1,9 @@
<?php
echo "<html><head><title>Nineapache 7</title></head><body>";
echo "<h1><center>NINEAPACHE 7</center></h1>";
echo phpinfo();
echo "</body></html>";
?>

View File

@ -0,0 +1,3 @@
memory_limit = 512M
upload_max_filesize = 512M
post_max_size = 512M

View File

@ -0,0 +1,43 @@
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
Listen 443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!ADH
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!ADH
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog builtin
SSLSessionCache "shmcb:/var/cache/mod_ssl/scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost _default_:443>
DocumentRoot "/app/public"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog logs/ssl_error.log
TransferLog logs/ssl_access.log
SSLEngine on
SSLCertificateFile /etc/ssl/apache2/server.pem
SSLCertificateKeyFile /etc/ssl/apache2/server.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/app/public/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request.log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

View File

@ -0,0 +1,11 @@
version: '3'
services:
nineapache:
build:
context: ./containers/nineapache
image: reg.cadoles.com/envole/nineapache:7.4
container_name: nineapache7
ports:
- 8080:80

View File

@ -0,0 +1,68 @@
FROM alpine:3.18
RUN apk add --no-cache \
bash \
sed \
vim \
ca-certificates \
openldap-clients \
wget \
npm \
git \
curl \
unzip \
zip \
openssl
RUN apk add --no-cache \
apache2 \
apache2-proxy \
apache2-ssl
RUN apk add --no-cache \
php81 \
php81-apache2 \
php81-gd \
php81-zip \
php81-xml \
php81-ctype \
php81-simplexml \
php81-tokenizer \
php81-sodium \
php81-dom \
php81-pdo \
php81-pdo_pgsql \
php81-pdo_mysql \
php81-curl \
php81-ldap \
php81-pecl-igbinary \
php81-session \
php81-pecl-redis \
php81-fileinfo \
php81-xmlwriter \
php81-openssl \
php81-phar \
php81-iconv \
php81-mbstring \
php81-fpm \
php81-sockets \
php81-opcache \
php81-intl \
php81-bcmath \
php81-pecl-ssh2
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN npm install -g n
RUN npm install -g yarn
COPY apache2.sh /etc/apache2/apache2.sh
RUN chmod +x /etc/apache2/apache2.sh
COPY php.local.ini /etc/php81/conf.d/
COPY apache.conf /etc/apache2/conf.d/zapp.conf
COPY ssl.conf /etc/apache2/conf.d/ssl.conf
COPY index.php /app/public/index.php
CMD /etc/apache2/apache2.sh

View File

@ -0,0 +1,20 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
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

@ -0,0 +1,27 @@
#!/bin/bash
envfile=/etc/apache2/conf.d/env.conf
haveenv=/etc/apache2/haveenv.txt
rm -rf $envfile
rm -rf $haveenv
echo "GENERATION DES VARIABLES D'ENVIRONNEMENT"
printf "\n# Expose environment variables to scripts.\nPassEnv" >> $envfile
compgen -e | while read name ; do
if [[ "$name" != "TERM" && "$name" != "HOME" && "$name" != "HOSTNAME" && "$name" != "PATH" && "$name" != "PWD" && "$name" != "SHLVL" ]]
then
touch $haveenv
printf " $name" >> $envfile
fi
done
printf "\n" >> $envfile
if [[ ! -f $haveenv ]]
then
rm -rf $envfile
fi
rm -rf $haveenv
echo "START HTTPD"
httpd -DFOREGROUND

View File

@ -0,0 +1,9 @@
<?php
echo "<html><head><title>Nineapache 8</title></head><body>";
echo "<h1><center>NINEAPACHE 8</center></h1>";
echo phpinfo();
echo "</body></html>";
?>

View File

@ -0,0 +1,3 @@
memory_limit = 512M
upload_max_filesize = 512M
post_max_size = 512M

View File

@ -0,0 +1,43 @@
LoadModule ssl_module modules/mod_ssl.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
SSLRandomSeed startup file:/dev/urandom 512
SSLRandomSeed connect builtin
Listen 443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!ADH
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES:!ADH
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog builtin
SSLSessionCache "shmcb:/var/cache/mod_ssl/scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost _default_:443>
DocumentRoot "/app/public"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog logs/ssl_error.log
TransferLog logs/ssl_access.log
SSLEngine on
SSLCertificateFile /etc/ssl/apache2/server.pem
SSLCertificateKeyFile /etc/ssl/apache2/server.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/app/public/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request.log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

View File

@ -0,0 +1,10 @@
version: '3'
services:
nineapache:
build:
context: ./containers/nineapache
image: reg.cadoles.com/envole/nineapache:8.1
container_name: nineapache8
ports:
- 8080:443

View File

@ -0,0 +1,67 @@
#!/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

@ -0,0 +1,25 @@
FROM reg.cadoles.com/envole/nineapache:8.1
# Paquet necessaire pour wordpress
RUN apk add php81-mysqli
# Installation de wp-cli
COPY wp-cli.phar /usr/local/bin/wp
RUN chmod +x /usr/local/bin/wp
# Configuration apache
RUN cd /app/public
COPY apache.conf /etc/apache2/conf.d/zapp.conf
# Installation des sources wordpress
RUN wp core download --path=/app/public --locale=fr_FR
RUN chown -R apache:apache /app/public
RUN find /app/public -type d -exec chmod 755 {} +
RUN find /app/public -type f -exec chmod 644 {} +
RUN mkdir /docker
COPY entrypoint.sh /docker/entrypoint.sh
RUN chmod +x /docker/entrypoint.sh
# CMD
CMD /docker/entrypoint.sh && /etc/apache2/apache2.sh

View File

@ -0,0 +1,24 @@
LoadModule rewrite_module modules/mod_rewrite.so
ServerName nineapache.local
DocumentRoot "/app/public"
Alias /wordpress /app/public
<Directory "/app/public">
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
RewriteEngine On
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]
</Directory>

View File

@ -0,0 +1,89 @@
#!/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 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
# Install multisite
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
# Switch language
echo "== Switch languange"
wp language core install fr_FR
wp site switch-language fr_FR
# Install plugin
#if [[ "${MODE_AUTH}" == "CAS" && "${CAS_ACTIVATE}" == "1" ]]
#then
# wp plugin install wp-cassify
# wp plugin activate wp-cassify --network
#else
# wp plugin delete wp-cassify
#fi
# Mise à jour theme / plugin / network
wp theme install twentytwentyfour --allow-root
wp theme update --allow-root --all
wp plugin update --allow-root --all
wp language core update
wp language theme update --all
wp language plugin update --all
# Mise à jour du network
wp core update-db --network
exec $@

Binary file not shown.

View File

@ -0,0 +1,52 @@
version: '3'
services:
mariadb:
image: mariadb
container_name: wordpress-mariadb
restart: always
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: changeme
MYSQL_DATABASE: wordpress
MYSQL_USER: user
MYSQL_PASSWORD: changeme
volumes:
- mariadb-data:/var/lib/mysql
wordpress:
build:
context: ./containers/wordpress
image: reg.cadoles.com/envole/wordpress
container_name: wordpress-app
restart: always
depends_on:
- mariadb
ports:
- "9003:80"
environment:
- WORDPRESS_DB_HOST=mariadb
- WORDPRESS_DB_NAME=wordpress
- WORDPRESS_DB_USER=user
- WORDPRESS_DB_PASSWORD=changeme
- WORDPRESS_TITLE=wordpress
- WORDPRESS_USER=admin
- WORDPRESS_PASSWORD=changeme
- WORDPRESS_EMAIL=admin@noreply.fr
- WORDPRESS_PROTOCOL=https
- WORDPRESS_DOMAINE=eolebase.ac-test.fr
- WORDPRESS_ALIAS=/wordpress/
#volumes:
# - ./containers/data:/app/public/wp-content/plugins/wp-cas
adminer:
image: docker.io/library/adminer
container_name: wordpress-adminer
restart: always
ports:
- 9100:8080
volumes:
mariadb-data:

186
misc/tools/e-ihm.sh Executable file
View File

@ -0,0 +1,186 @@
#!/bin/bash
TPUT=/usr/bin/tput
#test si TPUT est utilisable
if [ ! "$TERM" = "" ] && $TPUT hpa 60 >/dev/null 2>&1 && $TPUT setaf 1 >/dev/null 2>&1; then
FANCYTTY=1
else
FANCYTTY=0
fi
Pause() {
if [ "$ModeTxt" == "yes" ];then
echo
elif [ "$ModeEad" == "yes" ];then
echo "<br>"
else
[ $FANCYTTY = 1 ] && $TPUT setaf 6
echo " Appuyez sur Entrée pour continuer ..."
[ $FANCYTTY = 1 ] && $TPUT sgr0
read BiDon
fi
}
Echo() {
if [ "$ModeEad" != "yes" ];
then
echo "$1"
else
echo "$1<br>"
fi
}
EchoColor() {
if [ "$ModeTxt" = "yes" ];then
echo "$1"
elif [ "$ModeEad" = "yes" ];then
echo "<FONT color=\"$3\"> $1 </FONT><br>"
else
[ "$FANCYTTY" = 1 ] && $TPUT setaf $2
echo "$1"
[ "$FANCYTTY" = 1 ] && $TPUT sgr0
fi
}
EchoRouge() {
EchoColor "$1" "1" "red"
}
EchoVert() {
EchoColor "$1" "2" "green"
}
EchoOrange() {
EchoColor "$1" "3" "orange"
}
EchoBleu() {
EchoColor "$1" "4" "blue"
}
EchoMagenta() {
EchoColor "$1" "5" "magenta"
}
EchoCyan() {
EchoColor "$1" "6" "cyan"
}
EchoBlanc() {
EchoColor "$1" "7" "white"
}
EchoGras() {
if [ "$ModeTxt" == "yes" ];then
echo "$1"
elif [ "$ModeEad" == "yes" ];then
echo "<b> $1 </b><br>"
else
[ $FANCYTTY = 1 ] && $TPUT bold
echo "$1"
[ $FANCYTTY = 1 ] && $TPUT sgr0
fi
}
Clear() {
if [ "$ModeEad" != "yes" -a "$ModeTxt" != "yes" ];then
clear
fi
}
Question_ouinon() {
#attention, il faut synchroniser les modifications avec /usr/share/pyshared/pyeole/ihm.py
question=$1
[ "$2" = "" ] && interactive='True' || interactive=$2
[ "$3" = "" ] && default="non" || default=$3
[ "$4" = "" ] && level="info" || level=$4
[ "$5" = "" ] && default_uninteractive=$default || default_uninteractive=$5
[ ! "$interactive" = "True" ] && [ ! "$interactive" = "False" ] && echo "Question_ouinon : interactive doit être True ou False" && exit 1
[ ! "$default" = "oui" ] && [ ! "$default" = "non" ] && echo "Question_ouinon : default doit etre oui ou non" && exit 1
[ ! "$default_uninteractive" = "oui" ] && [ ! "$default_uninteractive" = "non" ] && echo "Question_ouinon : default_uninteractive doit etre oui ou non" && exit 1
[ ! "$level" = "info" ] && [ ! "$level" = "warn" ] && [ ! "$level" = "err" ] && echo "Question_ouinon : level doit etre info, warn ou err" && exit 1
#non interactive
if [ "$interactive" = "False" ]; then
Rep=default_uninteractive
else
question="$question [oui/non]"
if [ $level = "info" ]; then
echo "$question"
elif [ $level = "warn" ]; then
EchoOrange "$question"
else
EchoRouge "$question"
fi
echo -n "[$default] : "
read Rep
#passe en minuscule
Rep=`echo $Rep | tr A-Z a-z`
fi
if [ "$default" = "non" ]; then
if [ "$Rep" = "oui" -o "$Rep" = "o" -o "$Rep" = "yes" -o "$Rep" = "y" ];then
return 0
else
return 1
fi
else
if [ "$Rep" = "non" -o "$Rep" = "n" -o "$Rep" = "no" ];then
return 1
else
return 0
fi
fi
}
EchoStart() {
for i in $(eval echo "{1..30}")
do
ligne+="="
done
clear
}
BigTitle(){
size=`tput cols`
nb=${#1}
nbchar=$(($size - $nb - 4))
ligne=""
for i in $(eval echo "{1..$size}")
do
ligne+="="
done
finligne=""
for i in $(eval echo "{1..$nbchar}")
do
finligne+="="
done
echo
EchoVert $ligne
EchoVert "== $1 $finligne"
EchoVert $ligne
echo
}
Title(){
size=`tput cols`
nb=${#1}
nbchar=$(($size - $nb - 4))
ligne=""
for i in $(eval echo "{1..$size}")
do
ligne+="="
done
finligne=""
for i in $(eval echo "{1..$nbchar}")
do
finligne+="="
done
echo
EchoCyan "== $1 $finligne"
echo
}