Files
backend/scripts/websites-agent/deploy.sh
T
Alireza HassaniandCursor d933aef40b Enable storefront provision from Add Domain via optional git URL.
Persist deploy_slug on domains, call the websites agent /provision endpoint, and drop the hard-coded host map so Deploy appears from the UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 14:07:56 +03:30

28 lines
602 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SLUG="${1:-}"
if [[ -z "$SLUG" ]]; then
echo "usage: deploy.sh <slug>" >&2
exit 1
fi
ROOT="/var/www/sites/$SLUG"
LOG="/var/log/websites/deploy-$SLUG.log"
exec >>"$LOG" 2>&1
echo "==== $(date -u +%Y-%m-%dT%H:%M:%SZ) deploy start: $SLUG ===="
if [[ ! -d "$ROOT/.git" ]]; then
echo "missing site: $ROOT"
exit 1
fi
cd "$ROOT"
git fetch origin
git reset --hard origin/main
npm ci
npm run build
pm2 restart "$SLUG" --update-env || pm2 start /var/www/sites/ecosystem.config.cjs --only "$SLUG"
echo "==== $(date -u +%Y-%m-%dT%H:%M:%SZ) deploy ok: $SLUG ===="