ENG-8961: Single port is only prod option#6297
Conversation
Greptile SummaryThis PR enforces single-port as the only production option, removing the ability to run the frontend and backend on separate ports in
Confidence Score: 5/5This PR is safe to merge — the prod single-port enforcement is logically consistent and all previously flagged P1 issues have been resolved. All prior P0/P1 findings (always-truthy enum guard, loglevel silently dropped in Granian prod, ProcessPoolExecutor leak) are resolved in the current code. The only remaining finding is a P2 UX note that reflex/reflex.py — the
|
| Filename | Overview |
|---|---|
| reflex/reflex.py | Adds --single-port flag (now redundant with prod always using single port) and updates _run/_run_prod to enforce single-port in production; guard logic and enum comparisons are correct. |
| reflex/utils/exec.py | Adds run_frontend_prod and _frontend_prod_app for frontend-only prod serving; run_granian_backend_prod switches to direct Granian API and correctly passes loglevel.value as the env-var default. |
| scripts/integration.sh | Prod mode now only waits for one port (3000) instead of two (3000 and 8000), consistent with single-port production. |
| reflex/app.py | Mounts compiled frontend static files in the backend ASGI app when REFLEX_MOUNT_FRONTEND_COMPILED_APP is set, enabling single-port fullstack prod serving. |
| tests/units/test_prerequisites.py | Adds test for PackageJson.Commands.get_prod_command with various frontend_path values; looks correct. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[reflex run] --> B{env?}
B -- dev --> C[_run_dev]
B -- prod --> D{ports conflict?}
D -- yes --> E[SystemExit: must use same port]
D -- no --> F[resolve single port]
F --> G[_run_prod]
G --> H[config: frontend_port = backend_port = port]
H --> I{running_mode?}
I -- has_backend --> J[run_backend_prod\nmount_frontend_compiled_app=has_frontend]
I -- frontend only --> K[run_frontend_prod]
J --> L{granian?}
L -- yes --> M[run_granian_backend_prod\nGranian direct API]
L -- no --> N[run_uvicorn_backend_prod]
K --> L
C --> O[run_frontend dev port]
C --> P[run_backend dev port]
Reviews (3): Last reviewed commit: "fix autosetters" | Re-trigger Greptile
|
@greptile-apps re-review this PR |
|
@greptile-apps re-review this PR |
masenf
left a comment
There was a problem hiding this comment.
ship it, with optional/follow-on feedback
No description provided.