Files
p42.s-m/deploy/update-docker.sh
T
guyg1474andClaude Opus 5.5 c6eef176a2 P42-S.M.: Server-Monitoring-Agent als Docker-Container
Misst CPU, RAM, Swap, Platten, Netzwerk, Temperaturen und Prozesse des
Hosts und liefert sie als JSON-API (/api/metrics, /api/history) für das
P42-Dashboard. Nur Python-Standardbibliothek, Token-geschützt,
Container ohne Root und mit schreibgeschütztem Dateisystem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:15:01 +02:00

25 lines
655 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Container bauen und (neu) starten – auf dem Server ausführen: <projektordner>/deploy/update-docker.sh
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")/.."
# Neuen Code holen, falls das Projekt per Git auf den Server kam
if [ -d .git ]; then
git pull --ff-only
fi
# Beim ersten Mal: .env mit zufälligem Token anlegen
if [ ! -f .env ]; then
cp .env.example .env
sed -i "s/^SM_TOKEN=.*/SM_TOKEN=$(openssl rand -hex 32)/" .env
chmod 600 .env
echo ".env wurde angelegt. Token für P42-F.W.:"
grep '^SM_TOKEN=' .env | cut -d= -f2
fi
docker compose up -d --build
docker image prune -f >/dev/null
sleep 5
docker compose ps