Commit 258de6e
deploy: run a real production server, not
The Railway service has been running LangGraph's development server in
production. `langgraph dev` holds threads and runs in memory via
langgraph-runtime-inmem, so every deploy and every restart drops whatever was
in flight — the AlphaFRS poller then watches the thread disappear instead of
completing. It also stamps api_variant=local_dev on every log line and runs a
filesystem watcher (207 "changes detected" in a 4-minute window, recorded in
alphaFRS docs/notes/2026-08-02-competitor-intel-iteration.md, open item 2).
The fix is not LangSmith Deployment. Of the four options on
docs.langchain.com/langsmith/deployment, only Standalone Server can run on
Railway and it needs an Enterprise licence; Cloud needs Plus at $39/seat and
is not Railway at all. None of it is required, because the gateway already
implements the LangGraph Platform runs API in-process
(app/gateway/routers/thread_runs.py) — which is exactly what upstream's own
production compose relies on: docker/docker-compose.yaml runs nginx, frontend
and gateway, no LangGraph server anywhere, with
DEER_FLOW_CHANNELS_LANGGRAPH_URL pointed back at the gateway.
The langgraph dev process was never load-bearing here. Every endpoint AlphaFRS
calls — POST /api/threads, POST /api/threads/{id}/runs,
GET /api/threads/{id}/runs/{run_id}, GET /api/threads/{id}/state — is a gateway
route. Only the IM channels service talks to the configured LangGraph URL, and
AlphaFRS does not use channels.
So: drop it, and get durability from Postgres instead.
- config.yaml: database.backend sqlite -> postgres reading $DATABASE_URL.
SQLite sat on a container filesystem Railway discards on every deploy, which
made "persistent" checkpoints a fiction.
- config.yaml: run_events.backend memory -> db. With memory, a run's history
lived in one worker's process and a status lookup landing on the other worker
404'd — the condition patch 0005 worked around at the API level.
- entrypoint: gateway only, via exec so Railway's signals reach uvicorn rather
than a supervising shell. Fails fast with a clear message if DATABASE_URL is
unset, instead of starting against an empty postgres_url. DEER_FLOW_CONFIG_PATH
is now pinned rather than relying on the legacy monorepo fallback in
app_config.py to find /app/config.yaml.
- entrypoint: --workers 2. Shared Postgres state is the precondition that makes
more than one worker safe; the comment says so, next to the flag.
- Dockerfile: uv sync --extra postgres, without which the checkpointer factory
raises ImportError at startup.
Verified before commit: bash -n on the entrypoint; config.yaml loads through
DeerFlow's own AppConfig and reports backend=postgres, run_events=db,
checkpointer=None (so the unified `database` section drives both); and
`uv sync --extra postgres --dry-run` installs asyncpg,
langgraph-checkpoint-postgres, psycopg, psycopg-binary and psycopg-pool from
the existing lockfile with no re-resolution.
Not yet verified, and only observable on Railway: that a run survives a service
restart. That is the whole point of the change and is the first thing to test
after deploy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>langgraph dev
1 parent af421d2 commit 258de6e
3 files changed
Lines changed: 75 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
45 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
53 | | - | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
982 | 989 | | |
983 | | - | |
984 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
985 | 993 | | |
986 | 994 | | |
987 | 995 | | |
| |||
996 | 1004 | | |
997 | 1005 | | |
998 | 1006 | | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
999 | 1011 | | |
1000 | | - | |
| 1012 | + | |
1001 | 1013 | | |
1002 | 1014 | | |
1003 | 1015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
5 | 23 | | |
6 | 24 | | |
7 | 25 | | |
8 | 26 | | |
9 | 27 | | |
10 | | - | |
11 | 28 | | |
12 | 29 | | |
13 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
14 | 40 | | |
15 | | - | |
16 | | - | |
17 | 41 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | 42 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
34 | 53 | | |
35 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
36 | 62 | | |
37 | | - | |
| 63 | + | |
38 | 64 | | |
39 | 65 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 66 | + | |
0 commit comments