mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
rust fmt, updated ci, hooks and docs
This commit is contained in:
1 parent
8c120ae78d
commit
a4c9b5bad1
39 files changed
+691
-902
No files matched your search
+2
-2
@@ -31,8 +31,8 @@ COPY --from=build-stage /app/dist /usr/share/nginx/html
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Nginx config: SPA + strangler API routing (Django/Rust per-group). See
|
||||
# nginx.conf for the cutover layout. proxy_params.conf holds shared headers.
|
||||
# Nginx config: serves the SPA and proxies /api to the Rust backend.
|
||||
# proxy_params.conf holds shared proxy headers.
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY proxy_params.conf /etc/nginx/proxy_params.conf
|
||||
|
||||
|
||||
+10
-23
@@ -1,17 +1,9 @@
|
||||
# =========================================================================
|
||||
# Strangler routing: Django (holy-backend) and Rust (holy-rust) run side by
|
||||
# side, sharing one SQLite DB + media dir + SECRET_KEY. Every endpoint group
|
||||
# below can be served by EITHER backend, so cutover is per-group and instant:
|
||||
# change a `proxy_pass` target, then `docker exec holy-frontend nginx -s reload`
|
||||
# (or recreate the container). Rollback is the same edit in reverse.
|
||||
#
|
||||
# Cutover order (see backend-rs/README.md):
|
||||
# Phase 1 reads -> categories, flavors, banners
|
||||
# Phase 2 auth+write -> auth/token, ratings, replies, users, notifications, tickets
|
||||
# Phase 3 admin+jobs -> admin-custom (THEN stop Django beat + set
|
||||
# RUST_ENABLE_SCHEDULER=true so exactly one scheduler runs)
|
||||
# Phase 4 retire -> point catch-all /api/ at rust; serve /media/ from
|
||||
# nginx; drop Django /admin/ + /static/ if unused.
|
||||
# Frontend nginx: serves the SPA, proxies /api to the Rust backend
|
||||
# (holy-rust:8001), and serves /media straight from the shared bind mount.
|
||||
# The per-group /api locations are kept explicit (one proxy_pass each) for
|
||||
# readability; all point at rust_backend. The catch-all /api/ covers anything
|
||||
# not listed.
|
||||
# =========================================================================
|
||||
|
||||
upstream rust_backend {
|
||||
@@ -28,17 +20,13 @@ server {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# --- API: per-group strangler routing --------------------------------
|
||||
# Longest-prefix match wins, so these specific groups override the
|
||||
# catch-all /api/ below. To cut a group over, swap django_backend ->
|
||||
# rust_backend on its proxy_pass line.
|
||||
|
||||
# Phase 1 — read-only (safe to move first):
|
||||
# --- API -> Rust backend ---------------------------------------------
|
||||
# Longest-prefix match wins; these explicit groups and the catch-all
|
||||
# /api/ all resolve to rust_backend.
|
||||
location /api/categories/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
location /api/flavors/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
location /api/banners/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
|
||||
# Phase 2 — auth + writes:
|
||||
location /api/auth/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
location = /api/token/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; } # legacy JWT alias
|
||||
location /api/ratings/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
@@ -47,13 +35,12 @@ server {
|
||||
location /api/notifications/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
location /api/tickets/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
|
||||
# Phase 3 — admin + jobs (cut over, THEN flip the scheduler ownership):
|
||||
location /api/admin-custom/ { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
|
||||
# OpenAPI schema / Swagger UI (both backends serve these):
|
||||
# OpenAPI schema / Swagger UI:
|
||||
location /api/schema { proxy_pass http://rust_backend; include /etc/nginx/proxy_params.conf; }
|
||||
|
||||
# Catch-all: anything not explicitly cut over stays on Django.
|
||||
# Catch-all for any /api path not listed above.
|
||||
location /api/ {
|
||||
proxy_pass http://rust_backend;
|
||||
include /etc/nginx/proxy_params.conf;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"preview": "vite preview",
|
||||
"schema:export": "cd ../backend && ./venv/bin/python manage.py spectacular --file schema.yaml",
|
||||
"schema:export": "curl -fsS http://localhost:8001/api/schema/ -o ../backend/schema.yaml",
|
||||
"openapi:gen": "openapi-typescript ../backend/schema.yaml -o src/api/schema.d.ts",
|
||||
"openapi:sync": "npm run schema:export && npm run openapi:gen"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user