debugging eingebaut, deploy gefixt
All checks were successful
Deploy SingleChat / deploy (push) Successful in 25s

This commit is contained in:
Torsten Schulz (local)
2026-06-17 16:37:40 +02:00
parent c46e64367d
commit 0d24fcd9e5
7 changed files with 187 additions and 26 deletions

View File

@@ -13,6 +13,8 @@ DEPLOY_GROUP="${DEPLOY_GROUP:-$(id -gn "$DEPLOY_USER")}"
LOCK_DIR="${LOCK_DIR:-/tmp/actualize-singlechat}"
LOCK_FILE="${LOCK_FILE:-$LOCK_DIR/deploy.lock}"
NPM_CACHE_DIR="${NPM_CACHE_DIR:-$APP_DIR/.npm-cache}"
ENV_TEMPLATE="${ENV_TEMPLATE:-$APP_DIR/.env.example}"
ENV_MERGE_SCRIPT="${ENV_MERGE_SCRIPT:-$APP_DIR/scripts/merge-env-template.sh}"
log() {
printf '[%s] %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$*"
@@ -128,16 +130,19 @@ run_as_deploy_user npm ci
log "Installiere Client-Dependencies"
run_as_deploy_user npm --prefix client ci
if [ ! -f "$APP_DIR/.env" ]; then
log "Erstelle .env"
session_secret="$(openssl rand -hex 32)"
cat > "$APP_DIR/.env" <<EOF
NODE_ENV=production
PORT=4000
SESSION_SECRET=$session_secret
EOF
if [ ! -f "$ENV_TEMPLATE" ]; then
echo "FEHLER: Env-Vorlage fehlt: $ENV_TEMPLATE" >&2
exit 1
fi
if [ ! -x "$ENV_MERGE_SCRIPT" ]; then
chmod +x "$ENV_MERGE_SCRIPT"
fi
log "Synchronisiere .env mit Vorlage"
session_secret="$(openssl rand -hex 32)"
"$ENV_MERGE_SCRIPT" "$ENV_TEMPLATE" "$APP_DIR/.env" "$session_secret"
if [ "$(id -u)" -eq 0 ]; then
chown "$RUN_USER:$RUN_GROUP" "$APP_DIR/.env"
fi