From 8ae736bbadc9559d95ee282659d61d47bd68d3b4 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Thu, 26 Mar 2026 13:55:59 +0100 Subject: [PATCH] Add safe deploy script preserving data directory --- README.md | 10 ++++++++++ scripts/deploy.sh | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 scripts/deploy.sh diff --git a/README.md b/README.md index 1c779ff..18d54c6 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,16 @@ Requirements for full functionality: - Nginx or Apache (for `/s/` short URL rewrites) - Writable `data/` directory +### Production Deploy (Safe) + +Use the provided deploy script to avoid deleting runtime files in `data/`: + +```bash +./scripts/deploy.sh +``` + +This script deploys with `rsync --delete` but explicitly excludes `data/`. + --- ## Security diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..618c4cc --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Safe deploy: never delete server-side runtime data/ files. +HOST="root@REDACTED" +TARGET="/home/REDACTED/public_html" + +rsync -avz --delete \ + --exclude '.git' \ + --exclude 'node_modules' \ + --exclude 'data/' \ + ./ "$HOST:$TARGET" + +echo "Deploy complete (data/ preserved)."