2023-11-02 14:22:16 +01:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
#1 : action = default up
|
|
|
|
|
#2 : service = optionnel
|
|
|
|
|
|
2024-03-01 21:12:48 +01:00
|
|
|
|
cd /usr/share/envole/docker
|
|
|
|
|
|
2023-11-02 17:32:25 +01:00
|
|
|
|
# Fusionner l'ensemble des fichier .env en un seul
|
|
|
|
|
rm -f ./.env.local
|
|
|
|
|
cat ./env/.env* >> ./.env.local
|
2023-11-13 16:40:30 +01:00
|
|
|
|
. ./misc/e-ihm.sh
|
2023-11-07 19:33:50 +01:00
|
|
|
|
. .env
|
|
|
|
|
. ./env/.env
|
|
|
|
|
. ./env/.env.local
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-07 19:33:50 +01:00
|
|
|
|
# Start script
|
|
|
|
|
BigTitle "ENVOLE"
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-07 19:33:50 +01:00
|
|
|
|
# on remplace les valeur reprise dans les autres .env car podman interprète mal
|
2023-11-15 11:48:03 +01:00
|
|
|
|
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
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
sed -i 's#${ADMIN_PASSWORD}#'${ADMIN_PASSWORD}'#g' ./.env.local
|
|
|
|
|
sed -i 's#${ADMIN_USER}#'${ADMIN_USER}'#g' ./.env.local
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
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
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2024-02-29 17:16:39 +01:00
|
|
|
|
sed -i 's#${OPENLDAP_SERVICE_NAME}#'${OPENLDAP_SERVICE_NAME}'#g' ./.env.local
|
2023-11-15 11:48:03 +01:00
|
|
|
|
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
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
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
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
sed -i 's#${ADMINER_ACTIVATE}#'${ADMINER_ACTIVATE}'#g' ./.env.local
|
|
|
|
|
sed -i 's#${ADMINER_URL}#'${ADMINER_URL}'#g' ./.env.local
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
sed -i 's#${PHPLDAPADMIN_ACTIVATE}#'${PHPLDAPADMIN_ACTIVATE}'#g' ./.env.local
|
|
|
|
|
sed -i 's#${PHPLDAPADMIN_URL}#'${PHPLDAPADMIN_URL}'#g' ./.env.local
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-15 11:48:03 +01:00
|
|
|
|
sed -i 's#${NEXTCLOUD_ACTIVATE}#'${NEXTCLOUD_ACTIVATE}'#g' ./.env.local
|
|
|
|
|
sed -i 's#${NEXTCLOUD_URL}#'${NEXTCLOUD_URL}'#g' ./.env.local
|
|
|
|
|
fi
|
2023-11-02 17:32:25 +01:00
|
|
|
|
|
|
|
|
|
# Include
|
2023-11-07 19:33:50 +01:00
|
|
|
|
. ./.env.local
|
|
|
|
|
|
2024-02-29 16:46:23 +01:00
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== ENV ====================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#1 = service to stop if null all service
|
|
|
|
|
|
|
|
|
|
destroyall(){
|
|
|
|
|
Question_ouinon "Souhaitez-vous supprimer l'ensemble des containers : Attention cela supprimera vraiment tout ?"
|
|
|
|
|
if [[ "$?" = 0 ]]
|
|
|
|
|
then
|
|
|
|
|
destroy $MARIADB_SERVICE_NAME 1
|
2024-02-29 17:48:20 +01:00
|
|
|
|
destroy $OPENLDAP_SERVICE_NAME 1
|
2024-02-29 16:46:23 +01:00
|
|
|
|
destroy $KEYCLOAK_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEGATE_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEBOARD_SERVICE_NAME 1
|
|
|
|
|
destroy $NEXTCLOUD_SERVICE_NAME 1
|
|
|
|
|
destroy $WORDPRESS_SERVICE_NAME 1
|
|
|
|
|
destroy $ADMINER_SERVICE_NAME 1
|
|
|
|
|
destroy $PHPLDAPADMIN_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEAPACHE_SERVICE_NAME 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2024-02-29 16:46:23 +01:00
|
|
|
|
env() {
|
|
|
|
|
rm -rf ./tmp/.env.$1
|
|
|
|
|
mkdir -p ./tmp
|
|
|
|
|
|
|
|
|
|
cat ./env/.env >> ./tmp/.env.$1
|
|
|
|
|
if [[ -f ./env/.env.local ]]; then cat ./env/.env.local >> ./tmp/.env.$1; fi
|
|
|
|
|
if [[ -f ./env/.env.zapp.$1 ]]; then cat ./env/.env.zapp.$1 >> ./tmp/.env.$1; fi
|
|
|
|
|
if [[ -f ./env/.env.zapp.$1.local ]]; then cat ./env/.env.zapp.$1.local >> ./tmp/.env.$1; fi
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== ENVALL =================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
|
|
|
|
|
envall(){
|
|
|
|
|
env $MARIADB_SERVICE_NAME
|
2024-02-29 17:48:20 +01:00
|
|
|
|
env $OPENLDAP_SERVICE_NAME
|
2024-02-29 16:46:23 +01:00
|
|
|
|
env $KEYCLOAK_SERVICE_NAME
|
|
|
|
|
env $NINEGATE_SERVICE_NAME
|
|
|
|
|
env $NINEBOARD_SERVICE_NAME
|
|
|
|
|
env $NEXTCLOUD_SERVICE_NAME
|
|
|
|
|
env $WORDPRESS_SERVICE_NAME
|
|
|
|
|
env $ADMINER_SERVICE_NAME
|
|
|
|
|
env $PHPLDAPADMIN_SERVICE_NAME
|
|
|
|
|
env $NINEAPACHE_SERVICE_NAME
|
|
|
|
|
}
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== STOP ===================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#1 = service to stop if null all service
|
2023-11-09 13:46:26 +01:00
|
|
|
|
#2 = stopper par destroyall
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
|
|
|
|
stop() {
|
2023-11-09 13:46:26 +01:00
|
|
|
|
if [[ "$2" != 1 ]]; then Title "STOP"; fi
|
|
|
|
|
|
2023-11-03 14:11:23 +01:00
|
|
|
|
$PODCOMPOSEBIN stop $1
|
2023-11-06 16:18:09 +01:00
|
|
|
|
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 "envole-"$1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2023-11-02 14:22:16 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== UPSERVICE ==============================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#1 = service to up
|
|
|
|
|
|
|
|
|
|
wait_for_container() {
|
|
|
|
|
container_id="envole-$1"
|
2023-11-03 14:11:23 +01:00
|
|
|
|
container_name="$($PODBIN inspect "${container_id}" --format '{{ .Name }}')"
|
2023-11-02 14:22:16 +01:00
|
|
|
|
waiting_done="false"
|
|
|
|
|
|
|
|
|
|
while [[ "${waiting_done}" != "true" ]]; do
|
2023-11-09 13:46:26 +01:00
|
|
|
|
container_state="$($PODBIN inspect "${container_id}" --format '{{ .State.Status }}')"
|
|
|
|
|
if [[ "${container_state}" == "running" ]]; then
|
|
|
|
|
health_status="$($PODBIN inspect "${container_id}" --format '{{ .State.Health.Status }}')"
|
|
|
|
|
if [[ ${health_status} == "healthy" ]]; then
|
|
|
|
|
waiting_done="true"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
waiting_done="true"
|
|
|
|
|
fi
|
2023-11-02 14:22:16 +01:00
|
|
|
|
sleep 1;
|
|
|
|
|
done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
upservice(){
|
2023-11-06 16:18:09 +01:00
|
|
|
|
$PODCOMPOSEBIN up -d $1
|
2023-11-02 14:22:16 +01:00
|
|
|
|
wait_for_container $1
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 21:12:48 +01:00
|
|
|
|
function upmariadb {
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title "MARIADB"
|
2024-03-06 08:48:50 +01:00
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice $MARIADB_SERVICE_NAME
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upopenldap {
|
|
|
|
|
if [[ $LDAP_ACTIVATE == 1 && $LDAP_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${OPENLDAP_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
EchoVert "CONTAINER"
|
|
|
|
|
|
2024-03-01 21:12:48 +01:00
|
|
|
|
mkdir -p ./volume/openldap/data
|
|
|
|
|
chmod a+wr ./volume/openldap/data
|
|
|
|
|
|
|
|
|
|
upservice $OPENLDAP_SERVICE_NAME
|
|
|
|
|
$PODCOMPOSEBIN exec $OPENLDAP_SERVICE_NAME /envole/init.sh
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upkeycloak {
|
|
|
|
|
if [[ $CAS_ACTIVATE == 1 && $CAS_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${KEYCLOAK_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
|
|
|
|
|
# CREATE BDD
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoVert "DATABASE"
|
|
|
|
|
Echo ${KEYCLOAK_SERVICE_NAME^^}
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $KEYCLOAK_SERVICE_NAME
|
|
|
|
|
Echo
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice $KEYCLOAK_SERVICE_NAME
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upninegate {
|
|
|
|
|
if [[ $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${NINEGATE_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoVert "DATABASE"
|
|
|
|
|
Echo ${NINEGATE_SERVICE_NAME^^}
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $NINEGATE_SERVICE_NAME
|
|
|
|
|
Echo
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice ${NINEGATE_SERVICE_NAME}
|
|
|
|
|
chmod -R a+wr ./volume/ninegate/data
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upnineboard {
|
|
|
|
|
if [[ $NINEBOARD_ACTIVATE == 1 && $NINEBOARD_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${NINEBOARD_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoVert "DATABASE"
|
|
|
|
|
Echo ${NINEBOARD_SERVICE_NAME^^}
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $NINEBOARD_SERVICE_NAME
|
|
|
|
|
Echo
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice ${NINEBOARD_SERVICE_NAME}
|
|
|
|
|
chmod -R a+wr ./volume/nineboard/data
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upnextcloud {
|
|
|
|
|
if [[ $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${NEXTCLOUD_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoVert "DATABASE"
|
|
|
|
|
Echo ${NEXTCLOUD_SERVICE_NAME^^}
|
|
|
|
|
Echo
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $NEXTCLOUD_SERVICE_NAME
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice ${NEXTCLOUD_SERVICE_NAME}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upwordpress {
|
|
|
|
|
if [[ $WORDPRESS_ACTIVATE == 1 && $WORDPRESS_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${WORDPRESS_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
|
|
|
|
|
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoVert "DATABASE"
|
|
|
|
|
Echo ${WORDPRESS_SERVICE_NAME^^}
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $WORDPRESS_SERVICE_NAME
|
|
|
|
|
Echo
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upservice ${WORDPRESS_SERVICE_NAME}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upadminer {
|
|
|
|
|
if [[ $ADMINER_ACTIVATE == 1 && $ADMINER_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${ADMINER_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
$PODCOMPOSEBIN up -d ${ADMINER_SERVICE_NAME}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upphpldapadmin {
|
|
|
|
|
if [[ $PHPLDAPADMIN_ACTIVATE == 1 && $PHPLDAPADMIN_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${PHPLDAPADMIN_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
$PODCOMPOSEBIN up -d ${PHPLDAPADMIN_SERVICE_NAME}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function upnineapache {
|
|
|
|
|
if [[ $NINEAPACHE_ACTIVATE == 1 && $NINEAPACHE_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
Title ${NINEAPACHE_SERVICE_NAME^^}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
EchoVert "CONTAINER"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
$PODCOMPOSEBIN up -d ${NINEAPACHE_SERVICE_NAME}
|
2024-03-06 08:48:50 +01:00
|
|
|
|
Echo
|
2024-03-01 21:12:48 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-02 14:22:16 +01:00
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== UP =====================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#1 = service to up if null all service
|
|
|
|
|
|
|
|
|
|
up(){
|
|
|
|
|
# Stop du ou des services
|
|
|
|
|
stop $1
|
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# SERVICES
|
|
|
|
|
if [[ -z "$1" ]]
|
2023-11-02 14:22:16 +01:00
|
|
|
|
then
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# NETWORK
|
|
|
|
|
if [[ "$RELEASE_SYSTEM" == "eole" ]]
|
|
|
|
|
then
|
|
|
|
|
Title "NETWORK"
|
2024-02-29 16:46:23 +01:00
|
|
|
|
EchoRouge "ATTENTION SOLUTION DE CONTOURNEMENT POUR LE POC"
|
|
|
|
|
EchoRouge "A résoudre si l'on souhaite mettre en production"
|
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# On réinstall docker-ce car le reconf détruit le reseau docker, la reinstall de docker-ce rétablit le reseau
|
|
|
|
|
apt-get install docker-ce --reinstall
|
2023-11-13 16:40:30 +01:00
|
|
|
|
|
|
|
|
|
# ATTENTION A REVOIR car ouvre complétement le firewall
|
|
|
|
|
iptables -P INPUT ACCEPT
|
2023-11-06 16:18:09 +01:00
|
|
|
|
fi
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# MARIADB
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upmariadb
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# OPENLDAP
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upopenldap
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2024-03-01 21:12:48 +01:00
|
|
|
|
# KEYCLOAK
|
|
|
|
|
upkeycloak
|
2023-11-06 16:18:09 +01:00
|
|
|
|
|
|
|
|
|
# NINEGATE
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upninegate
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2023-11-17 16:40:41 +01:00
|
|
|
|
# NINEBOARD
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upnineboard
|
2023-11-17 16:40:41 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# NEXTCLOUD
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upnextcloud
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2024-02-29 16:46:23 +01:00
|
|
|
|
# WORDPRESS
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upwordpress
|
2024-02-29 16:46:23 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# ADMINER
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upadminer
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# PHPLDAPADMIN
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upphpldapadmin
|
2023-11-03 14:11:23 +01:00
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
# NINEAPACHE
|
2024-03-01 21:12:48 +01:00
|
|
|
|
upnineapache
|
2023-11-02 14:22:16 +01:00
|
|
|
|
else
|
2024-02-29 17:48:20 +01:00
|
|
|
|
env ${1}
|
2024-03-01 21:12:48 +01:00
|
|
|
|
up${1}
|
2023-11-02 14:22:16 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== DESTROY ================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
|
|
|
|
|
destroyall(){
|
|
|
|
|
Question_ouinon "Souhaitez-vous supprimer l'ensemble des containers : Attention cela supprimera vraiment tout ?"
|
|
|
|
|
if [[ "$?" = 0 ]]
|
|
|
|
|
then
|
2024-02-29 16:46:23 +01:00
|
|
|
|
destroy $MARIADB_SERVICE_NAME 1
|
2024-02-29 17:48:20 +01:00
|
|
|
|
destroy $OPENLDAP_SERVICE_NAME 1
|
2024-02-29 16:46:23 +01:00
|
|
|
|
destroy $KEYCLOAK_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEGATE_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEBOARD_SERVICE_NAME 1
|
|
|
|
|
destroy $NEXTCLOUD_SERVICE_NAME 1
|
|
|
|
|
destroy $WORDPRESS_SERVICE_NAME 1
|
|
|
|
|
destroy $ADMINER_SERVICE_NAME 1
|
|
|
|
|
destroy $PHPLDAPADMIN_SERVICE_NAME 1
|
|
|
|
|
destroy $NINEAPACHE_SERVICE_NAME 1
|
2023-11-06 16:18:09 +01:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== DESTROY ================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#1 = service to destroy
|
|
|
|
|
#2 = ne pas poser de questions
|
|
|
|
|
|
|
|
|
|
destroy(){
|
|
|
|
|
Title "DESTROY "${1^^}
|
2023-11-09 13:46:26 +01:00
|
|
|
|
|
|
|
|
|
stop $1 1
|
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
if [[ "$PODCOMPOSEBIN" == "docker-compose" ]]
|
|
|
|
|
then
|
|
|
|
|
$PODBIN rm "envole-$1"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$1" == "$MARIADB_SERVICE_NAME" && $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer l'ensemble des bases ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
sudo rm -rf volume/mariadb/mysql
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2024-02-29 17:16:39 +01:00
|
|
|
|
if [[ "$1" == "$OPENLDAP_SERVICE_NAME" && $LDAP_ACTIVATE == 1 && $LDAP_LOCAL == 1 ]]
|
2023-11-06 16:18:09 +01:00
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer l'annuaire associé à $1 ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
sudo rm -rf volume/openldap/data
|
|
|
|
|
mkdir volume/openldap/data
|
|
|
|
|
chmod a+w volume/openldap/data -R
|
|
|
|
|
chmod a+r volume/openldap/data -R
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2024-02-29 17:16:39 +01:00
|
|
|
|
if [[ "$1" == "$KEYCLOAK_SERVICE_NAME" && $CAS_ACTIVATE == 1 && $CAS_LOCAL == 1 ]]
|
2023-11-06 16:18:09 +01:00
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
2024-02-29 17:16:39 +01:00
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/delete.sh $KEYCLOAK_SERVICE_NAME
|
2023-11-06 16:18:09 +01:00
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$1" == "$NINEGATE_SERVICE_NAME" && $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/delete.sh $NINEGATE_SERVICE_NAME
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-11-17 16:40:41 +01:00
|
|
|
|
if [[ "$1" == "$NINEBOARD_SERVICE_NAME" && $NINEBOARD_ACTIVATE == 1 && $NINEBOARD_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/delete.sh $NINEBOARD_SERVICE_NAME
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2023-11-06 16:18:09 +01:00
|
|
|
|
if [[ "$1" == "$NEXTCLOUD_SERVICE_NAME" && $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
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 /envole/delete.sh $NEXTCLOUD_SERVICE_NAME
|
|
|
|
|
sudo rm -rf volume/nextcloud/data
|
|
|
|
|
sudo rm -rf volume/nextcloud/html
|
|
|
|
|
sudo rm -rf volume/nextcloud/app
|
|
|
|
|
fi
|
2024-02-29 16:46:23 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ "$1" == "$WORDPRESS_SERVICE_NAME" && $WORDPRESS_ACTIVATE == 1 && $WORDPRESS_LOCAL == 1 ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]; then Question_ouinon "Souhaitez-vous supprimer la BDD associé à $1 ?";fi
|
|
|
|
|
if [[ "$?" = 0 || -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
$PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/delete.sh $WORDPRESS_SERVICE_NAME
|
2024-03-13 19:13:53 +01:00
|
|
|
|
sudo rm -rf volume/wordpress/data
|
2024-02-29 16:46:23 +01:00
|
|
|
|
fi
|
|
|
|
|
fi
|
2023-11-06 16:18:09 +01:00
|
|
|
|
}
|
2023-11-02 14:22:16 +01:00
|
|
|
|
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
#== MAIN ===================================================================================================================================
|
|
|
|
|
#===========================================================================================================================================
|
|
|
|
|
|
2024-02-29 16:46:23 +01:00
|
|
|
|
envall
|
|
|
|
|
|
2023-11-02 14:22:16 +01:00
|
|
|
|
if [[ $1 == "up" || $1 == "" ]]
|
|
|
|
|
then
|
|
|
|
|
up $2
|
|
|
|
|
elif [[ $1 == "stop" ]]
|
|
|
|
|
then
|
|
|
|
|
stop $2
|
|
|
|
|
elif [[ $1 == "bash" ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoRouge "Vous devez precisez un service"
|
|
|
|
|
EchoRouge "envole.sh bash monservice"
|
|
|
|
|
else
|
2023-11-03 14:11:23 +01:00
|
|
|
|
$PODCOMPOSEBIN exec $2 "/bin/bash"
|
2023-11-02 14:22:16 +01:00
|
|
|
|
fi
|
2023-11-06 16:18:09 +01:00
|
|
|
|
elif [[ $1 == "destroyall" ]]
|
|
|
|
|
then
|
|
|
|
|
destroyall
|
2023-11-02 14:22:16 +01:00
|
|
|
|
elif [[ $1 == "destroy" ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoRouge "Vous devez precisez un service"
|
2023-11-06 16:18:09 +01:00
|
|
|
|
EchoRouge "envole.sh destroy monservice"
|
2023-11-02 14:22:16 +01:00
|
|
|
|
else
|
2023-11-06 16:18:09 +01:00
|
|
|
|
destroy $2
|
2023-11-02 14:22:16 +01:00
|
|
|
|
fi
|
2023-11-06 16:18:09 +01:00
|
|
|
|
elif [[ $1 == "logs" ]]
|
|
|
|
|
then
|
|
|
|
|
$PODCOMPOSEBIN logs -f $2
|
2023-11-09 13:46:26 +01:00
|
|
|
|
elif [[ $1 == "iswait" ]]
|
|
|
|
|
then
|
|
|
|
|
wait_for_container $2
|
2023-11-02 14:22:16 +01:00
|
|
|
|
elif [[ $1 == "env" ]]
|
|
|
|
|
then
|
2024-02-29 16:46:23 +01:00
|
|
|
|
if [[ -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
EchoRouge "Vous devez precisez un service"
|
|
|
|
|
EchoRouge "envole.sh env monservice"
|
|
|
|
|
else
|
|
|
|
|
env $2
|
|
|
|
|
EchoVert "Fichier tmp/.env.$1 regénéré"
|
|
|
|
|
fi
|
2024-03-01 16:47:21 +01:00
|
|
|
|
elif [[ $1 == "regen" ]]
|
|
|
|
|
then
|
|
|
|
|
if [[ -z $2 ]]
|
|
|
|
|
then
|
|
|
|
|
destroyall
|
|
|
|
|
up
|
|
|
|
|
else
|
|
|
|
|
destroy $2
|
|
|
|
|
up $2
|
|
|
|
|
fi
|
2024-02-29 16:46:23 +01:00
|
|
|
|
else
|
|
|
|
|
EchoRouge "Action possible ="
|
|
|
|
|
EchoRouge "envole.sh > UP de l'ensemble des services actifs"
|
|
|
|
|
EchoRouge "envole.sh up > UP de l'ensemble des services actifs"
|
|
|
|
|
EchoRouge "envole.sh up monservice> UP de monservice"
|
|
|
|
|
EchoRouge "envole.sh stop > STOP de l'ensemble des services"
|
|
|
|
|
EchoRouge "envole.sh stop monservice> STOP de monservice"
|
|
|
|
|
EchoRouge "envole.sh bash monservice> lance un terminel dans le conteneur de monservice"
|
|
|
|
|
EchoRouge "envole.sh destroyall> détruit l'ensemble des services avec l'ensemble des BDD et des volumes persistant"
|
|
|
|
|
EchoRouge "envole.sh destroy monservice> détruit monservices et si souhaitez sa BDD et ses volumes persistant"
|
|
|
|
|
EchoRouge "envole.sh logs > LOGS de l'ensemble des services"
|
|
|
|
|
EchoRouge "envole.sh logs monservice > LOGS de monservice"
|
|
|
|
|
EchoRouge "envole.sh iswait monservice > monservice est-il en cours de construction"
|
|
|
|
|
EchoRouge "envole.sh env monservice > regeneration du fichier d'environnement de monservice"
|
2024-03-01 21:12:48 +01:00
|
|
|
|
EchoRouge "envole.sh regen > lance destroyall puis up sur l'ensemble des service"
|
|
|
|
|
EchoRouge "envole.sh regen monservice > lance destroy monservice puis up monservice"
|
2024-02-29 16:46:23 +01:00
|
|
|
|
|
2023-11-02 14:22:16 +01:00
|
|
|
|
fi
|
|
|
|
|
echo
|
2023-11-02 17:30:24 +01:00
|
|
|
|
echo
|