feat: add rsync deploy script with documentation

This commit is contained in:
2026-02-07 17:55:12 +01:00
parent 39ab822fd2
commit a5995857e8
2 changed files with 67 additions and 1 deletions

View File

@@ -114,7 +114,24 @@ Für Produktion werden nur diese Dateien benötigt:
└── assets/
```
**Nicht deployen:** `tests/`, `docs/`, `AGENTS.md`, `README.md`, `.git/`
**Nicht deployen:** `tests/`, `docs/`, `AGENTS.md`, `README.md`, `.git/`, `deploy.sh`
#### Deploy via Script
```bash
# Einmalig: SSH-User und Pfad anpassen
./deploy.sh user@dgray.io /home/user/web/dgray.io/public_html
# Oder Defaults im Script setzen und einfach:
./deploy.sh
```
Das Script nutzt `rsync` über SSH und synchronisiert nur geänderte Dateien.
Ausgeschlossene Dateien/Ordner (tests, docs, .git, etc.) werden automatisch übersprungen.
**Voraussetzungen:**
- SSH-Key-Authentifizierung zum Server
- `rsync` lokal und auf dem Server installiert
### Tests ausführen

49
deploy.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# deploy.sh - Deploy dgray.io to production server via rsync
#
# Usage: ./deploy.sh [user@host] [remote-path]
# Example: ./deploy.sh admin@dgray.io /home/admin/web/dgray.io/public_html
#
# Prerequisites:
# - SSH key authentication configured
# - rsync installed locally and on server
set -e
# --- Configuration ---
REMOTE_USER_HOST="${1:-admin@dgray.io}"
REMOTE_PATH="${2:-/home/admin/web/dgray.io/public_html}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# Files/directories to exclude from deployment
EXCLUDES=(
".git"
".gitignore"
"AGENTS.md"
"deploy.sh"
"docs/"
"tests/"
"README.md"
".vscode"
".idea"
)
# --- Build exclude arguments ---
EXCLUDE_ARGS=""
for item in "${EXCLUDES[@]}"; do
EXCLUDE_ARGS="$EXCLUDE_ARGS --exclude=$item"
done
# --- Deploy ---
echo "Deploying dgray.io"
echo " From: $SCRIPT_DIR"
echo " To: $REMOTE_USER_HOST:$REMOTE_PATH"
echo ""
rsync -avz --delete \
$EXCLUDE_ARGS \
"$SCRIPT_DIR/" \
"$REMOTE_USER_HOST:$REMOTE_PATH/"
echo ""
echo "Deploy complete."