Repository navigation
Expand file tree
/
Copy pathrender.yaml
More file actions
132 lines (129 loc) · 5.99 KB
/
Copy pathrender.yaml
File metadata and controls
132 lines (129 loc) · 5.99 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
# Render Blueprint — production topology for AthenaeumAI.
#
# Reviewable in Git rather than living only in a dashboard. Apply with
# "New > Blueprint" in Render, pointing at this file.
#
# `services` is a LIST, per Render's Blueprint specification: every entry begins
# with `- type:`.
#
# ── $0 infrastructure ────────────────────────────────────────────────────────
#
# Every service here is on a Free plan, so no payment method is required:
#
# frontend static site free
# api web service free (0.1 CPU / 512 MB) — runs the API AND the worker
# redis key value free (25 MB, in-memory only)
# mongo Atlas M0 free (yours, not declared here)
# AI Groq free tier
#
# Render offers no free compute for a Background Worker, which is why the worker
# shares the API process. See docs/DEPLOYMENT.md for what Free costs in behaviour:
# the service spins down after 15 minutes idle and takes ~1 minute to wake.
#
# NO SECRET VALUES BELONG IN THIS FILE. Every credential is declared `sync: false`
# (Render prompts for it at apply time) or `generateValue: true`. Values are never
# read from this repository.
#
# ── Required before the first apply ────────────────────────────────────────────
#
# MongoDB is NOT declared here. It has to be an existing MongoDB Atlas cluster,
# because the durable attempt claim and quiz generation both refuse to run
# multi-document transactions against a standalone mongod. Atlas deployments are
# replica sets, which is what those code paths require. Set MONGODB_URI to a
# replica-set connection string:
#
# mongodb+srv://<user>:<password>@<cluster>.mongodb.net/?retryWrites=true&w=majority
#
# Then run `npm run indexes:sync` once against the production database, from the
# API service. It reconciles the per-question ReviewQueue index. Mongoose's
# autoIndex will not widen an index that already exists, so skipping this step
# leaves a stale index that rejects the rows the current code writes.
services:
# ── Redis / Valkey backing the BullMQ queue ──────────────────────────────────
# Key Value plan IDs are `free`, `256mb`, `1g`, … — not the general-purpose
# `starter` used by web services.
#
# `maxmemoryPolicy: noeviction` matters here. The default is `allkeys-lru`,
# which lets Redis evict queued jobs when memory fills, silently dropping
# background work. A job queue must fail loudly at the memory ceiling instead.
#
# A `free` instance gets `persistenceMode: off`, so queued jobs do not survive a
# restart. Acceptable for a single-instance deployment; move to a paid plan with
# persistence if that ever matters.
- type: keyvalue
name: athenaeum-redis
plan: free
maxmemoryPolicy: noeviction
# Required for Key Value. Empty means internal-only: nothing reaches Redis
# from the public internet.
ipAllowList: []
# ── Express API + BullMQ worker, one free web service ───────────────────────
# Render has no free compute plan for a Background Worker, so the consumer runs
# in this process via `node main.js`. Job semantics are unchanged: work is still
# enqueued, tracked in MongoDB, retried, and run by a real BullMQ worker.
- type: web
name: athenaeum-api
runtime: node
# Free: 0.1 CPU / 512 MB. No payment method required.
plan: free
region: oregon
rootDir: backend
buildCommand: npm ci
# `npm start` is the API alone; `start:combined` adds the worker.
startCommand: npm run start:combined
healthCheckPath: /api/v1/health/ready
autoDeployTrigger: 'off'
envVars:
- key: NODE_ENV
value: production
# Render assigns the port; the app must not assume 5000.
- key: PORT
value: 10000
- key: MONGODB_URI
sync: false
- key: JWT_SECRET
generateValue: true
- key: GROQ_API_KEY
sync: false
# Optional. Unset, the provider uses openai/gpt-oss-120b. Set it to move
# models without a code change — list what your key can reach with:
# curl -s https://api.groq.com/openai/v1/models -H "Authorization: Bearer $GROQ_API_KEY"
- key: GROQ_MODEL
sync: false
# The BullMQ queue is live in production: it is only auto-disabled under
# NODE_ENV=test.
- key: ENABLE_JOB_QUEUE
value: "true"
# Key Value exposes a `redis://` URL over the private network.
- key: REDIS_URL
fromService:
type: keyvalue
name: athenaeum-redis
property: connectionString
# Comma-separated. In production this is the ONLY allow-list; there is no
# localhost fallback.
- key: ALLOWED_ORIGINS
sync: false
# ── Frontend ─────────────────────────────────────────────────────────────────
# A static SITE is `type: web` with `runtime: static` — there is no
# `type: static`. The bundle is served as files from a CDN.
#
# No `plan` (static sites have no compute plan), no `region` (global CDN), and
# no `startCommand` (unsupported); `staticPublishPath` takes its place.
- type: web
name: athenaeum-frontend
runtime: static
buildCommand: npm ci && npm run build
staticPublishPath: ./dist
autoDeployTrigger: 'off'
envVars:
# Baked into the bundle at build time. The production build throws if this
# is unset rather than silently addressing localhost.
- key: VITE_API_ROOT
sync: false
routes:
# Client-side routing: /tutor, /review, /assessments/:id/result and friends
# have no file behind them and must resolve to the SPA entry point.
- type: rewrite
source: /*
destination: /index.html