#!/bin/bash # hermes-docker-sync.sh — Sync Docker volumes to Wasabi # Mirrors Docker volume data (Docuseal, Vaultwarden, TwentyCRM, SearXNG, Ollama) # to the itpropartner-docker-volumes 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-docker-volumes" DATE_TAG=$(date +%F) if [ -f /opt/awscli-venv/bin/activate ]; then source /opt/awscli-venv/bin/activate fi # Docker volumes live under $HOME/docker/ by convention DOCKER_DIR="$HOME/docker" if [ ! -d "$DOCKER_DIR" ]; then echo "[!] Docker directory $DOCKER_DIR not found — nothing to sync." exit 0 fi echo "[+] Syncing Docuseal data..." if [ -d "$DOCKER_DIR/docuseal" ]; then aws s3 sync "$DOCKER_DIR/docuseal" "s3://$BUCKET/docuseal/" \ --endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true fi echo "[+] Syncing Vaultwarden data..." if [ -d "$DOCKER_DIR/vaultwarden" ]; then aws s3 sync "$DOCKER_DIR/vaultwarden" "s3://$BUCKET/vaultwarden/" \ --endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true fi echo "[+] Syncing TwentyCRM data..." if [ -d "$DOCKER_DIR/twenty" ]; then aws s3 sync "$DOCKER_DIR/twenty" "s3://$BUCKET/twenty/" \ --endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true fi echo "[+] Syncing SearXNG data..." if [ -d "$DOCKER_DIR/searxng" ]; then aws s3 sync "$DOCKER_DIR/searxng" "s3://$BUCKET/searxng/" \ --endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true fi echo "[+] Syncing Ollama data..." if [ -d "$DOCKER_DIR/ollama" ]; then aws s3 sync "$DOCKER_DIR/ollama" "s3://$BUCKET/ollama/" \ --endpoint-url "$ENDPOINT" 2>&1 | grep -v "^$" || true fi echo "[+] Docker volume sync to $BUCKET complete." exit 0