Accept account creates without destination_email (defaults to BizDocs inbox) and force admin-ui rebuild on deploy so web container picks up UI changes.
47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# BizDocs Forwarder — pull from Gitea + docker compose rebuild (CT 243 / /opt/forwarder).
|
|
# Invoked by deploy-hook webhook or manually after SSH setup.
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="${FORWARDER_REPO_DIR:-/opt/forwarder}"
|
|
DEPLOY_BRANCH="${DEPLOY_BRANCH:-main}"
|
|
COMPOSE="docker compose"
|
|
|
|
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [forwarder-deploy] $*"; }
|
|
|
|
if [ ! -d "$REPO_DIR/.git" ]; then
|
|
log "FATAL: git repo missing at $REPO_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$REPO_DIR"
|
|
|
|
log "Fetching origin/$DEPLOY_BRANCH"
|
|
git fetch origin "$DEPLOY_BRANCH"
|
|
git reset --hard "origin/$DEPLOY_BRANCH"
|
|
log "HEAD $(git rev-parse --short HEAD) — $(git log -1 --format=%s)"
|
|
|
|
if [ ! -f .env ] && [ -f /etc/forwarder/forwarder.env ]; then
|
|
log "Linking .env from /etc/forwarder/forwarder.env"
|
|
ln -sf /etc/forwarder/forwarder.env .env
|
|
fi
|
|
|
|
if [ ! -f .env ]; then
|
|
log "FATAL: .env missing (copy .env.example or /etc/forwarder/forwarder.env)"
|
|
exit 1
|
|
fi
|
|
|
|
log "Building containers (web forced rebuild for admin-ui)"
|
|
$COMPOSE build api worker deploy-hook
|
|
$COMPOSE build --no-cache web
|
|
|
|
log "Running migrations"
|
|
$COMPOSE run --rm migrate
|
|
|
|
log "Starting stack"
|
|
$COMPOSE up -d --force-recreate api web worker deploy-hook
|
|
|
|
log "Health check"
|
|
curl -sf --max-time 10 http://127.0.0.1:8000/api/health >/dev/null
|
|
log "Deploy OK"
|