Add an Unraid installer for a self-hosted Fluxer instance.
The official compose bundle stores uploads in Docker volumes and expects a proxy on loopback, which does not fit Unraid docker.img or a containerized reverse proxy.
This commit is contained in:
commit
1f6c4c0c39
9 files changed
+881
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# Dump Postgres and tar the bind-mounted data. Fluxer is stopped while the
|
||||
# files are copied, then started again. The backup contains stack/.env.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
STACK="${FLUXER_STACK:-$ROOT/stack}"
|
||||
APPDATA="${FLUXER_APPDATA:-/mnt/user/appdata/fluxer}"
|
||||
|
||||
if [[ -f "$STACK/.env" ]]; then
|
||||
from_env="$(awk -F= '$1=="FLUXER_APPDATA" { print substr($0, index($0, "=") + 1); exit }' "$STACK/.env")"
|
||||
if [[ -n "$from_env" ]]; then
|
||||
APPDATA="$from_env"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f "$STACK/docker-compose.yml" ]]; then
|
||||
echo "No stack at $STACK. Run scripts/prepare-unraid.sh first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
DEST="${1:-$ROOT/backups/$STAMP}"
|
||||
mkdir -p "$DEST"
|
||||
|
||||
started=0
|
||||
bring_back() {
|
||||
if [[ "$started" -eq 1 ]]; then
|
||||
docker compose --project-directory "$STACK" up -d || true
|
||||
fi
|
||||
}
|
||||
trap bring_back EXIT
|
||||
|
||||
echo "Writing database dump to $DEST/fluxer.dump"
|
||||
docker compose --project-directory "$STACK" exec -T postgres \
|
||||
sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --format=custom' \
|
||||
> "$DEST/fluxer.dump"
|
||||
|
||||
echo "Stopping Fluxer to copy data files"
|
||||
docker compose --project-directory "$STACK" stop
|
||||
started=1
|
||||
|
||||
tar -C "$APPDATA" -czf "$DEST/appdata.tar.gz" \
|
||||
edge-data edge-config postgres valkey nats meilisearch seaweedfs media-proxy-tmp
|
||||
|
||||
cp "$STACK/.env" "$DEST/env"
|
||||
chmod 600 "$DEST/env"
|
||||
|
||||
echo "Starting Fluxer again"
|
||||
docker compose --project-directory "$STACK" up -d
|
||||
started=0
|
||||
|
||||
echo "Backup is in $DEST"
|
||||
echo "Copy that folder off this server. It contains the database, uploads, and secrets."
|
||||
Reference in new issue
Block a user