-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·41 lines (34 loc) · 1.21 KB
/
deploy.sh
File metadata and controls
executable file
·41 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -euo pipefail
# deploy.sh — One-command deploy to Fly.io
#
# Prerequisites:
# brew install flyctl
# fly auth login
#
# First-time setup (run once):
# fly launch --copy-config --no-deploy --name instant-lite-api --region iad
# fly postgres create --name instant-lite-db --region iad --vm-size shared-cpu-1x
# fly redis create --name instant-lite-redis --region iad --plan free
# fly postgres attach instant-lite-db -a instant-lite-api
# fly redis attach instant-lite-redis -a instant-lite-api
# fly secrets set BASE_URL=https://api.instant.dev
#
# After first-time setup, just run:
# ./deploy.sh
echo "==> Building and deploying instant-lite-api to Fly.io..."
# Run schema migration against Fly Postgres
echo "==> Running schema migration..."
fly ssh console -a instant-lite-api -C "psql \$DATABASE_URL -f /app/schema.sql" 2>/dev/null || {
echo " (migration skipped — run manually if first deploy)"
}
# Deploy
fly deploy
echo ""
echo "==> Deployed! Verifying health..."
sleep 3
HEALTH=$(curl -sf https://api.instant.dev/healthz 2>/dev/null || echo '{"ok":false}')
echo " $HEALTH"
echo ""
echo "==> Test provisioning:"
echo ' curl -s -X POST https://api.instant.dev/db/new | jq'