Docker-Gruppe server_<SERVER>_docker_compose (Default H1), Deploy-Verzeichnis 'deployment', Repo-Link in authentik notes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c2add5e660
commit
658d975ac9
3 files changed
+36
-10
No files matched your search
+20
-2
@@ -7,10 +7,28 @@ IFS=$'\n\t'
|
||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
readonly SCRIPT_NAME="$(basename "$0")"
|
||||
readonly DEPLOY_SUBDIR="its-deploy"
|
||||
readonly DEPLOY_GROUP="server_APPS_docker_compose"
|
||||
readonly DEPLOY_SUBDIR="deployment"
|
||||
readonly CONFIG_FILE="/etc/docker-deploy.conf"
|
||||
readonly ALLOWED_ACTIONS=(build up down restart logs pull deploy)
|
||||
|
||||
# ── Konfiguration ────────────────────────────────────────────────────────────
|
||||
# Optional: /etc/docker-deploy.conf (root-owned, nicht group/world-writable) mit
|
||||
# DEPLOY_SERVER=H1
|
||||
# Berechtigte Gruppe: server_${DEPLOY_SERVER}_docker_compose.
|
||||
# Bewusst keine Umgebungsvariable/kein Parameter: sudo-Aufrufer sollen die
|
||||
# Berechtigungsprüfung nicht selbst umstellen können.
|
||||
DEPLOY_SERVER="H1"
|
||||
if [[ -e "$CONFIG_FILE" ]]; then
|
||||
IFS=' ' read -r cfg_owner cfg_mode < <(stat -c '%u %a' "$CONFIG_FILE")
|
||||
if [[ "$cfg_owner" != 0 ]] || (( 8#$cfg_mode & 8#022 )); then
|
||||
echo "❌ $CONFIG_FILE muss root gehören und darf nicht group/world-writable sein" >&2
|
||||
exit 1
|
||||
fi
|
||||
DEPLOY_SERVER="$(sed -n 's/^DEPLOY_SERVER=//p' "$CONFIG_FILE" | tail -n1 | tr -d "\"' ")"
|
||||
fi
|
||||
[[ "$DEPLOY_SERVER" =~ ^[A-Za-z0-9_-]+$ ]] || { echo "❌ Ungültiger DEPLOY_SERVER: '$DEPLOY_SERVER'" >&2; exit 1; }
|
||||
readonly DEPLOY_GROUP="server_${DEPLOY_SERVER}_docker_compose"
|
||||
|
||||
# ── Hilfsfunktionen ──────────────────────────────────────────────────────────
|
||||
log() { printf '[%(%Y-%m-%d %H:%M:%S)T] %s\n' -1 "$*"; }
|
||||
die() { printf '❌ %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
Reference in new issue
Block a user