svg
This commit is contained in:
parent
ccd2d4e1c0
commit
2539235c79
@ -30,6 +30,12 @@
|
||||
template="${templates[$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
|
||||
cp "$template" "$destination"
|
||||
envsubst < "$destination" > temp.conf && mv temp.conf "$destination"
|
||||
|
166
nine.sh
166
nine.sh
@ -6,60 +6,6 @@
|
||||
# Include bibliotheque de fonction
|
||||
. ./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
|
||||
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
|
||||
|
||||
# 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
|
||||
BigTitle "NINE"
|
||||
|
||||
@ -79,9 +25,9 @@ stop() {
|
||||
}
|
||||
|
||||
#===========================================================================================================================================
|
||||
#== UPSERVICE ==============================================================================================================================
|
||||
#== WAIT_FOR_CONTAINER =====================================================================================================================
|
||||
#===========================================================================================================================================
|
||||
#1 = service to up
|
||||
#1 = service to wait
|
||||
|
||||
wait_for_container() {
|
||||
container_id="nine-$1"
|
||||
@ -148,11 +94,115 @@ destroyall(){
|
||||
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
|
||||
}
|
||||
|
||||
#===========================================================================================================================================
|
||||
#== 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 == "" ]]
|
||||
then
|
||||
up $2
|
||||
@ -195,9 +245,13 @@ then
|
||||
if [[ -z $2 ]]
|
||||
then
|
||||
destroyall
|
||||
apache
|
||||
template
|
||||
up
|
||||
else
|
||||
destroy$2
|
||||
apache
|
||||
template
|
||||
up$2
|
||||
fi
|
||||
else
|
||||
|
@ -5,11 +5,7 @@
|
||||
nineapache:
|
||||
image: reg.cadoles.com/envole/nineapache:8.1
|
||||
container_name: nine-nineapache
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: curl --fail http://localhost || exit 1
|
||||
interval: 1s
|
||||
timeout: 60s
|
||||
restart: unless-stopped
|
||||
env_file: ./services/10-nineapache/env/.env.merge
|
||||
networks:
|
||||
- nine-network
|
||||
|
@ -17,7 +17,7 @@
|
||||
- 8999:8999
|
||||
- 8443:8443
|
||||
volumes:
|
||||
- './volume/keycloak/nine:/nine'
|
||||
- './services/40-keycloak/volume/nine:/nine'
|
||||
command:
|
||||
- start-dev
|
||||
- --import-realm
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Dokuwiki
|
||||
# Wiki
|
||||
# Port interne 80
|
||||
wiki:
|
||||
dokuwiki:
|
||||
image: linuxserver/dokuwiki
|
||||
container_name: nine-dokuwiki
|
||||
env_file: ./services/50-dokuwiki/env/.env.merge
|
||||
|
@ -14,5 +14,5 @@
|
||||
networks:
|
||||
- nine-network
|
||||
volumes:
|
||||
- ./volume/nineboard/data/private:/app/uploads
|
||||
- ./volume/nineboard/data/public:/app/public/uploads
|
||||
- ./services/50-nineboard/volume/data/private:/app/uploads
|
||||
- ./services/50-nineboard/volume/data/public:/app/public/uploads
|
||||
|
Loading…
Reference in New Issue
Block a user