Claude Claude Opus 4.8 commited on
Commit
5ab35ee
Β·
unverified Β·
1 Parent(s): abf3c4b

Add Railway deploy config for the API

Browse files

backend/railway.json pins the Dockerfile builder so a Railway service with
root directory 'backend' builds backend/Dockerfile (libgomp1 + $PORT).
README backend section rewritten with Railway-specific steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WN4QRr6dTE2W7hQ2SDnLmY

Files changed (2) hide show
  1. README.md +17 -10
  2. backend/railway.json +11 -0
README.md CHANGED
@@ -116,20 +116,27 @@ The README front matter (`sdk: static`) tells HF to run the
116
 
117
  The Space serves at **https://sri-28-docuask.static.hf.space**.
118
 
119
- ### 2. Backend β†’ your host
120
 
121
- The API is a standard uvicorn app; deploy it however you like:
122
 
123
- - **Docker host** (Fly.io, Railway, …): build [`backend/Dockerfile`](./backend/Dockerfile)
124
- β€” it honors `$PORT`.
125
- - **Native Python host** (Render web service, Railway, …): use
126
- [`backend/Procfile`](./backend/Procfile) β€”
127
- `uvicorn app.main:app --host 0.0.0.0 --port $PORT`.
 
 
 
 
 
128
 
129
  The Static Space origin (`https://sri-28-docuask.static.hf.space`) is already in
130
- the backend's default CORS allow-list; add more origins via the `CORS_ORIGINS`
131
- env var. Set `DOCUASK_DB` to a path on persistent storage to keep telemetry
132
- across restarts. See [`backend/.env.example`](./backend/.env.example).
 
 
133
 
134
  ### Keep the demo in sync automatically
135
 
 
116
 
117
  The Space serves at **https://sri-28-docuask.static.hf.space**.
118
 
119
+ ### 2. Backend β†’ Railway
120
 
121
+ The API is a standard uvicorn app. On **Railway**:
122
 
123
+ 1. **New Project β†’ Deploy from GitHub repo** β†’ select `docuask`.
124
+ 2. Open the service β†’ **Settings β†’ Root Directory** = `backend`. This makes
125
+ [`backend/railway.json`](./backend/railway.json) build
126
+ [`backend/Dockerfile`](./backend/Dockerfile) (which installs faiss's
127
+ `libgomp1` and honors Railway's injected `$PORT`).
128
+ 3. **Settings β†’ Networking β†’ Generate Domain** to get a public URL.
129
+ 4. *(Optional)* Add a **Volume** mounted at `/data` and a variable
130
+ `DOCUASK_DB=/data/docuask.db` so telemetry persists across restarts.
131
+ 5. Copy the public URL β€” you'll set it as `DOCUASK_API_URL` in the HF Space
132
+ (step 3 above).
133
 
134
  The Static Space origin (`https://sri-28-docuask.static.hf.space`) is already in
135
+ the backend's default CORS allow-list; add more via the `CORS_ORIGINS` env var.
136
+ See [`backend/.env.example`](./backend/.env.example).
137
+
138
+ > Other hosts work too: any Docker host can build `backend/Dockerfile`, and
139
+ > native-Python hosts (Render, …) can use [`backend/Procfile`](./backend/Procfile).
140
 
141
  ### Keep the demo in sync automatically
142
 
backend/railway.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://railway.com/railway.schema.json",
3
+ "build": {
4
+ "builder": "DOCKERFILE",
5
+ "dockerfilePath": "Dockerfile"
6
+ },
7
+ "deploy": {
8
+ "restartPolicyType": "ON_FAILURE",
9
+ "restartPolicyMaxRetries": 3
10
+ }
11
+ }