CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
auto-update.sh
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| f635e2f | 1 | #!/usr/bin/env bash |
| 2 | # | |
| 3 | # Fast auto-deploy for the standalone box. Installed as a ~60s systemd timer by | |
| 4 | # scripts/standalone-deploy.sh. Polls the deploy branch; when new commits land, | |
| 5 | # it pulls, rebuilds, and runs migrations. Push -> live in ~1-2 min, hands-off. | |
| 6 | # | |
| 7 | # Exits immediately (cheap) when there is nothing new, so a tight interval is fine. | |
| 8 | set -euo pipefail | |
| 9 | ||
| 10 | REPO_DIR="/opt/gluecron" | |
| 9de2807 | 11 | BRANCH="main" |
| f635e2f | 12 | COMPOSE="docker compose -f docker-compose.standalone.yml" |
| 13 | ||
| 14 | cd "$REPO_DIR" | |
| 15 | git fetch origin "$BRANCH" --quiet | |
| 16 | ||
| 17 | local_sha=$(git rev-parse HEAD) | |
| 18 | remote_sha=$(git rev-parse "origin/$BRANCH") | |
| 19 | [ "$local_sha" = "$remote_sha" ] && exit 0 | |
| 20 | ||
| 21 | echo "$(date -Is) deploying $local_sha -> $remote_sha" | |
| 22 | git reset --hard "origin/$BRANCH" # untracked .env / backups are preserved | |
| 23 | ||
| 24 | $COMPOSE up -d --build | |
| 25 | sleep 5 | |
| 26 | $COMPOSE exec -T gluecron bun run db:migrate || true | |
| 27 | docker image prune -f >/dev/null 2>&1 || true | |
| 28 | ||
| 29 | echo "$(date -Is) deploy complete: $remote_sha" |