summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-16 08:53:44 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-16 08:53:44 +0000
commit7d627d16cd4bb88e625291dff4cc886c68dbf785 (patch)
tree2cc1b6c4a338a202aaf46083b65254bc62f031e0 /scripts
parent2be0b6a90cd83c8052ee13a172217e4a355c7df7 (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')
-rwxr-xr-xscripts/bugs3
-rwxr-xr-xscripts/deploy44
-rwxr-xr-xscripts/logs2
-rwxr-xr-xscripts/resolve-bug4
4 files changed, 48 insertions, 5 deletions
diff --git a/scripts/bugs b/scripts/bugs
index 4f3c064..824e67a 100755
--- a/scripts/bugs
+++ b/scripts/bugs
@@ -1,4 +1,3 @@
#!/bin/bash
# List all bugs from the production database
-
-ssh titanium "sqlite3 -column -header /site/doot.terst.org/data/dashboard.db 'SELECT id, description, created_at FROM bugs ORDER BY id'"
+sqlite3 -column -header /site/doot.terst.org/data/dashboard.db 'SELECT id, description, created_at FROM bugs ORDER BY id'
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!"
diff --git a/scripts/logs b/scripts/logs
index 7cec0c6..0259939 100755
--- a/scripts/logs
+++ b/scripts/logs
@@ -8,4 +8,4 @@
# scripts/logs --since "1 hour ago"
# scripts/logs --grep "error"
-ssh titanium journalctl -u task-dashboard@doot.terst.org --no-pager "$@"
+journalctl -u task-dashboard@doot.terst.org --no-pager "$@"
diff --git a/scripts/resolve-bug b/scripts/resolve-bug
index a3f0979..1fcf5df 100755
--- a/scripts/resolve-bug
+++ b/scripts/resolve-bug
@@ -10,10 +10,10 @@ BUG_ID="$1"
# Show the bug being resolved
echo "Resolving bug #$BUG_ID:"
-ssh titanium "sqlite3 -column /site/doot.terst.org/data/dashboard.db \"SELECT description FROM bugs WHERE id = $BUG_ID\""
+sqlite3 -column /site/doot.terst.org/data/dashboard.db "SELECT description FROM bugs WHERE id = $BUG_ID"
# Delete the bug
-ssh titanium "sqlite3 /site/doot.terst.org/data/dashboard.db \"DELETE FROM bugs WHERE id = $BUG_ID\""
+sqlite3 /site/doot.terst.org/data/dashboard.db "DELETE FROM bugs WHERE id = $BUG_ID"
if [ $? -eq 0 ]; then
echo "Bug #$BUG_ID resolved."