42 lines
1.6 KiB
Bash
Executable file
42 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# PRE_HERMES Control Plane — CP1 Deployment-Skript (reproduzierbar aus SoT)
|
|
#
|
|
# Reproduziert AUSSCHLIESSLICH die bereits vorhandenen CP1-Artefakte.
|
|
# KEINE Runtime-State-Änderung. Deployment-Code und Runtime-State strikt getrennt.
|
|
#
|
|
# Verwendung (als root auf dem Host):
|
|
# ./deploy_control_plane.sh
|
|
#
|
|
# Dieses Skript:
|
|
# - installiert control_reader.py nach /opt/control-plane/bin/
|
|
# - erzeugt die Verzeichnisstruktur (falls nicht vorhanden)
|
|
# - überschreibt KEINE bestehenden State-Dateien (Runtime-State bleibt unangetastet)
|
|
# - erzeugt die Status-Projection neu (read-only, root-owned)
|
|
#
|
|
# Rollback: rm -rf /opt/control-plane (reine neue Dateien, keine bestehende Komponente)
|
|
|
|
set -euo pipefail
|
|
|
|
CP_ROOT="/opt/control-plane"
|
|
CP_BIN="$CP_ROOT/bin"
|
|
CP_STATE="$CP_ROOT/state"
|
|
CP_AUDIT="$CP_ROOT/audit"
|
|
CP_STATUS="$CP_ROOT/status"
|
|
|
|
# 1) Verzeichnisstruktur (idempotent)
|
|
install -d -o root -g root -m 0755 "$CP_ROOT"
|
|
install -d -o root -g root -m 0700 "$CP_STATE"
|
|
install -d -o root -g root -m 0700 "$CP_AUDIT"
|
|
install -d -o root -g root -m 0755 "$CP_BIN"
|
|
install -d -o root -g root -m 0755 "$CP_STATUS"
|
|
|
|
# 2) Reader installieren (exakt der SoT-Code)
|
|
install -o root -g root -m 0755 "$(dirname "$0")/control_reader.py" "$CP_BIN/control_reader.py"
|
|
|
|
# 3) Status-Projection neu erzeugen (read-only, root-owned)
|
|
"$CP_BIN/control_reader.py" > "$CP_STATUS/latest.txt"
|
|
chown root:root "$CP_STATUS/latest.txt"
|
|
chmod 0444 "$CP_STATUS/latest.txt"
|
|
|
|
echo "CP1 deployt. State-Dateien wurden NICHT überschrieben (Runtime-State bleibt erhalten)."
|
|
echo "Status-Projection: $CP_STATUS/latest.txt"
|