Generalize email system with invoice workflow and Stiftungsgeschichte category

- Rename DestinataerEmailEingang → EmailEingang with category support
  (destinataer, rechnung, land_pacht, stiftungsgeschichte, allgemein)
- Add invoice capture workflow: create Verwaltungskosten from email,
  link DMS documents as invoice attachments, track payment status
- Add Stiftungsgeschichte email category with auto-detection patterns
  (Ahnenforschung, Genealogie, Chronik, etc.) and DMS integration
- Update poll_emails task with category detection and DMS context mapping
- Show available history documents in Geschichte editor sidebar
- Consolidate DMS views, remove legacy dokument templates
- Update all detail/form templates for DMS document linking
- Add deploy.sh script and streamline compose.yml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
SysAdmin Agent
2026-03-12 10:17:14 +00:00
parent f4fc512ad3
commit e6f4c5ba1b
44 changed files with 1076 additions and 3428 deletions

103
deploy.sh Executable file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
# deploy.sh — Deploy main branch to production (vhtv-stiftung.de)
#
# Usage:
# ./deploy.sh # Deploy current main to production
# ./deploy.sh --dry-run # Show what would happen without deploying
#
# Prerequisites:
# - SSH access to the production server (key-based auth)
# - Production .env file at /opt/stiftung/.env on the server
# - Git remote 'origin' configured on the server pointing to Gitea
set -euo pipefail
SERVER="${DEPLOY_SERVER:-remmer@vhtv-stiftung.de}"
PROD_DIR="${DEPLOY_DIR:-/opt/stiftung}"
COMPOSE_FILE="compose.yml"
DRY_RUN=false
if [[ "${1:-}" == "--dry-run" ]]; then
DRY_RUN=true
echo "=== DRY RUN — no changes will be made ==="
fi
echo "=== Stiftung Production Deployment ==="
echo "Server: $SERVER"
echo "Path: $PROD_DIR"
echo "Compose: $COMPOSE_FILE"
echo ""
# Verify local main is up to date with remote
LOCAL_MAIN=$(git rev-parse main 2>/dev/null || echo "unknown")
echo "Local main: $LOCAL_MAIN"
if [[ "$DRY_RUN" == true ]]; then
echo ""
echo "Would SSH to $SERVER and:"
echo " 1. git fetch origin main && git reset --hard origin/main"
echo " 2. docker compose down"
echo " 3. docker compose up -d --build"
echo " 4. Run migrations and collectstatic"
echo ""
echo "=== Dry run complete ==="
exit 0
fi
echo ""
read -p "Deploy main ($LOCAL_MAIN) to production? [y/N] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
echo ""
echo "=== Deploying to $SERVER:$PROD_DIR ==="
ssh "$SERVER" bash -s "$PROD_DIR" "$COMPOSE_FILE" << 'DEPLOY_SCRIPT'
set -euo pipefail
PROD_DIR="$1"
COMPOSE_FILE="$2"
cd "$PROD_DIR"
echo "--- Fetching latest main ---"
git fetch origin main
git checkout main
git reset --hard origin/main
echo ""
echo "--- Pulling standard images ---"
docker compose -f "$COMPOSE_FILE" pull db redis grampsweb || echo "Some pulls failed, using cached"
echo ""
echo "--- Stopping containers ---"
docker compose -f "$COMPOSE_FILE" down
echo ""
echo "--- Building and starting ---"
docker compose -f "$COMPOSE_FILE" up -d --build
echo ""
echo "--- Waiting for services to start ---"
sleep 20
echo ""
echo "--- Running migrations ---"
docker compose -f "$COMPOSE_FILE" exec -T web python manage.py migrate
echo ""
echo "--- Collecting static files ---"
docker compose -f "$COMPOSE_FILE" exec -T web python manage.py collectstatic --noinput
echo ""
echo "--- Service status ---"
docker compose -f "$COMPOSE_FILE" ps
echo ""
echo "=== Deployment complete ==="
DEPLOY_SCRIPT
echo ""
echo "=== Done! Production updated to main ($LOCAL_MAIN) ==="
echo "Site: https://vhtv-stiftung.de"