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
+14 -7
View File
@@ -17,23 +17,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 conf, permet surcharge env) ──────
BACKUP_DIR="${BACKUP_DIR:-/NFS/BACKUP/DOCKER/$HOSTNAME/$DOCKER_APP_NAME}"
COMPOSE_DIR="${COMPOSE_DIR:-$HOME/dev/git/outils/$DOCKER_APP_NAME}"
# ─── 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
# Conteneurs (dérivés de DOCKER_APP_NAME)
DB_CONTAINER="${DB_CONTAINER:-${DOCKER_APP_NAME}_db}"
APP_CONTAINER="${APP_CONTAINER:-${DOCKER_APP_NAME}_server}"