Compare commits

...

8 Commits

Author SHA1 Message Date
b5cb3549ab Merge branch 'develop' 2024-07-27 11:07:45 +02:00
0c97bd132c svg 2024-07-27 11:07:36 +02:00
5e139177f7 Merge branch 'develop' 2024-07-27 11:05:35 +02:00
a15f4fe103 svg 2024-07-27 11:05:26 +02:00
a4b3b0ad48 svg 2024-07-27 11:02:30 +02:00
cc4abaf240 svg 2024-07-27 11:01:26 +02:00
2539235c79 svg 2024-07-27 10:19:39 +02:00
ccd2d4e1c0 svg 2024-07-26 23:18:04 +02:00
151 changed files with 158 additions and 77 deletions

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
**/.env.local **/.env.local
**/.env.merge **/.env.merge
docker-compose.yml
/services/10-nineapache/volume/apache /services/10-nineapache/volume/apache
/services/15-mariadb/volume/mysql /services/15-mariadb/volume/mysql

3
env/.env vendored
View File

@ -111,7 +111,6 @@ CAS_PORT=8999
CAS_PATH=/auth/realms/nine/protocol/cas CAS_PATH=/auth/realms/nine/protocol/cas
CAS_URL=${PROTOCOLE}://${CAS_HOST}:${CAS_PORT} CAS_URL=${PROTOCOLE}://${CAS_HOST}:${CAS_PORT}
# DOKUWIKI # DOKUWIKI
DOKUWIKI_SERVICE_NAME=dokuwiki DOKUWIKI_SERVICE_NAME=dokuwiki
DOKUWIKI_ACTIVATE=0 DOKUWIKI_ACTIVATE=0
@ -120,7 +119,7 @@ DOKUWIKI_URL=${PROTOCOLE}://${WEB_URL}/dokuwiki
# NEXTCLOUD # NEXTCLOUD
NEXTCLOUD_SERVICE_NAME=nextcloud NEXTCLOUD_SERVICE_NAME=nextcloud
NEXTCLOUD_ACTIVATE=0 NEXTCLOUD_ACTIVATE=1
NEXTCLOUD_LOCAL=1 NEXTCLOUD_LOCAL=1
NEXTCLOUD_URL=${PROTOCOLE}://${WEB_URL}/nextcloud NEXTCLOUD_URL=${PROTOCOLE}://${WEB_URL}/nextcloud
NEXTCLOUD_SAMBA=0 NEXTCLOUD_SAMBA=0

View File

@ -30,6 +30,12 @@
template="${templates[$i]}" template="${templates[$i]}"
destination="${destinations[$i]}" destination="${destinations[$i]}"
# Extraire le répertoire de destination
folder=$(dirname "$destination")
# Créer le répertoire de destination
mkdir -p "$folder"
# Copier le template vers l'emplacement de destination # Copier le template vers l'emplacement de destination
cp "$template" "$destination" cp "$template" "$destination"
envsubst < "$destination" > temp.conf && mv temp.conf "$destination" envsubst < "$destination" > temp.conf && mv temp.conf "$destination"

182
nine.sh
View File

@ -6,59 +6,6 @@
# Include bibliotheque de fonction # Include bibliotheque de fonction
. ./misc/tools/e-ihm.sh . ./misc/tools/e-ihm.sh
# Include variable d'environnement global
mergeenv env/.env.merge env/.env env/.env.local
. env/.env.merge
# Construction du docker-compose
echo "services:" > docker-compose.yml
# Include service
declare -A services
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
keyservice="${dir##*-}"
valueservice="${dir##*/}"
# Include bibliotheque de fonction
if [ -f "$dir/misc/nine.sh" ]; then
. $dir/misc/nine.sh
fi
# Include variable d'environnement global
if [ -f "$dir/env/.env" ]; then
. $dir/env/.env
fi
# Include variable d'environnement local
if [ -f "$dir/env/.env.local" ]; then
. $dir/env/.env.local
fi
# Construction du docker-compose
if [ -f "$dir/dockercompose/dockercompose.yml" ]; then
cat "$dir/dockercompose/dockercompose.yml" >> docker-compose.yml
fi
# Construction .env.merge
mergeenv $dir/env/.env.merge env/.env.merge $dir/env/.env $dir/env/.env.local
# Construction conf apache
if [ -f "$dir/apache/apache.conf" ]; then
cp "$dir/apache/apache.conf" services/10-nineapache/volume/apache/$valueservice.conf
fi
# Templetisation
misc/tools/dicos.sh $dir
# Sauvegarder le service
services["$keyservice"]="$valueservice"
done
# Construction du docker-compose
echo "networks:" >> docker-compose.yml
echo " nine-network:" >> docker-compose.yml
echo " name: nine-network" >> docker-compose.yml
# Start script # Start script
BigTitle "NINE" BigTitle "NINE"
@ -78,9 +25,9 @@ stop() {
} }
#=========================================================================================================================================== #===========================================================================================================================================
#== UPSERVICE ============================================================================================================================== #== WAIT_FOR_CONTAINER =====================================================================================================================
#=========================================================================================================================================== #===========================================================================================================================================
#1 = service to up #1 = service to wait
wait_for_container() { wait_for_container() {
container_id="nine-$1" container_id="nine-$1"
@ -147,11 +94,127 @@ destroyall(){
fi fi
} }
#===========================================================================================================================================
#== ENV ====================================================================================================================================
#===========================================================================================================================================
# Construction des environnements mergés par service
env(){
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
mergeenv $dir/env/.env.merge env/.env.merge $dir/env/.env $dir/env/.env.local
done
}
#===========================================================================================================================================
#== DOCKERCOMPOSE ====================================================================================================================================
#===========================================================================================================================================
# Construction du dockercompose
dockercompose() {
echo "services:" > docker-compose.yml
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
# Construction du docker-compose
if [ -f "$dir/dockercompose/dockercompose.yml" ]; then
cat "$dir/dockercompose/dockercompose.yml" >> docker-compose.yml
fi
done
echo "networks:" >> docker-compose.yml
echo " nine-network:" >> docker-compose.yml
echo " name: nine-network" >> docker-compose.yml
}
#===========================================================================================================================================
#== APACHE =================================================================================================================================
#===========================================================================================================================================
# Construction conf apache
apache(){
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
keyservice="${dir##*-}"
valueservice="${dir##*/}"
mkdir -p services/10-nineapache/volume/apache
if [ -f "$dir/apache/apache.conf" ]; then
cp "$dir/apache/apache.conf" services/10-nineapache/volume/apache/$valueservice.conf
fi
done
}
#===========================================================================================================================================
#== TEMPLATE================================================================================================================================
#===========================================================================================================================================
# Templatisation
template() {
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
misc/tools/dicos.sh $dir
done
}
#===========================================================================================================================================
#== SERVICES ===============================================================================================================================
#===========================================================================================================================================
# Liste des services
services() {
Title "SERVICES"
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
keyservice="${dir##*-}"
valueservice="${dir##*/}"
Echo $keyservice
done
}
#=========================================================================================================================================== #===========================================================================================================================================
#== MAIN =================================================================================================================================== #== MAIN ===================================================================================================================================
#=========================================================================================================================================== #===========================================================================================================================================
# Include variable d'environnement global
mergeenv env/.env.merge env/.env env/.env.local
. env/.env.merge
# Include service
declare -A services
for dir in $(ls -d "services"/[0-9][0-9]-* | sort); do
keyservice="${dir##*-}"
valueservice="${dir##*/}"
# Include bibliotheque de fonction
if [ -f "$dir/misc/nine.sh" ]; then
. $dir/misc/nine.sh
fi
# Include variable d'environnement global
if [ -f "$dir/env/.env" ]; then
. $dir/env/.env
fi
# Include variable d'environnement local
if [ -f "$dir/env/.env.local" ]; then
. $dir/env/.env.local
fi
# Sauvegarder le service
services["$keyservice"]="$valueservice"
done
# Construction des environnements mergés par service
env
# Construction docker_compose
dockercompose
# Construction de la configuration apache
apache
# Templetisation
template
# Execution de la commande
if [[ $1 == "up" || $1 == "" ]] if [[ $1 == "up" || $1 == "" ]]
then then
up $2 up $2
@ -183,6 +246,9 @@ then
else else
destroy$2 destroy$2
fi fi
elif [[ $1 == "services" ]]
then
services
elif [[ $1 == "logs" ]] elif [[ $1 == "logs" ]]
then then
docker-compose logs -f $2 docker-compose logs -f $2
@ -194,9 +260,13 @@ then
if [[ -z $2 ]] if [[ -z $2 ]]
then then
destroyall destroyall
apache
template
up up
else else
destroy$2 destroy$2
apache
template
up$2 up$2
fi fi
else else
@ -211,12 +281,12 @@ else
EchoRouge "nine.sh bash monservice> lance un terminel dans le conteneur de monservice" EchoRouge "nine.sh bash monservice> lance un terminel dans le conteneur de monservice"
EchoRouge "nine.sh destroyall> détruit l'ensemble des services avec l'ensemble des BDD et des volumes persistant" EchoRouge "nine.sh destroyall> détruit l'ensemble des services avec l'ensemble des BDD et des volumes persistant"
EchoRouge "nine.sh destroy monservice> détruit monservices et si souhaitez sa BDD et ses volumes persistant" EchoRouge "nine.sh destroy monservice> détruit monservices et si souhaitez sa BDD et ses volumes persistant"
EchoRouge "nine.sh services > Liste des Services"
EchoRouge "nine.sh logs > LOGS de l'ensemble des services" EchoRouge "nine.sh logs > LOGS de l'ensemble des services"
EchoRouge "nine.sh logs monservice > LOGS de monservice" EchoRouge "nine.sh logs monservice > LOGS de monservice"
EchoRouge "nine.sh iswait monservice > monservice est-il en cours de construction" EchoRouge "nine.sh iswait monservice > monservice est-il en cours de construction"
EchoRouge "nine.sh regen > lance destroyall puis up sur l'ensemble des service" EchoRouge "nine.sh regen > lance destroyall puis up sur l'ensemble des service"
EchoRouge "nine.sh regen monservice > lance destroy monservice puis up monservice" EchoRouge "nine.sh regen monservice > lance destroy monservice puis up monservice"
fi fi
echo echo
echo echo

View File

@ -5,11 +5,7 @@
nineapache: nineapache:
image: reg.cadoles.com/envole/nineapache:8.1 image: reg.cadoles.com/envole/nineapache:8.1
container_name: nine-nineapache container_name: nine-nineapache
restart: unless-stopped restart: unless-stopped
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
env_file: ./services/10-nineapache/env/.env.merge env_file: ./services/10-nineapache/env/.env.merge
networks: networks:
- nine-network - nine-network

View File

View File

View File

@ -17,7 +17,7 @@
- 8999:8999 - 8999:8999
- 8443:8443 - 8443:8443
volumes: volumes:
- './volume/keycloak/nine:/nine' - './services/40-keycloak/volume/nine:/nine'
command: command:
- start-dev - start-dev
- --import-realm - --import-realm

View File

@ -35,7 +35,7 @@ function destroykeycloak {
if [[ "$response" == 0 || ! -z $1 ]] if [[ "$response" == 0 || ! -z $1 ]]
then then
EchoRouge "Delete BDD = $KEYCLOAK_SERVICE_NAME" EchoRouge "Delete BDD = $KEYCLOAK_SERVICE_NAME"
docker-compose exec $KEYCLOAK_SERVICE_NAME /nine/delete.sh $KEYCLOAK_SERVICE_NAME docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $KEYCLOAK_SERVICE_NAME
fi fi
echo "" echo ""

View File

@ -2,7 +2,7 @@
# Dokuwiki # Dokuwiki
# Wiki # Wiki
# Port interne 80 # Port interne 80
wiki: dokuwiki:
image: linuxserver/dokuwiki image: linuxserver/dokuwiki
container_name: nine-dokuwiki container_name: nine-dokuwiki
env_file: ./services/50-dokuwiki/env/.env.merge env_file: ./services/50-dokuwiki/env/.env.merge

View File

@ -5,11 +5,7 @@
nextcloud: nextcloud:
image: reg.cadoles.com/envole/nextcloud image: reg.cadoles.com/envole/nextcloud
container_name: nine-nextcloud container_name: nine-nextcloud
restart: unless-stopped restart: unless-stopped
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 1s
timeout: 60s
env_file: ./services/50-nextcloud/env/.env.merge env_file: ./services/50-nextcloud/env/.env.merge
networks: networks:
- nine-network - nine-network

View File

@ -7,5 +7,5 @@ MYSQL_USER=${MARIADB_USER}
MYSQL_PASSWORD=${MARIADB_PASSWORD} MYSQL_PASSWORD=${MARIADB_PASSWORD}
NEXTCLOUD_ADMIN_USER=${ADMIN_USER} NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
NEXTCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD} NEXTCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
NEXTCLOUD_ALIAS= NEXTCLOUD_ALIAS=${NEXTCLOUD_SERVICE_NAME}

View File

@ -4,7 +4,16 @@ function upnextcloud {
if [[ $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]] if [[ $NEXTCLOUD_ACTIVATE == 1 && $NEXTCLOUD_LOCAL == 1 ]]
then then
Title ${NEXTCLOUD_SERVICE_NAME^^} Title ${NEXTCLOUD_SERVICE_NAME^^}
# CREATE BDD
if [[ $MARIADB_ACTIVATE == 1 && $MARIADB_LOCAL == 1 ]]
then
EchoVert "DATABASE"
Echo ${NEXTCLOUD_SERVICE_NAME^^}
docker-compose exec $MARIADB_SERVICE_NAME /nine/init.sh $NEXTCLOUD_SERVICE_NAME
Echo
fi
EchoVert "CONTAINER" EchoVert "CONTAINER"
upservice ${NEXTCLOUD_SERVICE_NAME} upservice ${NEXTCLOUD_SERVICE_NAME}
Echo Echo
@ -26,6 +35,7 @@ function destroynextcloud {
if [[ "$response" == 0 || ! -z $1 ]] if [[ "$response" == 0 || ! -z $1 ]]
then then
EchoRouge "Purge = $NEXTCLOUD_SERVICE_NAME" EchoRouge "Purge = $NEXTCLOUD_SERVICE_NAME"
docker-compose exec $MARIADB_SERVICE_NAME /nine/delete.sh $NEXTCLOUD_SERVICE_NAME
rm -rf services/50-nextcloud/volume/data rm -rf services/50-nextcloud/volume/data
rm -rf services/50-nextcloud/volume/html rm -rf services/50-nextcloud/volume/html
rm -rf services/50-nextcloud/volume/app rm -rf services/50-nextcloud/volume/app

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

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