titan-iac/scripts/gitea_recovery.fish
2025-08-07 09:17:49 -05:00

23 lines
770 B
Fish
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.

#!/usr/bin/env fish
# run from your workstation
set jump titan-db # alias from ~/.ssh/config (192.168.22.10:2277)
# grab host list from titan-dbs ~/.ssh/config
set nodes (ssh $jump 'grep -E "^Host titan-" ~/.ssh/config | awk "{print \$2}"')
for n in $nodes
echo "=== $n ==="
# list volumes
ssh $jump "ssh $n 'ls /dev/longhorn'" 2>/dev/null
# look for app.ini or repos inside each volume
set vols (ssh $jump "ssh $n 'ls /dev/longhorn'" 2>/dev/null)
for v in $vols
ssh $jump "ssh $n 'test -e /dev/longhorn/$v && sudo mount -o ro /dev/longhorn/$v /mnt && \
(ls /mnt/gitea/conf/app.ini 2>/dev/null || true) && \
(ls /mnt/git/repositories 2>/dev/null || true); sudo umount /mnt'" 2>/dev/null
end
end