Skip to content

Commit 6fab9c0

Browse files
committed
ci(deploy): switch deploy pipeline back to Fly.io
- restore fly.toml with absolute (four-slash) SQLite DATABASE_URL - self-healing workflow: creates app and volume if missing - deploy with --remote-only --ha=false (single machine, one volume)
1 parent 8b93cfb commit 6fab9c0

2 files changed

Lines changed: 62 additions & 13 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,46 @@ name: Deploy
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
67

7-
jobs:
8-
test:
9-
uses: ./.github/workflows/ci.yml
8+
concurrency:
9+
group: fly-deploy
10+
cancel-in-progress: false
1011

12+
jobs:
1113
deploy:
12-
needs: test
1314
runs-on: ubuntu-latest
1415
steps:
15-
- name: Trigger Render deploy
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Flyctl
19+
uses: superfly/flyctl-actions/setup-flyctl@master
20+
21+
- name: Check FLY_API_TOKEN
1622
env:
17-
RENDER_DEPLOY_HOOK_URL: ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
23+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
1824
run: |
19-
if [ -z "$RENDER_DEPLOY_HOOK_URL" ]; then
20-
echo "::error::RENDER_DEPLOY_HOOK_URL secret is not set." \
21-
"Add it under repo Settings > Secrets and variables > Actions" \
22-
"(get the URL from the Render service > Settings > Deploy Hook)."
25+
if [ -z "$FLY_API_TOKEN" ]; then
26+
echo "::error::FLY_API_TOKEN secret is not set." \
27+
"Create a token with 'fly tokens create deploy' (or from the Fly.io dashboard)" \
28+
"and add it under repo Settings > Secrets and variables > Actions."
2329
exit 1
2430
fi
25-
echo "CI passed; triggering Render deploy..."
26-
curl -fsS -X POST "$RENDER_DEPLOY_HOOK_URL"
27-
echo "Render deploy triggered."
31+
32+
- name: Ensure app and volume exist
33+
env:
34+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
35+
run: |
36+
flyctl apps create climatevision-green || echo "App already exists (or create skipped)."
37+
flyctl volumes create climatevision_data --app climatevision-green \
38+
--region lhr --size 1 --yes || echo "Volume already exists (or create skipped)."
39+
40+
- name: Deploy to Fly.io
41+
env:
42+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
43+
run: fly deploy --remote-only --ha=false
44+
45+
- name: Show status
46+
env:
47+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
48+
run: flyctl status --app climatevision-green

fly.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
app = 'climatevision-green'
2+
primary_region = 'lhr'
3+
4+
[build]
5+
6+
[http_service]
7+
internal_port = 8000
8+
force_https = true
9+
auto_stop_machines = 'off'
10+
auto_start_machines = true
11+
min_machines_running = 1
12+
processes = ['app']
13+
14+
[[mounts]]
15+
source = 'climatevision_data'
16+
destination = '/app/outputs'
17+
18+
[[vm]]
19+
memory = '2gb'
20+
cpu_kind = 'shared'
21+
cpus = 2
22+
23+
[env]
24+
PYTHONUNBUFFERED = '1'
25+
OMP_NUM_THREADS = '1'
26+
# Four slashes = absolute path (/app/outputs/...). Three slashes would be
27+
# parsed as a relative path and cause "unable to open database file".
28+
DATABASE_URL = 'sqlite:////app/outputs/climatevision.sqlite3'

0 commit comments

Comments
 (0)