Skip to content

Commit 429d66e

Browse files
committed
Add prod fly tomls
1 parent 7ce5806 commit 429d66e

File tree

8 files changed

+190
-10
lines changed

8 files changed

+190
-10
lines changed

.github/workflows/deploy.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,68 @@ name: Deploy to Fly.io
33
on:
44
push:
55
branches:
6-
- azlyth/fly
7-
# - main
6+
- main
7+
- stable
88

99
jobs:
10-
deploy:
11-
name: Deploy apps
10+
deploy_staging:
11+
name: Deploy apps to Staging
12+
if: github.ref == 'refs/heads/main'
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v4
1516

1617
- name: Setup Flyctl
1718
uses: superfly/flyctl-actions/setup-flyctl@master
1819

20+
# Deploy Database (Pocketbase)
1921
- name: Deploy Database
2022
working-directory: db
2123
env:
2224
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
23-
run: flyctl deploy --remote-only
25+
run: flyctl deploy --remote-only
2426

27+
# Deploy Backend
2528
- name: Deploy Backend
2629
working-directory: python-backend
2730
env:
2831
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
29-
run: |
30-
flyctl deploy --remote-only
32+
run: flyctl deploy --remote-only
3133

34+
# Deploy Frontend
3235
- name: Deploy Frontend
3336
working-directory: frontend
3437
env:
3538
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
36-
run: flyctl deploy --remote-only
39+
run: flyctl deploy --remote-only
40+
41+
deploy_production:
42+
name: Deploy apps to Production
43+
if: github.ref == 'refs/heads/stable'
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Setup Flyctl
49+
uses: superfly/flyctl-actions/setup-flyctl@master
50+
51+
# Deploy Database (Pocketbase)
52+
- name: Deploy Database
53+
working-directory: db
54+
env:
55+
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
56+
run: flyctl deploy --config fly.prod.toml --remote-only
57+
58+
# Deploy Backend
59+
- name: Deploy Backend
60+
working-directory: python-backend
61+
env:
62+
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
63+
run: flyctl deploy --config fly.prod.toml --remote-only
64+
65+
# Deploy Frontend
66+
- name: Deploy Frontend
67+
working-directory: frontend
68+
env:
69+
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }}
70+
run: flyctl deploy --config fly.prod.toml --remote-only

Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,24 @@ deploy-pocketbase:
2121
cd db && fly deploy
2222

2323
deploy-meilisearch:
24-
cd search/meilisearch && fly deploy
24+
cd meilisearch && fly deploy
2525

2626
deploy-search:
27-
cd search && fly deploy
27+
cd search && fly deploy
28+
29+
deploy-frontend-prod:
30+
cd frontend && fly deploy --config fly.prod.toml
31+
32+
deploy-backend-prod:
33+
cd python-backend && fly deploy --config fly.prod.toml
34+
35+
deploy-pocketbase-prod:
36+
cd db && fly deploy --config fly.prod.toml
37+
38+
deploy-meilisearch-prod:
39+
cd meilisearch && fly deploy --config fly.prod.toml
40+
41+
deploy-search-prod:
42+
cd search && fly deploy --config fly.prod.toml
43+
44+
deploy-all-prod: deploy-frontend-prod deploy-backend-prod deploy-pocketbase-prod deploy-meilisearch-prod deploy-search-prod

db/fly.prod.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
app = "localmart-pocketbase-prod"
2+
primary_region = "ewr" # Change this to your preferred region
3+
4+
[build]
5+
dockerfile = "Dockerfile"
6+
7+
[env]
8+
PORT = "8090"
9+
10+
[http_service]
11+
internal_port = 8090
12+
force_https = true
13+
auto_stop_machines = true
14+
auto_start_machines = true
15+
min_machines_running = 1
16+
processes = ["app"]
17+
18+
[[vm]]
19+
cpu_kind = "shared"
20+
cpus = 1
21+
memory_mb = 1024
22+
23+
[mounts]
24+
source = "pb_data"
25+
destination = "/pb_data"

frontend/fly.prod.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
app = "localmart-frontend-prod"
2+
primary_region = "ewr" # Change this to your preferred region
3+
4+
[build]
5+
dockerfile = "Dockerfile"
6+
7+
[env]
8+
NODE_ENV = "production"
9+
PORT = "3000"
10+
NEXT_PUBLIC_API_URL = "https://localmart-backend-prod.fly.dev"
11+
NEXT_PUBLIC_POCKETBASE_URL = "https://localmart-pocketbase-prod.fly.dev"
12+
NEXT_PUBLIC_SEARCH_URL = "https://localmart-search-prod.fly.dev"
13+
NEXT_PUBLIC_MEILI_URL = "https://localmart-meilisearch-prod.fly.dev"
14+
15+
[http_service]
16+
internal_port = 3000
17+
force_https = true
18+
auto_stop_machines = true
19+
auto_start_machines = true
20+
min_machines_running = 1
21+
max_machines_count = 1
22+
processes = ["app"]
23+
24+
[[vm]]
25+
cpu_kind = "shared"
26+
cpus = 1
27+
memory_mb = 1024

meilisearch/fly.prod.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
app = "localmart-meilisearch-prod"
2+
primary_region = "ewr"
3+
4+
[build]
5+
image = "getmeili/meilisearch:latest"
6+
7+
[env]
8+
MEILI_ENV = "production"
9+
MEILI_NO_ANALYTICS = "true"
10+
11+
[http_service]
12+
internal_port = 7700
13+
force_https = true
14+
auto_stop_machines = true
15+
auto_start_machines = true
16+
min_machines_running = 1
17+
max_machines_count = 1
18+
processes = ["app"]
19+
20+
[[vm]]
21+
cpu_kind = "shared"
22+
cpus = 1
23+
memory_mb = 1024
24+
25+
[mounts]
26+
source = "meili_data"
27+
destination = "/data.ms"
File renamed without changes.

python-backend/fly.prod.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
app = "localmart-backend-prod"
2+
primary_region = "ewr"
3+
4+
[build]
5+
dockerfile = "Dockerfile"
6+
7+
[env]
8+
PORT = "8000"
9+
PYTHONPATH = "/app"
10+
POCKETBASE_URL = "https://localmart-pocketbase-prod.fly.dev"
11+
12+
[http_service]
13+
internal_port = 8000
14+
force_https = true
15+
auto_stop_machines = true
16+
auto_start_machines = true
17+
min_machines_running = 1
18+
max_machines_count = 1
19+
processes = ["app"]
20+
21+
[[vm]]
22+
cpu_kind = "shared"
23+
cpus = 1
24+
memory_mb = 1024

search/fly.prod.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
app = "localmart-search-prod"
2+
primary_region = "ewr"
3+
4+
[build]
5+
dockerfile = "Dockerfile"
6+
7+
[env]
8+
PORT = "4100"
9+
PHX_HOST = "localmart-search-prod.fly.dev"
10+
MIX_ENV = "prod"
11+
MEILI_HOST = "https://localmart-meilisearch-prod.fly.dev"
12+
MEILI_ENDPOINT = "https://localmart-meilisearch-prod.fly.dev"
13+
14+
[http_service]
15+
internal_port = 4100
16+
force_https = true
17+
auto_stop_machines = true
18+
auto_start_machines = true
19+
min_machines_running = 1
20+
max_machines_count = 1
21+
processes = ["app"]
22+
23+
[[vm]]
24+
cpu_kind = "shared"
25+
cpus = 1
26+
memory_mb = 1024

0 commit comments

Comments
 (0)