Claude Claude Opus 4.8 commited on
Add Railway deploy config for the API
Browse filesbackend/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
- README.md +17 -10
- 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 β
|
| 120 |
|
| 121 |
-
The API is a standard uvicorn app
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
| 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 |
+
}
|