Transformer en template docker-stack-template avec .env.example

- Ajout .env.example : variables Docker Compose
- docker-compose.yml : mots de passe variabilises
- Scripts : chargement de config a 2 niveaux (global + per-app)
- docker-scripts.conf : renomme docker-stack-template
- URLs mises a jour dans setup, install_cron, README
This commit is contained in:
2026-06-26 16:07:02 -04:00
parent 0fc2b8d0d6
commit a2e466c074
9 changed files with 118 additions and 51 deletions
+18 -5
View File
@@ -14,17 +14,30 @@
set -euo pipefail
# ─── Charger la configuration commune ─────────────────────────────────────────
# ─── Charger la configuration ────────────────────────────────────────────────
# Ordre : 1) config globale (template) → 2) config spécifique à l'app (surcharge)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CONFIG_FILE="${CONFIG_FILE:-$SCRIPT_DIR/docker-scripts.conf}"
if [[ -f "$CONFIG_FILE" ]]; then
GLOBAL_CONFIG="${SCRIPT_DIR}/docker-scripts.conf"
if [[ -f "$GLOBAL_CONFIG" ]]; then
# shellcheck source=/dev/null
source "$CONFIG_FILE"
source "$GLOBAL_CONFIG"
fi
# ─── Nom de l'application (défaut si pas dans la config) ─────────────────────
DOCKER_APP_NAME="${DOCKER_APP_NAME:-gitea}"
# ─── Configuration locale (après chargement global, permet surcharge env) ────
COMPOSE_DIR="${COMPOSE_DIR:-/srv/docker/$DOCKER_APP_NAME}"
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.yml}"
# Charger la config spécifique à l'application (surcharge la config globale)
APP_CONFIG="${COMPOSE_DIR}/docker-scripts.conf"
if [[ -f "$APP_CONFIG" ]] && [[ "$APP_CONFIG" != "$GLOBAL_CONFIG" ]]; then
# shellcheck source=/dev/null
source "$APP_CONFIG"
fi
# ─── Configuration locale ────────────────────────────────────────────────────
SCRIPTS_DIR="${SCRIPTS_DIR:-/opt/docker-scripts}"
CRON_BACKUP_SCHEDULE="${CRON_BACKUP_SCHEDULE:-0 2 * * *}"
@@ -211,7 +224,7 @@ do_install() {
echo ""
err "Prérequis manquants. Placez les scripts dans $SCRIPTS_DIR/"
echo ""
echo " git clone https://git.dracodev.net/Outils/docker-generic-scripts.git $SCRIPTS_DIR"
echo " git clone https://git.dracodev.net/Outils/docker-stack-template.git $SCRIPTS_DIR"
echo ""
exit 1
}