Files
fewo-stommer/scripts/backup-pull.sh
T
Lars StommerandClaude Opus 5.5 4f69b426a4 Booking path 1 (offer + guest acceptance), 2FA for all, privacy hardening, brand graphics in theme
- Offer workflow: "Angebot senden" in the admin (dates, guests, promo code, manual price adjustment,
  validity from the property's hold time, message, guest data for the contract) with live price;
  contract draft PDF; signed, versioned offer page for the guest to accept (acceptance record without
  IP) or decline; expiry job, landlord notifications, editable offer texts, wording on the website.
- 2FA is mandatory for every admin account.
- Privacy: complete anonymisation (notes, attribution, review names, offer messages), shorter
  periods for unbinding requests, portal mail excerpts and attribution (configurable proposals),
  iCal summary not stored, known e-mail no longer overwrites guest data, security headers, bearer
  tokens for automations, metadata stripped from photo originals, review link throttled.
- Daily database backup (backup:database) and scripts/backup-pull.sh for the NAS.
- Theme: brand mark in header/footer, favicon/touch icon, wave divider, icons, illustration as
  image placeholder; navy follows the text colour for dark appearances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 21:38:22 +02:00

31 lines
1.5 KiB
Bash
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 bash
#
# Fetches a fresh backup from the server to a local folder (e.g. the NAS) – nothing is changed on the server
# except creating the new database dump.
#
# scripts/backup-pull.sh <environment> <target folder>
#
# Copies: the newest database dump (backup:database) and the uploaded files (photos, contracts) from shared/storage/app.
# Uses the same settings as scripts/deploy.sh (scripts/deploy.<environment>.env).
set -euo pipefail
ENVIRONMENT="${1:?Umgebung angeben, z. B. production}"
TARGET="${2:?Zielordner angeben, z. B. /volume1/backup/fewo}"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=/dev/null
source "$ROOT/scripts/deploy.$ENVIRONMENT.env"
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY/#\~/$HOME}"
SSH=(ssh -p "${DEPLOY_PORT:-22}" -o BatchMode=yes ${DEPLOY_SSH_KEY:+-i "$DEPLOY_SSH_KEY"} "${DEPLOY_USER:+$DEPLOY_USER@}$DEPLOY_HOST")
STAMP="$(date +%Y%m%d-%H%M%S)"
mkdir -p "$TARGET/$STAMP"
echo "▶ Datenbank sichern"
"${SSH[@]}" "cd '$DEPLOY_PATH/current' && '${DEPLOY_PHP:-/opt/RZphp84/bin/php-cli}' artisan backup:database --no-interaction"
LATEST="$("${SSH[@]}" "ls -1 '$DEPLOY_PATH/shared/storage/app/private/backups/' | sort | tail -n 1")"
"${SSH[@]}" "cat '$DEPLOY_PATH/shared/storage/app/private/backups/$LATEST'" > "$TARGET/$STAMP/$LATEST"
echo "▶ Dateien sichern (Fotos, Verträge)"
"${SSH[@]}" "tar -czf - -C '$DEPLOY_PATH/shared/storage/app' --exclude='private/backups' ." > "$TARGET/$STAMP/files.tar.gz"
echo "✓ Gesichert nach $TARGET/$STAMP ($(du -sh "$TARGET/$STAMP" | cut -f1))"