Initial resurrection kit — 81 scripts, 62 references, configs, systemd units, crons, Docker compose files, Caddy config, master README
This commit is contained in:
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
# hermes-system-config-sync.sh — Sync system-level configs to Wasabi
|
||||
# Mirrors Caddyfile, systemd service files, ops scripts, SSH keys, and .env
|
||||
# credential files to the itpropartner-system-configs bucket.
|
||||
# Silent on success, loud on failure.
|
||||
set -euo pipefail
|
||||
|
||||
HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
|
||||
ENDPOINT="https://s3.us-east-1.wasabisys.com"
|
||||
BUCKET="itpropartner-system-configs"
|
||||
DATE_TAG=$(date +%F)
|
||||
|
||||
if [ -f /opt/awscli-venv/bin/activate ]; then
|
||||
source /opt/awscli-venv/bin/activate
|
||||
fi
|
||||
|
||||
echo "[+] Syncing Caddyfile..."
|
||||
if [ -f /etc/caddy/Caddyfile ]; then
|
||||
aws s3 cp /etc/caddy/Caddyfile "s3://$BUCKET/caddy/Caddyfile" \
|
||||
--endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true
|
||||
fi
|
||||
|
||||
echo "[+] Syncing systemd service files..."
|
||||
if [ -d "/etc/systemd/system" ]; then
|
||||
# Create a temp dir to collect relevant service files
|
||||
TMPDIR=$(mktemp -d)
|
||||
cp /etc/systemd/system/hermes*.service "$TMPDIR/" 2>/dev/null || true
|
||||
cp /etc/systemd/system/mysql-tunnel.service "$TMPDIR/" 2>/dev/null || true
|
||||
cp /etc/systemd/system/ollama.service "$TMPDIR/" 2>/dev/null || true
|
||||
cp /etc/systemd/system/shark-game.service "$TMPDIR/" 2>/dev/null || true
|
||||
aws s3 sync "$TMPDIR" "s3://$BUCKET/systemd/" \
|
||||
--endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true
|
||||
rm -rf "$TMPDIR"
|
||||
fi
|
||||
|
||||
echo "[+] Syncing ops scripts..."
|
||||
if [ -d "$HERMES_HOME/scripts" ]; then
|
||||
aws s3 sync "$HERMES_HOME/scripts" "s3://$BUCKET/scripts/" \
|
||||
--endpoint-url "$ENDPOINT" \
|
||||
--exclude ".backups/*" \
|
||||
--exclude "migration-backup/*" \
|
||||
--exclude "*.pyc" \
|
||||
--exclude "__pycache__/*" \
|
||||
2>&1 | grep -v "^$" || true
|
||||
fi
|
||||
|
||||
echo "[+] Syncing SSH keys..."
|
||||
if [ -d "$HOME/.ssh" ]; then
|
||||
aws s3 sync "$HOME/.ssh" "s3://$BUCKET/ssh/" \
|
||||
--endpoint-url "$ENDPOINT" \
|
||||
--exclude "known_hosts" \
|
||||
--exclude "authorized_keys" \
|
||||
--exclude "config" \
|
||||
2>&1 | grep -v "^$" || true
|
||||
fi
|
||||
|
||||
echo "[+] Syncing .env credential files..."
|
||||
if [ -f "$HERMES_HOME/.env" ]; then
|
||||
aws s3 cp "$HERMES_HOME/.env" "s3://$BUCKET/env/hermes.env" \
|
||||
--endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true
|
||||
fi
|
||||
if [ -f "$HOME/.aws/credentials" ]; then
|
||||
aws s3 cp "$HOME/.aws/credentials" "s3://$BUCKET/env/aws-credentials" \
|
||||
--endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true
|
||||
fi
|
||||
|
||||
echo "[+] System config sync to $BUCKET complete."
|
||||
exit 0
|
||||
Reference in New Issue
Block a user