- Flutter app (Android/iOS): home, explore, albums, search, player with equalizer, mini player, sign up/sign in with email codes, profile, encrypted offline downloads, About page - server/: one-command deploy of self-hosted Supabase behind HestiaCP/nginx (or Caddy), migrations, backups, email templates - supabase/migrations: schema, row-level security, profiles - tools/: song scanner and importer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
886 B
Bash
26 lines
886 B
Bash
#!/bin/sh
|
|
# Nightly backup: database dump + uploaded files (songs, covers, photos). Keeps 14 days.
|
|
# Copy the backups folder off the server too (another machine, or cloud storage).
|
|
#
|
|
# Cron (as the user that runs docker):
|
|
# 30 2 * * * sh /path/to/server/backup.sh >> $HOME/nk-backups/backup.log 2>&1
|
|
set -eu
|
|
|
|
PROJECT="${1:-$HOME/nk-backend/supabase-project}"
|
|
DEST="${2:-$HOME/nk-backups}"
|
|
STAMP="$(date +%Y%m%d-%H%M)"
|
|
mkdir -p "$DEST"
|
|
cd "$PROJECT"
|
|
|
|
PGPASSWORD="$(grep -E '^POSTGRES_PASSWORD=' .env | cut -d= -f2-)"
|
|
|
|
docker compose exec -T -e PGPASSWORD="$PGPASSWORD" db \
|
|
pg_dump -h localhost -U postgres -d postgres -Fc > "$DEST/db-$STAMP.dump"
|
|
|
|
tar -czf "$DEST/storage-$STAMP.tar.gz" -C volumes storage
|
|
|
|
find "$DEST" -name 'db-*.dump' -mtime +14 -delete
|
|
find "$DEST" -name 'storage-*.tar.gz' -mtime +14 -delete
|
|
|
|
echo "$(date -Is) backup ok: db-$STAMP.dump storage-$STAMP.tar.gz"
|