Skip to content

Commit 6927ec0

Browse files
motxxclaude
andcommitted
feat: add CI/CD deployment for relay and Blossom on Fly.io
Deploy nostr-rs-relay and blossom-server as separate Fly apps alongside the main anchr app. CI/CD pipeline deploys infra (relay + blossom) in parallel, then deploys anchr. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4af2ad commit 6927ec0

5 files changed

Lines changed: 93 additions & 2 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: Build deploy image
3737
run: docker build -t anchr:${{ github.sha }} .
3838

39-
deploy:
40-
name: Deploy To Fly.io
39+
deploy-infra:
40+
name: Deploy ${{ matrix.app }}
4141
needs: ci
4242
runs-on: ubuntu-latest
4343
timeout-minutes: 30
@@ -47,6 +47,40 @@ jobs:
4747
(github.event_name == 'push' &&
4848
github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
4949
}}
50+
concurrency:
51+
group: fly-${{ matrix.app }}
52+
cancel-in-progress: true
53+
permissions:
54+
contents: read
55+
environment:
56+
name: production
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
include:
62+
- app: relay
63+
config: fly.relay.toml
64+
- app: blossom
65+
config: fly.blossom.toml
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
71+
- name: Setup Flyctl
72+
uses: superfly/flyctl-actions/setup-flyctl@master
73+
74+
- name: Deploy ${{ matrix.app }}
75+
run: flyctl deploy --remote-only --config ${{ matrix.config }}
76+
env:
77+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
78+
79+
deploy-app:
80+
name: Deploy Anchr App
81+
needs: deploy-infra
82+
runs-on: ubuntu-latest
83+
timeout-minutes: 30
5084
concurrency:
5185
group: fly-production
5286
cancel-in-progress: true

Dockerfile.blossom

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ghcr.io/hzrd149/blossom-server:master
2+
3+
COPY blossom-config.yml /app/config.yml
4+
5+
EXPOSE 3000

fly.blossom.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
app = "anchr-blossom"
2+
primary_region = "nrt"
3+
4+
[build]
5+
dockerfile = "Dockerfile.blossom"
6+
7+
[deploy]
8+
wait_timeout = "5m"
9+
10+
[[mounts]]
11+
source = "blossom_data"
12+
destination = "/app/data"
13+
14+
[http_service]
15+
internal_port = 3000
16+
force_https = true
17+
auto_stop_machines = "stop"
18+
auto_start_machines = true
19+
min_machines_running = 0
20+
processes = ["app"]
21+
22+
[[vm]]
23+
cpu_kind = "shared"
24+
cpus = 1
25+
memory_mb = 512

fly.relay.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
app = "anchr-relay"
2+
primary_region = "nrt"
3+
4+
[build]
5+
image = "scsibug/nostr-rs-relay:latest"
6+
7+
[deploy]
8+
wait_timeout = "5m"
9+
10+
[[mounts]]
11+
source = "relay_data"
12+
destination = "/usr/src/app/db"
13+
14+
[http_service]
15+
internal_port = 8080
16+
force_https = true
17+
auto_stop_machines = "stop"
18+
auto_start_machines = true
19+
min_machines_running = 0
20+
processes = ["app"]
21+
22+
[[vm]]
23+
cpu_kind = "shared"
24+
cpus = 1
25+
memory_mb = 512

fly.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ primary_region = "nrt"
1010
[env]
1111
REFERENCE_APP_PORT = "8080"
1212
RUNTIME_DATA_DIR = "/data"
13+
NOSTR_RELAYS = "wss://anchr-relay.fly.dev"
14+
BLOSSOM_SERVERS = "https://anchr-blossom.fly.dev"
1315

1416
[[mounts]]
1517
source = "data"

0 commit comments

Comments
 (0)