Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
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.

auto-update.shBlame45 lines · 2 contributors
f635e2fClaude1#!/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.
8set -euo pipefail
9
10REPO_DIR="/opt/gluecron"
9de2807Claude11BRANCH="main"
f635e2fClaude12COMPOSE="docker compose -f docker-compose.standalone.yml"
13
14cd "$REPO_DIR"
15git fetch origin "$BRANCH" --quiet
16
17local_sha=$(git rev-parse HEAD)
18remote_sha=$(git rev-parse "origin/$BRANCH")
19[ "$local_sha" = "$remote_sha" ] && exit 0
20
21echo "$(date -Is) deploying $local_sha -> $remote_sha"
22git reset --hard "origin/$BRANCH" # untracked .env / backups are preserved
23
24$COMPOSE up -d --build
25sleep 5
5bac517ccanty labs26
27# Co-tenant ingress reattach (Coolify boxes only).
28# `docker compose up --build` recreates the gluecron container, which DROPS
29# any network attachment not declared in docker-compose.standalone.yml. On
30# this box the public ingress is Coolify's Traefik ("coolify-proxy"), which
31# reaches the app over the external "coolify" network via the file route
32# /traefik/dynamic/gluecron.yaml in the coolify-proxy container. Without this
33# reattach, every deploy 502s the site until someone reconnects by hand.
34# Idempotent: a no-op if already attached; harmless no-op on a dedicated VPS
35# that has no "coolify" network (errors are swallowed).
36if docker network inspect coolify >/dev/null 2>&1; then
37 docker network connect coolify gluecron-gluecron-1 2>/dev/null \
38 && echo "$(date -Is) reattached gluecron to coolify network" \
39 || echo "$(date -Is) coolify network already attached (ok)"
40fi
41
f635e2fClaude42$COMPOSE exec -T gluecron bun run db:migrate || true
43docker image prune -f >/dev/null 2>&1 || true
44
45echo "$(date -Is) deploy complete: $remote_sha"