Blame · Line-by-line history
DEPLOY.md
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 8ade77b | 1 | # Deploying Gluecron to Production |
| 2 | ||
| 3 | ## Prerequisites | |
| 4 | ||
| 5 | 1. A server (Hetzner, DigitalOcean, etc.) with Ubuntu 22.04+ | |
| 6 | 2. A Neon PostgreSQL database (free tier: https://neon.tech) | |
| 7 | 3. Domain pointed to the server (gluecron.com → server IP) | |
| 8 | ||
| 9 | ## Quick Deploy (one command) | |
| 10 | ||
| 11 | ```bash | |
| 12 | # 1. SSH into your server | |
| 13 | ssh root@your-server-ip | |
| 14 | ||
| 15 | # 2. Set your database URL | |
| 16 | export DATABASE_URL="postgresql://user:pass@host/gluecron?sslmode=require" | |
| 17 | ||
| 18 | # 3. Run the deploy script | |
| 19 | curl -fsSL https://raw.githubusercontent.com/ccantynz-alt/Gluecron.com/claude/ship-fixes-and-tests-Jvz1c/scripts/deploy.sh | bash | |
| 20 | ``` | |
| 21 | ||
| 22 | ## Manual Deploy | |
| 23 | ||
| 24 | ### Step 1: Database | |
| 25 | ||
| 26 | 1. Go to https://neon.tech and create a project called "gluecron" | |
| 27 | 2. Copy the connection string | |
| 28 | 3. Run the migration: | |
| 29 | ```bash | |
| 30 | psql "your-connection-string" -f drizzle/0000_init.sql | |
| 31 | ``` | |
| 32 | ||
| 33 | ### Step 2: Server Setup | |
| 34 | ||
| 35 | ```bash | |
| 36 | # Install Bun | |
| 37 | curl -fsSL https://bun.sh/install | bash | |
| 38 | ||
| 39 | # Install git | |
| 40 | apt-get update && apt-get install -y git | |
| 41 | ||
| 42 | # Clone the repo | |
| 43 | git clone --branch claude/ship-fixes-and-tests-Jvz1c \ | |
| 44 | https://github.com/ccantynz-alt/Gluecron.com.git /opt/gluecron | |
| 45 | cd /opt/gluecron | |
| 46 | ||
| 47 | # Create .env | |
| 48 | cat > .env << EOF | |
| 49 | DATABASE_URL=postgresql://user:pass@host/gluecron?sslmode=require | |
| 50 | GIT_REPOS_PATH=/data/repos | |
| 51 | PORT=3000 | |
| 52 | NODE_ENV=production | |
| 53 | GATETEST_URL=https://gatetest.ai/api/scan/run | |
| 54 | CRONTECH_DEPLOY_URL=https://crontech.ai/api/trpc/tenant.deploy | |
| 55 | EOF | |
| 56 | ||
| 57 | # Install dependencies | |
| 58 | bun install --production | |
| 59 | ||
| 60 | # Create repos directory | |
| 61 | mkdir -p /data/repos | |
| 62 | ||
| 63 | # Start the server | |
| 64 | bun run src/index.ts | |
| 65 | ``` | |
| 66 | ||
| 67 | ### Step 3: HTTPS with Nginx | |
| 68 | ||
| 69 | ```bash | |
| 70 | bash scripts/setup-nginx.sh gluecron.com | |
| 71 | ``` | |
| 72 | ||
| 73 | ### Step 4: Systemd (keep it running) | |
| 74 | ||
| 75 | ```bash | |
| 76 | # The deploy script creates this, but manually: | |
| 77 | cat > /etc/systemd/system/gluecron.service << EOF | |
| 78 | [Unit] | |
| 79 | Description=Gluecron | |
| 80 | After=network.target | |
| 81 | ||
| 82 | [Service] | |
| 83 | Type=simple | |
| 84 | WorkingDirectory=/opt/gluecron | |
| 85 | EnvironmentFile=/opt/gluecron/.env | |
| 86 | ExecStart=/root/.bun/bin/bun run src/index.ts | |
| 87 | Restart=always | |
| 88 | RestartSec=5 | |
| 89 | ||
| 90 | [Install] | |
| 91 | WantedBy=multi-user.target | |
| 92 | EOF | |
| 93 | ||
| 94 | systemctl daemon-reload | |
| 95 | systemctl enable gluecron | |
| 96 | systemctl start gluecron | |
| 97 | ``` | |
| 98 | ||
| 99 | ## Docker Deploy | |
| 100 | ||
| 101 | ```bash | |
| 102 | # Create .env file with DATABASE_URL | |
| 103 | echo "DATABASE_URL=postgresql://..." > .env | |
| 104 | ||
| 105 | # Build and run | |
| 106 | docker compose up -d | |
| 107 | ||
| 108 | # Run migration | |
| 109 | docker compose exec gluecron bun run -e "..." | |
| 110 | # Or connect directly to Neon and run drizzle/0000_init.sql | |
| 111 | ``` | |
| 112 | ||
| 113 | ## Operations | |
| 114 | ||
| 115 | ```bash | |
| 116 | # View logs | |
| 117 | journalctl -u gluecron -f | |
| 118 | ||
| 119 | # Restart | |
| 120 | systemctl restart gluecron | |
| 121 | ||
| 122 | # Update to latest | |
| 123 | cd /opt/gluecron | |
| 124 | git pull origin claude/ship-fixes-and-tests-Jvz1c | |
| 125 | bun install | |
| 126 | systemctl restart gluecron | |
| 127 | ``` | |
| 128 | ||
| 129 | ## Verification Checklist | |
| 130 | ||
| 131 | After deploy, verify: | |
| 132 | ||
| 133 | - [ ] `curl http://localhost:3000` returns the landing page | |
| 134 | - [ ] Register an account at /register | |
| 135 | - [ ] Create a repo at /new | |
| 136 | - [ ] `git clone http://gluecron.com/youruser/yourrepo.git` works | |
| 137 | - [ ] Push code and see it in the web UI | |
| 138 | - [ ] Health dashboard shows at /youruser/yourrepo/health | |
| 139 | - [ ] HTTPS works (if nginx + certbot set up) |