feat(caddy,stand,smoke): prod-like routing stand, api smoke, old ui fallback for unknown paths
This commit is contained in:
1 parent
c74dac3e00
commit
f6d76bb307
11 files changed
+271
-4
No files matched your search
+5
-1
@@ -1,3 +1,7 @@
|
||||
# caddy
|
||||
|
||||
`site.caddy` routes `{$FIREFLY_UI_DOMAIN}` to the project over the external `caddy` network. In a shared Caddy, mount this directory as `/etc/caddy/projects.d/firefly-ui:ro` and set `FIREFLY_UI_DOMAIN`. Keep it portable: domain only from the env, no `tls`, snippets prefixed with `firefly_ui_`.
|
||||
`fireflyiii.site.caddy` is the routing that runs in production: a copy of `fleet/personal/personal-main/fireflyiii/site.caddy` in `infra/komodo`. Firefly UI has no domain of its own; it lives on Firefly's domain and takes only its page paths on GET/HEAD. The path list comes from `src/lib/spa-paths.ts`: `bun scripts/caddy-matcher.ts` prints the `@ffui_pages` block. When the list changes, paste it into both copies.
|
||||
|
||||
`site.caddy` is the template's routing for a separate domain and is not used.
|
||||
|
||||
`stand/` runs the same file locally (`docker compose -f stand/docker-compose.yml --profile prodlike up -d`), in front of the v3 stand and a production build of the client.
|
||||
@@ -0,0 +1,55 @@
|
||||
# Firefly III, поверх него Firefly UI (репа apps/firefly-ui, стек firefly-ui).
|
||||
# Новый UI отдаёт свои ассеты и свои страницы на GET/HEAD. Всё остальное:
|
||||
# API, вход, MFA, OAuth, cron, ассеты Firefly, любые не-GET и страницы,
|
||||
# которых в новом UI нет, отдаёт сам Firefly. Список путей генерирует
|
||||
# scripts/caddy-matcher.ts в apps/firefly-ui (из src/lib/spa-paths.ts).
|
||||
# Отказ от нового UI: вернуть этот файл к одному reverse_proxy и задеплоить
|
||||
# personal-main-caddy. Если фронт Firefly UI лежит, страницы сами уходят
|
||||
# в Firefly (второй апстрим, lb_policy first).
|
||||
#
|
||||
# Переключатель на любом адресе:
|
||||
# ?ffui=old только этот запрос в старый UI, без куки
|
||||
# ?ffui=off старый UI до конца сессии браузера (кука ffui=off)
|
||||
# ?ffui=on снять куку, снова новый UI
|
||||
{$FIREFLY_DOMAIN} {
|
||||
import cf_tls
|
||||
import compress
|
||||
|
||||
@ffui_off query ffui=off
|
||||
header @ffui_off Set-Cookie "ffui=off; Path=/; Secure; HttpOnly; SameSite=Lax"
|
||||
@ffui_on query ffui=on
|
||||
header @ffui_on Set-Cookie "ffui=; Path=/; Max-Age=0; Secure; HttpOnly; SameSite=Lax"
|
||||
|
||||
@ffui_assets path /_app/* /favicon.svg
|
||||
handle @ffui_assets {
|
||||
reverse_proxy firefly-ui-frontend:3000
|
||||
}
|
||||
|
||||
@ffui_pages {
|
||||
method GET HEAD
|
||||
path / /home /accounts /budgets /categories /tags
|
||||
path /bills /subscriptions /piggy-banks /groups /reports /search
|
||||
path /currencies /exchange-rates /attachments /preferences /export /administrations
|
||||
path /recurring /webhooks/index /settings/links /accounts/* /inactive-accounts/* /transactions/*
|
||||
path /budgets/* /categories/* /tags/* /bills/* /subscriptions/* /piggy-banks/*
|
||||
path /groups/* /reports/* /currencies/* /exchange-rates/* /attachments/* /administrations/*
|
||||
path /recurring/show/* /webhooks/show/* /settings/links/show/*
|
||||
not path /accounts/reconcile/* /attachments/download/* /attachments/view/* /transactions/convert/* /transactions/debug/* /transactions/link/*
|
||||
not path /transactions/mass/* /transactions/bulk/* /transactions/show-by-journal/* /piggy-banks/add/* /piggy-banks/remove/* /reports/options/*
|
||||
not expression `{query.ffui} in ["off", "old"] || ({cookie.ffui} == "off" && {query.ffui} != "on")`
|
||||
}
|
||||
handle @ffui_pages {
|
||||
reverse_proxy firefly-ui-frontend:3000 firefly_iii_app:8080 {
|
||||
lb_policy first
|
||||
lb_try_duration 3s
|
||||
fail_duration 10s
|
||||
transport http {
|
||||
dial_timeout 1s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handle {
|
||||
reverse_proxy firefly_iii_app:8080
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user