forked from Betta-Pay/BettaPay-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.yaml
More file actions
206 lines (200 loc) · 7.5 KB
/
Copy pathrender.yaml
File metadata and controls
206 lines (200 loc) · 7.5 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# BettaPay Backend — Render Blueprint
#
# Production checklist: docs/deploy-production.md
#
# Before first deploy, set every `sync: false` env var in the Render Dashboard
# (ALLOWED_ORIGINS, INTER_SERVICE_SECRET, contract IDs, admin keys).
# Use the SAME INTER_SERVICE_SECRET value on all four services.
services:
# ── API Gateway (Public Web Service) ──────────────────────────────────────────
- type: web
name: api-gateway
env: node
plan: starter # Upgrade path: starter → standard → pro (see docs/deploy-production.md)
# HA + autoscaling (Pro workspace required for autoscaling).
# minInstances: 2 keeps at least two replicas for high availability.
# If your workspace does not support autoscaling, remove `scaling` and set
# `numInstances: 2` instead (manual HA).
scaling:
minInstances: 2
maxInstances: 5
targetCPUPercent: 60
targetMemoryPercent: 60
healthCheckPath: /api/health
buildCommand: pnpm install --prod=false && pnpm exec prisma generate && pnpm build
startCommand: pnpm --filter api-gateway start
envVars:
- key: NODE_ENV
value: production
- key: PORT
value: 3000
# REQUIRED at deploy time — set an explicit HTTPS frontend origin (comma-separated).
# Do NOT use "*": wildcard CORS is invalid with credentials:true and is rejected
# by production env validation (shared/validation/cors.ts).
# Example: https://betta-pay-frontend.vercel.app
# Example (multi): https://app.example.com,https://www.example.com
- key: ALLOWED_ORIGINS
sync: false
- key: DATABASE_URL
fromDatabase:
name: bettapay-db
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: bettapay-redis
property: connectionString
- key: JWT_SECRET
generateValue: true
# Shared manually across all services — do NOT use generateValue here.
# First-time Blueprint sync can fail if the gateway generates the secret
# while private services try to read it via fromService.
# Generate a 32+ char secret once and paste the same value on every service.
- key: INTER_SERVICE_SECRET
sync: false
- key: FX_ENGINE_URL
value: http://fx-engine:3002
- key: SETTLEMENT_ENGINE_URL
value: http://settlement-engine:3001
- key: INDEXER_URL
value: http://indexer:3003
- key: STELLAR_RPC_URL
value: https://soroban-testnet.stellar.org
- key: STELLAR_NETWORK_PASSPHRASE
value: "Test SDF Network ; September 2015"
- key: SETTLEMENT_CONTRACT_ID
sync: false
- key: GOVERNANCE_CONTRACT_ID
sync: false
- key: ADMIN_ADDRESS
sync: false
- key: ADMIN_SECRET
sync: false
# ── FX Engine (Private Service) ───────────────────────────────────────────────
# Private services are not publicly reachable; they are still reachable by other
# services (and Render project members) on the internal network.
- type: pserv
name: fx-engine
env: node
plan: starter # Upgrade path: starter → standard → pro
# HA recommendation: 2 instances. Use 1 on starter to save cost if acceptable.
# If Pro autoscaling is unavailable, keep numInstances and remove `scaling`.
numInstances: 2
scaling:
minInstances: 2
maxInstances: 4
targetCPUPercent: 70
targetMemoryPercent: 70
# Included for readiness probes. Render documents healthCheckPath as web-only;
# private services still expose GET /api/health for internal monitoring.
healthCheckPath: /api/health
buildCommand: pnpm install --prod=false && pnpm exec prisma generate && pnpm build
startCommand: pnpm --filter fx-engine start
envVars:
- key: NODE_ENV
value: production
- key: PORT
value: 3002
# Must match api-gateway / settlement-engine / indexer exactly.
- key: INTER_SERVICE_SECRET
sync: false
- key: DATABASE_URL
fromDatabase:
name: bettapay-db
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: bettapay-redis
property: connectionString
# ── Settlement Engine (Private Service) ───────────────────────────────────────
- type: pserv
name: settlement-engine
env: node
plan: starter # Upgrade path: starter → standard → pro
numInstances: 2
scaling:
minInstances: 2
maxInstances: 4
targetCPUPercent: 70
targetMemoryPercent: 70
healthCheckPath: /api/health
buildCommand: pnpm install --prod=false && pnpm exec prisma generate && pnpm build
startCommand: pnpm --filter settlement-engine start
envVars:
- key: NODE_ENV
value: production
- key: PORT
value: 3001
- key: INTER_SERVICE_SECRET
sync: false
- key: DATABASE_URL
fromDatabase:
name: bettapay-db
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: bettapay-redis
property: connectionString
- key: STELLAR_RPC_URL
value: https://soroban-testnet.stellar.org
- key: STELLAR_NETWORK_PASSPHRASE
value: "Test SDF Network ; September 2015"
- key: SETTLEMENT_CONTRACT_ID
sync: false
- key: GOVERNANCE_CONTRACT_ID
sync: false
- key: ADMIN_ADDRESS
sync: false
- key: ADMIN_SECRET
sync: false
# ── Indexer (Private Service) ─────────────────────────────────────────────────
- type: pserv
name: indexer
env: node
plan: starter # Upgrade path: starter → standard → pro
# Prefer a single indexer replica unless you have leader-election / shard logic.
# Documented HA path: raise to numInstances: 2 only after coordinating cursors.
numInstances: 1
# Optional autoscaling — leave commented until multi-instance indexing is safe.
# scaling:
# minInstances: 1
# maxInstances: 2
# targetCPUPercent: 70
# targetMemoryPercent: 70
healthCheckPath: /api/health
buildCommand: pnpm install --prod=false && pnpm exec prisma generate && pnpm build
startCommand: pnpm --filter indexer start
envVars:
- key: NODE_ENV
value: production
- key: PORT
value: 3003
- key: INTER_SERVICE_SECRET
sync: false
- key: DATABASE_URL
fromDatabase:
name: bettapay-db
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: bettapay-redis
property: connectionString
- key: STELLAR_RPC_URL
value: https://soroban-testnet.stellar.org
- key: STELLAR_NETWORK_PASSPHRASE
value: "Test SDF Network ; September 2015"
- key: SETTLEMENT_CONTRACT_ID
sync: false
- key: GOVERNANCE_CONTRACT_ID
sync: false
databases:
- name: bettapay-db
databaseName: bettapay
user: bettapay_user
plan: free # Production upgrade path: free → basic → pro / pro-plus
- type: redis
name: bettapay-redis
plan: free # Production upgrade path: free → starter → standard / pro