diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-16 08:53:44 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-16 08:53:44 +0000 |
| commit | 7d627d16cd4bb88e625291dff4cc886c68dbf785 (patch) | |
| tree | 2cc1b6c4a338a202aaf46083b65254bc62f031e0 /scripts/deploy | |
| parent | 2be0b6a90cd83c8052ee13a172217e4a355c7df7 (diff) | |
chore: migrate deploy + ops scripts from SSH to local execution
Replace SSH-based deploy.sh with scripts/deploy that runs locally on the
server. Update scripts/bugs, scripts/logs, and scripts/resolve-bug to drop
SSH wrappers. Update CLAUDE.md and DESIGN.md to reflect new local workflow.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts/deploy')
| -rwxr-xr-x | scripts/deploy | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/deploy b/scripts/deploy new file mode 100755 index 0000000..e6746d8 --- /dev/null +++ b/scripts/deploy @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +# Configuration +FQDN="doot.terst.org" +SITE_DIR="/site/${FQDN}" +SERVICE="task-dashboard@${FQDN}" + +echo "==> Building CSS..." +npm run css:build + +echo "==> Building binary..." +BUILD_COMMIT=$(git rev-parse --short HEAD) +BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ') +LDFLAGS="-X main.buildCommit=${BUILD_COMMIT} -X main.buildTime=${BUILD_TIME}" +go build -ldflags "$LDFLAGS" -o app cmd/dashboard/main.go + +echo "==> Stopping service..." +systemctl stop ${SERVICE} || true + +echo "==> Syncing assets and migrations to ${SITE_DIR}..." +# Sync static files +rsync -av --delete web/static/ ${SITE_DIR}/public/ +# Sync templates +rsync -av --delete web/templates/ ${SITE_DIR}/templates/ +# Sync migrations +rsync -av --delete migrations/ ${SITE_DIR}/migrations/ + +echo "==> Swapping binary..." +mv app ${SITE_DIR}/app + +echo "==> Setting permissions..." +chown -R www-data:www-data ${SITE_DIR} +find ${SITE_DIR} -type d -exec chmod 755 {} \; +find ${SITE_DIR} -type f -exec chmod 644 {} \; +chmod +x ${SITE_DIR}/app +chmod 600 ${SITE_DIR}/.env 2>/dev/null || true + +echo "==> Starting service..." +systemctl start ${SERVICE} +sleep 1 +systemctl status ${SERVICE} --no-pager -l + +echo "==> Deploy complete!" |
