mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-11 22:30:59 +04:30
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>
28 lines
602 B
Bash
Executable File
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 ===="
|