Full review of what belongs in the public installer vs. what customers should never need to see, per an explicit audit request: - Removed DB_USER/DB_NAME as customer-configurable env vars entirely -- nothing outside this compose stack ever connects to Postgres directly, so there was no real reason a customer would ever change these. Hardcoded to postgres/argus in docker-compose.yml and the two scripts that referenced them (backup.sh, restore.sh); DB_PASSWORD remains the one real secret, still auto-generated by install.sh. - Removed ANIS_ADMIN_KEY entirely -- confirmed dead in a prior session's audit: it's ANIS's own admin-dashboard credential, unrelated to the ARGUS<->ANIS intelligence protocol, which ARGUS never sends. Carried over into this file by copy-paste from ANIS's own env template, not because ARGUS ever uses it. - Reordered/re-commented env.example around what a customer actually might touch (timezone, ANIS bootstrap trio, network ports for conflict resolution, DOCKER_API_VERSION for NAS platforms) versus what's fully automated (DB_PASSWORD) -- with an explicit note that ongoing product configuration (WAF, DNS, users, policies) happens in the dashboard, not this file. - ANIS_ENABLED/ANIS_URL defaults aligned with the Community Edition auto-provisioning decision (true / https://anis.weboria.eu) -- previously still showed the pre-decision false/empty defaults since this repo's initial population predated that change landing. - Flagged CHANGELOG.md as stale (last entry v3.29.0, well behind the current shipped version) with an honest note rather than silently leaving a misleading "GitHub Releases page" pointer or backfilling invented descriptions of past releases. No file needed to move to the private repo -- everything here (install/ update/backup/restore/healthcheck/uninstall scripts, the compose manifest, license/notice docs) is either required for the customer to install and operate ARGUS or a legal-transparency requirement. None of it is build logic, dev configuration, or reproducible source.
54 lines
2.0 KiB
Bash
Executable File
54 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# ARGUS restore — loads a backup created by backup.sh into a FRESH ARGUS
|
|
# installation (empty database, no prior data). To restore onto a machine
|
|
# that already has data on it, uninstall.sh --remove-data && install.sh
|
|
# first, then run this.
|
|
#
|
|
# cd ~/argus && ./restore.sh argus-backup-20260719-120000.tar.gz
|
|
#
|
|
set -euo pipefail
|
|
|
|
INSTALL_DIR="${ARGUS_INSTALL_DIR:-$HOME/argus}"
|
|
ARCHIVE="${1:-}"
|
|
|
|
bold() { printf '\033[1m%s\033[0m\n' "$1"; }
|
|
info() { printf ' %s\n' "$1"; }
|
|
ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; }
|
|
warn() { printf ' \033[33m!\033[0m %s\n' "$1"; }
|
|
fail() { printf ' \033[31m✗\033[0m %s\n' "$1" >&2; exit 1; }
|
|
|
|
[ -n "$ARCHIVE" ] || fail "Usage: ./restore.sh <path-to-backup.tar.gz>"
|
|
[ -f "$ARCHIVE" ] || fail "No such file: $ARCHIVE"
|
|
[ -f "$INSTALL_DIR/docker-compose.yml" ] || fail "No ARGUS installation found at $INSTALL_DIR (set ARGUS_INSTALL_DIR if you installed elsewhere)."
|
|
cd "$INSTALL_DIR"
|
|
|
|
warn "This assumes a freshly installed, empty ARGUS instance."
|
|
warn "Restoring onto an instance that already has data will fail or corrupt it."
|
|
printf " Type YES to continue: "
|
|
read -r CONFIRM
|
|
[ "$CONFIRM" = "YES" ] || fail "Aborted."
|
|
|
|
WORKDIR="$(mktemp -d)"
|
|
trap 'rm -rf "$WORKDIR"' EXIT
|
|
tar xzf "$ARCHIVE" -C "$WORKDIR"
|
|
[ -f "$WORKDIR/db.sql.gz" ] && [ -f "$WORKDIR/api-data.tar.gz" ] || fail "Not a valid ARGUS backup archive (missing db.sql.gz / api-data.tar.gz)."
|
|
|
|
bold "Stopping the API (keeping the database up)..."
|
|
docker compose stop api ui nginx >/dev/null
|
|
|
|
bold "Restoring database..."
|
|
gunzip -c "$WORKDIR/db.sql.gz" | docker compose exec -T db psql -U postgres argus >/dev/null
|
|
ok "Database restored"
|
|
|
|
bold "Restoring application data..."
|
|
docker run --rm -v argus_api_data:/data -v "$WORKDIR":/backup alpine \
|
|
sh -c "rm -rf /data/* && tar xzf /backup/api-data.tar.gz -C /data" >/dev/null 2>&1
|
|
ok "Application data restored"
|
|
|
|
bold "Starting ARGUS..."
|
|
docker compose up -d
|
|
echo
|
|
ok "Restore complete"
|
|
info "Give it a minute to finish starting, then check: ./healthcheck.sh"
|