release(main): 集成 nginx 移除里程碑

This commit is contained in:
Cheng Zhou
2026-03-30 21:03:35 +08:00
parent 956c47218e
commit 5677f6823a
22 changed files with 287 additions and 160 deletions
@@ -4,24 +4,25 @@
**Decisions**
- Keep single-host `docker-compose` deployment.
- Convert the frontend to a static build served directly by Nginx.
- Keep the frontend as an independently deployable runtime image.
- Keep PostgreSQL and the existing `pg_data` persistence model.
- Keep one backend container and remove development-only runtime behavior.
- Update the existing `docker-compose.yaml` in place instead of introducing a separate production file.
- Leave public ingress to an external reverse proxy outside this repository.
**Architecture**
- `db` remains a long-lived PostgreSQL service with the existing bind-mounted data directory.
- `backend` runs from the backend image default command and exposes only the application port needed inside the compose network.
- `nginx` becomes the public entrypoint. It serves the built frontend assets and proxies `/api/` and `/health` to the backend service.
- The frontend is no longer a long-running service in production. Its build artifacts are produced during the image build and copied into the Nginx image.
- `backend` runs from the backend image default command and exposes port `8000`.
- `frontend` runs from its own image and serves the SPA on a dedicated frontend port.
- An external reverse proxy becomes the public entrypoint and routes browser traffic to `frontend` and API traffic to `backend`.
**Cleanup Scope**
- Remove development-only compose services such as toolbox/init containers.
- Remove development-only backend startup overrides such as `debugpy` and `uvicorn --reload`.
- Remove development-only frontend runtime behavior such as `npm run dev`, bind mounts, and exposed Vite ports.
- Remove development-only frontend runtime behavior such as bind mounts and hot-reload-only startup behavior.
- Keep data persistence and core service names stable where practical to limit operational change.
**Operational Notes**
- Updating `docker-compose.yaml` in place means local development will no longer use the previous hot-reload setup by default.
- Frontend SPA routing must be handled by Nginx with `try_files`.
- Verification is done through `docker compose config`, image builds, container startup, and HTTP health checks.
- Frontend SPA routing and same-origin `/api` behavior must be handled by the external reverse proxy.
- Verification is done through `docker compose config`, image builds, container startup, and direct HTTP health checks.