This commit is contained in:
root 2023-11-03 14:11:23 +01:00
parent 963233ff83
commit 04345ec2ea
4 changed files with 115 additions and 24 deletions

2
src/envole-1.0/.env Normal file
View File

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

View File

@ -10,6 +10,8 @@ services:
interval: 1s interval: 1s
timeout: 60s timeout: 60s
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- "3306:3306" - "3306:3306"
volumes: volumes:
@ -17,7 +19,7 @@ services:
- ./volume/mariadb/envole:/envole - ./volume/mariadb/envole:/envole
openldap: openldap:
image: docker.io/library/bitnami/openldap:2 image: docker.io/bitnami/openldap:2
container_name: envole-openldap container_name: envole-openldap
restart: always restart: always
healthcheck: healthcheck:
@ -25,6 +27,8 @@ services:
interval: 1s interval: 1s
timeout: 60s timeout: 60s
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- '1389:1389' - '1389:1389'
- '1636:1636' - '1636:1636'
@ -35,7 +39,7 @@ services:
- './volume/openldap/envole:/envole' - './volume/openldap/envole:/envole'
keycloak: keycloak:
image: docker.io/library/jboss/keycloak image: docker.io/jboss/keycloak
container_name: envole-keycloak container_name: envole-keycloak
restart: always restart: always
healthcheck: healthcheck:
@ -43,6 +47,8 @@ services:
interval: 1s interval: 1s
timeout: 60s timeout: 60s
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- 9000:8443 - 9000:8443
volumes: volumes:
@ -58,6 +64,8 @@ services:
interval: 1s interval: 1s
timeout: 60s timeout: 60s
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- "9001:80" - "9001:80"
volumes: volumes:
@ -73,6 +81,8 @@ services:
interval: 1s interval: 1s
timeout: 60s timeout: 60s
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- 9002:80 - 9002:80
volumes: volumes:
@ -83,17 +93,38 @@ services:
- ./volume/nextcloud/prestart:/docker-entrypoint-hooks.d/before-starting - ./volume/nextcloud/prestart:/docker-entrypoint-hooks.d/before-starting
adminer: adminer:
image: adminer image: docker.io/library/adminer
container_name: envole-adminer container_name: envole-adminer
restart: always restart: always
env_file: ./.env.local
networks:
- envole-network
ports: ports:
- 9100:8080 - 9100:8080
phpldapadmin: phpldapadmin:
image: osixia/phpldapadmin:latest image: docker.io/osixia/phpldapadmin:latest
container_name: envole-phpldapadmin container_name: envole-phpldapadmin
restart: always restart: always
env_file: ./.env.local env_file: ./.env.local
networks:
- envole-network
ports: ports:
- "9101:80" - "9101:80"
nineapache:
image: reg.cadoles.com/envole/nineapache:7.4
container_name: envole-nineapache
restart: always
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
env_file: ./.env.local
networks:
- envole-network
ports:
- "9002:80"
networks:
envole-network:

View File

@ -74,4 +74,9 @@ PHPLDAPADMIN_ACTIVATE=0
PHPLDAPADMIN_LOCAL=1 PHPLDAPADMIN_LOCAL=1
PHPLDAPADMIN_URL=http://localhost:9001 PHPLDAPADMIN_URL=http://localhost:9001
# NINEAPACHE
NINEAPACHE_SERVICE_NAME=nineapache
NINEAPACHE_ACTIVATE=0
NINEAPACHE_LOCAL=1
NINEAPACHE_URL=http://localhost:9002

View File

@ -6,8 +6,50 @@
# Fusionner l'ensemble des fichier .env en un seul # Fusionner l'ensemble des fichier .env en un seul
rm -f ./.env.local rm -f ./.env.local
cat ./env/.env* >> ./.env.local cat ./env/.env* >> ./.env.local
. ./.env.local
# on remplace les valeur reprise dans les autres .env car podman interprète mal
#while IFS= read -r match; do
# eval "val=\${$match}"
# echo ${ADMIN_PASSWORD}
# echo ${match}
# echo ${!match}
# echo $val
# sed -i "s/${match}/${val}/g" ./.env.local
#done < <(grep -oP '\$\{\w+\}' ./.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#${LDAP_SERVICE_NAME}#'${LDAP_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
# Include # Include
. .env
. ./misc/tools/e-ihm.sh . ./misc/tools/e-ihm.sh
. ./env/.env . ./env/.env
. ./env/.env.local . ./env/.env.local
@ -23,7 +65,7 @@ BigTitle "ENVOLE"
stop() { stop() {
Title "STOP" Title "STOP"
docker-compose stop $1 $PODCOMPOSEBIN stop $1
} }
#=========================================================================================================================================== #===========================================================================================================================================
@ -33,13 +75,13 @@ stop() {
wait_for_container() { wait_for_container() {
container_id="envole-$1" container_id="envole-$1"
container_name="$(docker inspect "${container_id}" --format '{{ .Name }}')" container_name="$($PODBIN inspect "${container_id}" --format '{{ .Name }}')"
waiting_done="false" waiting_done="false"
while [[ "${waiting_done}" != "true" ]]; do while [[ "${waiting_done}" != "true" ]]; do
container_state="$(docker inspect "${container_id}" --format '{{ .State.Status }}')" container_state="$($PODBIN inspect "${container_id}" --format '{{ .State.Status }}')"
if [[ "${container_state}" == "running" ]]; then if [[ "${container_state}" == "running" ]]; then
health_status="$(docker inspect "${container_id}" --format '{{ .State.Health.Status }}')" health_status="$($PODBIN inspect "${container_id}" --format '{{ .State.Health.Status }}')"
if [[ ${health_status} == "healthy" ]]; then if [[ ${health_status} == "healthy" ]]; then
waiting_done="true" waiting_done="true"
fi fi
@ -51,7 +93,7 @@ wait_for_container() {
} }
upservice(){ upservice(){
docker-compose up -d $1 $PODCOMPOSEBIN up -d $1
wait_for_container $1 wait_for_container $1
} }
@ -75,19 +117,19 @@ up(){
if [[ $CAS_ACTIVATE == 1 && $CAS_LOCAL == 1 ]] if [[ $CAS_ACTIVATE == 1 && $CAS_LOCAL == 1 ]]
then then
EchoVert ${CAS_SERVICE_NAME^^} EchoVert ${CAS_SERVICE_NAME^^}
docker-compose exec $MARIADB_SERVICE_NAME /envole/init.sh $CAS_SERVICE_NAME $PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $CAS_SERVICE_NAME
fi fi
if [[ $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]] if [[ $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]]
then then
EchoVert ${NINEGATE_SERVICE_NAME^^} EchoVert ${NINEGATE_SERVICE_NAME^^}
docker-compose exec $MARIADB_SERVICE_NAME /envole/init.sh $NINEGATE_SERVICE_NAME $PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $NINEGATE_SERVICE_NAME
fi fi
if [[ $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]] if [[ $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]]
then then
EchoVert ${NEXTCLOUD_SERVICE_NAME^^} EchoVert ${NEXTCLOUD_SERVICE_NAME^^}
docker-compose exec $MARIADB_SERVICE_NAME /envole/init.sh $NEXTCLOUD_SERVICE_NAME $PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/init.sh $NEXTCLOUD_SERVICE_NAME
fi fi
# OPENLDAP # OPENLDAP
@ -97,8 +139,10 @@ up(){
mkdir -p ./volume/openldap/data mkdir -p ./volume/openldap/data
chmod a+wr ./volume/openldap/data chmod a+wr ./volume/openldap/data
#$PODCOMPOSEBIN up -d $LDAP_SERVICE_NAME
upservice $LDAP_SERVICE_NAME upservice $LDAP_SERVICE_NAME
docker-compose exec $LDAP_SERVICE_NAME /envole/init.sh $PODCOMPOSEBIN exec $LDAP_SERVICE_NAME /envole/init.sh
fi fi
# CAS # CAS
@ -116,7 +160,8 @@ up(){
if [[ $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]] if [[ $NINEGATE_ACTIVATE == 1 && $NINEGATE_LOCAL == 1 ]]
then then
EchoVert ${NINEGATE_SERVICE_NAME^^} EchoVert ${NINEGATE_SERVICE_NAME^^}
upservice ${NINEGATE_SERVICE_NAME} $PODCOMPOSEBIN up -d $NINEGATE_SERVICE_NAME
#upservice ${NINEGATE_SERVICE_NAME}
echo echo
fi fi
@ -131,19 +176,26 @@ up(){
if [[ $ADMINER_ACTIVATE == 1 && $ADMINER_LOCAL == 1 ]] if [[ $ADMINER_ACTIVATE == 1 && $ADMINER_LOCAL == 1 ]]
then then
EchoVert ${ADMINER_SERVICE_NAME^^} EchoVert ${ADMINER_SERVICE_NAME^^}
docker-compose up -d ${ADMINER_SERVICE_NAME} $PODCOMPOSEBIN up -d ${ADMINER_SERVICE_NAME}
echo echo
fi fi
if [[ $PHPLDAPADMIN_ACTIVATE == 1 && $PHPLDAPADMIN_LOCAL == 1 ]] if [[ $PHPLDAPADMIN_ACTIVATE == 1 && $PHPLDAPADMIN_LOCAL == 1 ]]
then then
EchoVert ${PHPLDAPADMIN_SERVICE_NAME^^} EchoVert ${PHPLDAPADMIN_SERVICE_NAME^^}
docker-compose up -d ${PHPLDAPADMIN_SERVICE_NAME} $PODCOMPOSEBIN up -d ${PHPLDAPADMIN_SERVICE_NAME}
echo echo
fi fi
if [[ $NINEAPACHE_ACTIVATE == 1 && $NINEAPACHE_LOCAL == 1 ]]
then
EchoVert ${NINEAPACHE_SERVICE_NAME^^}
$PODCOMPOSEBIN up -d ${NINEAPACHE_SERVICE_NAME}
echo
fi
else else
EchoVert ${1^^} EchoVert ${1^^}
docker-compose up -d $1 $PODCOMPOSEBIN up -d $1
fi fi
} }
@ -165,7 +217,7 @@ then
EchoRouge "Vous devez precisez un service" EchoRouge "Vous devez precisez un service"
EchoRouge "envole.sh bash monservice" EchoRouge "envole.sh bash monservice"
else else
docker-compose exec $2 "/bin/bash" $PODCOMPOSEBIN exec $2 "/bin/bash"
fi fi
elif [[ $1 == "destroy" ]] elif [[ $1 == "destroy" ]]
then then
@ -174,9 +226,11 @@ then
EchoRouge "Vous devez precisez un service" EchoRouge "Vous devez precisez un service"
EchoRouge "envole.sh bash monservice" EchoRouge "envole.sh bash monservice"
else else
docker-compose stop $2 $PODCOMPOSEBIN down $2
docker-compose rm $2 $PODCOMPOSEBIN rm $2
echo $2
echo $LDAP_SERVICE_NAME
if [[ "$2" == "$LDAP_SERVICE_NAME" && $LDAP_ACTIVATE == 1 && $LDAP_LOCAL == 1 ]] if [[ "$2" == "$LDAP_SERVICE_NAME" && $LDAP_ACTIVATE == 1 && $LDAP_LOCAL == 1 ]]
then then
sudo rm -rf volume/openldap/data sudo rm -rf volume/openldap/data
@ -190,15 +244,14 @@ then
Question_ouinon "Souhaitez-vous supprimer la BDD associé à $2 ?" Question_ouinon "Souhaitez-vous supprimer la BDD associé à $2 ?"
if [ "$?" = 0 ] if [ "$?" = 0 ]
then then
docker-compose exec $MARIADB_SERVICE_NAME /envole/delete.sh $CAS_SERVICE_NAME $PODCOMPOSEBIN exec $MARIADB_SERVICE_NAME /envole/delete.sh $CAS_SERVICE_NAME
fi fi
fi fi
fi fi
elif [[ $1 == "env" ]] elif [[ $1 == "env" ]]
then then
rm -f ./.env.local EchoVert Fichier .env.local regénéré
cat ./env/.env* >> ./.env.local
fi fi
echo echo
echo echo