Files

35 lines
822 B
Caddyfile
Raw Permalink Normal View History

Phase 4a sub-commit 1: bundled-mode startup in BackendConnection Auto-detected on construction: - BRIDGE_URL env set → dev mode (today's behaviour, unchanged). - BRIDGE_URL unset → bundled mode: BackendConnection now 1. Resolves the user app data dir (QStandardPaths::AppDataLocation, ~/.local/share/<org>/<app> on Linux) and ensures var/, var/log/, var/cache/ exist there. 2. Generates a per-session 32-byte URL-safe token and a 48-byte Mercure JWT secret. 3. Runs `frankenphp php-cli bin/console doctrine:migrations:migrate -n` against the user's DATABASE_URL with a 60s timeout. 4. Spawns FrankenPHP via QProcess with BRIDGE_TOKEN/MERCURE_*/PORT in the env, prctl(PR_SET_PDEATHSIG, SIGTERM) on the child, and a supervisor that re-spawns up to 5 times on unexpected exit. Each restart fires tokenRotated(newToken). Path resolution defaults to applicationDirPath() + bin/frankenphp, applicationDirPath() + symfony, applicationDirPath() + Caddyfile, with both `/../share/<app>/...` and `/../usr/share/<app>/...` fallbacks for AppImage-style layouts. All three are overridable via BRIDGE_FRANKENPHP_BIN / BRIDGE_SYMFONY_DIR / BRIDGE_CADDYFILE env vars. Caddyfiles in skeleton + example now use {$VAR:default} substitution for PORT and the Mercure JWT keys, so the same Caddyfile works in both modes. Dev defaults match symfony/.env. restart() in bundled mode re-spawns the child (resets the supervisor counter); in dev mode it stays a probe-only no-op. Smoke-tested locally with `BRIDGE_FRANKENPHP_BIN=… BRIDGE_SYMFONY_DIR=… BRIDGE_CADDYFILE=… ./build/qml/todo` (no BRIDGE_URL): bundled mode created ~/.local/share/php-qml/todo/var/data.sqlite, ran the migration, spawned FrankenPHP, served /healthz, accepted a POST /api/todos with the per-session bearer. Dev mode (`make dev`) still works unchanged. Includes a `phpqml.bridge.bundled` Q_LOGGING_CATEGORY so failures surface to the user; enable with QT_LOGGING_RULES='phpqml.bridge.bundled.*=true'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:00:13 +02:00
# php-qml — Todo example — FrankenPHP / Caddy / Mercure config.
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
#
Phase 4a sub-commit 1: bundled-mode startup in BackendConnection Auto-detected on construction: - BRIDGE_URL env set → dev mode (today's behaviour, unchanged). - BRIDGE_URL unset → bundled mode: BackendConnection now 1. Resolves the user app data dir (QStandardPaths::AppDataLocation, ~/.local/share/<org>/<app> on Linux) and ensures var/, var/log/, var/cache/ exist there. 2. Generates a per-session 32-byte URL-safe token and a 48-byte Mercure JWT secret. 3. Runs `frankenphp php-cli bin/console doctrine:migrations:migrate -n` against the user's DATABASE_URL with a 60s timeout. 4. Spawns FrankenPHP via QProcess with BRIDGE_TOKEN/MERCURE_*/PORT in the env, prctl(PR_SET_PDEATHSIG, SIGTERM) on the child, and a supervisor that re-spawns up to 5 times on unexpected exit. Each restart fires tokenRotated(newToken). Path resolution defaults to applicationDirPath() + bin/frankenphp, applicationDirPath() + symfony, applicationDirPath() + Caddyfile, with both `/../share/<app>/...` and `/../usr/share/<app>/...` fallbacks for AppImage-style layouts. All three are overridable via BRIDGE_FRANKENPHP_BIN / BRIDGE_SYMFONY_DIR / BRIDGE_CADDYFILE env vars. Caddyfiles in skeleton + example now use {$VAR:default} substitution for PORT and the Mercure JWT keys, so the same Caddyfile works in both modes. Dev defaults match symfony/.env. restart() in bundled mode re-spawns the child (resets the supervisor counter); in dev mode it stays a probe-only no-op. Smoke-tested locally with `BRIDGE_FRANKENPHP_BIN=… BRIDGE_SYMFONY_DIR=… BRIDGE_CADDYFILE=… ./build/qml/todo` (no BRIDGE_URL): bundled mode created ~/.local/share/php-qml/todo/var/data.sqlite, ran the migration, spawned FrankenPHP, served /healthz, accepted a POST /api/todos with the per-session bearer. Dev mode (`make dev`) still works unchanged. Includes a `phpqml.bridge.bundled` Q_LOGGING_CATEGORY so failures surface to the user; enable with QT_LOGGING_RULES='phpqml.bridge.bundled.*=true'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:00:13 +02:00
# Works in both run modes:
# - dev mode → env unset, defaults below match symfony/.env
# - bundled mode → BackendConnection sets PORT and MERCURE_*_JWT_KEY
# before launching FrankenPHP.
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
{
auto_https off
admin off
frankenphp
order php_server before respond
order mercure after encode
}
Phase 4a sub-commit 1: bundled-mode startup in BackendConnection Auto-detected on construction: - BRIDGE_URL env set → dev mode (today's behaviour, unchanged). - BRIDGE_URL unset → bundled mode: BackendConnection now 1. Resolves the user app data dir (QStandardPaths::AppDataLocation, ~/.local/share/<org>/<app> on Linux) and ensures var/, var/log/, var/cache/ exist there. 2. Generates a per-session 32-byte URL-safe token and a 48-byte Mercure JWT secret. 3. Runs `frankenphp php-cli bin/console doctrine:migrations:migrate -n` against the user's DATABASE_URL with a 60s timeout. 4. Spawns FrankenPHP via QProcess with BRIDGE_TOKEN/MERCURE_*/PORT in the env, prctl(PR_SET_PDEATHSIG, SIGTERM) on the child, and a supervisor that re-spawns up to 5 times on unexpected exit. Each restart fires tokenRotated(newToken). Path resolution defaults to applicationDirPath() + bin/frankenphp, applicationDirPath() + symfony, applicationDirPath() + Caddyfile, with both `/../share/<app>/...` and `/../usr/share/<app>/...` fallbacks for AppImage-style layouts. All three are overridable via BRIDGE_FRANKENPHP_BIN / BRIDGE_SYMFONY_DIR / BRIDGE_CADDYFILE env vars. Caddyfiles in skeleton + example now use {$VAR:default} substitution for PORT and the Mercure JWT keys, so the same Caddyfile works in both modes. Dev defaults match symfony/.env. restart() in bundled mode re-spawns the child (resets the supervisor counter); in dev mode it stays a probe-only no-op. Smoke-tested locally with `BRIDGE_FRANKENPHP_BIN=… BRIDGE_SYMFONY_DIR=… BRIDGE_CADDYFILE=… ./build/qml/todo` (no BRIDGE_URL): bundled mode created ~/.local/share/php-qml/todo/var/data.sqlite, ran the migration, spawned FrankenPHP, served /healthz, accepted a POST /api/todos with the per-session bearer. Dev mode (`make dev`) still works unchanged. Includes a `phpqml.bridge.bundled` Q_LOGGING_CATEGORY so failures surface to the user; enable with QT_LOGGING_RULES='phpqml.bridge.bundled.*=true'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:00:13 +02:00
http://127.0.0.1:{$PORT:8765} {
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
root * public/
encode gzip
mercure {
transport local
Phase 4a sub-commit 1: bundled-mode startup in BackendConnection Auto-detected on construction: - BRIDGE_URL env set → dev mode (today's behaviour, unchanged). - BRIDGE_URL unset → bundled mode: BackendConnection now 1. Resolves the user app data dir (QStandardPaths::AppDataLocation, ~/.local/share/<org>/<app> on Linux) and ensures var/, var/log/, var/cache/ exist there. 2. Generates a per-session 32-byte URL-safe token and a 48-byte Mercure JWT secret. 3. Runs `frankenphp php-cli bin/console doctrine:migrations:migrate -n` against the user's DATABASE_URL with a 60s timeout. 4. Spawns FrankenPHP via QProcess with BRIDGE_TOKEN/MERCURE_*/PORT in the env, prctl(PR_SET_PDEATHSIG, SIGTERM) on the child, and a supervisor that re-spawns up to 5 times on unexpected exit. Each restart fires tokenRotated(newToken). Path resolution defaults to applicationDirPath() + bin/frankenphp, applicationDirPath() + symfony, applicationDirPath() + Caddyfile, with both `/../share/<app>/...` and `/../usr/share/<app>/...` fallbacks for AppImage-style layouts. All three are overridable via BRIDGE_FRANKENPHP_BIN / BRIDGE_SYMFONY_DIR / BRIDGE_CADDYFILE env vars. Caddyfiles in skeleton + example now use {$VAR:default} substitution for PORT and the Mercure JWT keys, so the same Caddyfile works in both modes. Dev defaults match symfony/.env. restart() in bundled mode re-spawns the child (resets the supervisor counter); in dev mode it stays a probe-only no-op. Smoke-tested locally with `BRIDGE_FRANKENPHP_BIN=… BRIDGE_SYMFONY_DIR=… BRIDGE_CADDYFILE=… ./build/qml/todo` (no BRIDGE_URL): bundled mode created ~/.local/share/php-qml/todo/var/data.sqlite, ran the migration, spawned FrankenPHP, served /healthz, accepted a POST /api/todos with the per-session bearer. Dev mode (`make dev`) still works unchanged. Includes a `phpqml.bridge.bundled` Q_LOGGING_CATEGORY so failures surface to the user; enable with QT_LOGGING_RULES='phpqml.bridge.bundled.*=true'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:00:13 +02:00
publisher_jwt {$MERCURE_PUBLISHER_JWT_KEY:dev_php_qml_bridge_jwt_secret_at_least_256_bits_long_for_lcobucci}
subscriber_jwt {$MERCURE_SUBSCRIBER_JWT_KEY:dev_php_qml_bridge_jwt_secret_at_least_256_bits_long_for_lcobucci}
Phase 3 sub-commit 3: examples/todo POC app, built via the makers Standalone Composer/CMake project under examples/todo/ derived from the skeleton, demonstrating every Phase 3 architectural primitive in a non-trivial app. All cross-side wiring is maker-generated; no handwritten bridge glue. Generated and customised: - src/Entity/Todo.php — make:bridge:resource Todo (UUIDv7 id) - src/Controller/TodoController.php — make:bridge:resource Todo (CRUD) - src/Controller/MarkAllDoneController.php — make:bridge:command MarkAllDone, body filled in to flip done=true on every row - qml/TodoList.qml — make:bridge:resource Todo (starter ListView) - qml/TodoWindow.qml — make:bridge:window Todo, body customised to embed a read-only mirror of the same ReactiveListModel The Phase 1 ping demo is dropped from this app — it doesn't fit the todo flow and nothing in Main.qml references it. Main.qml is the real list UI: - Add input + button (POST /api/todos with optimistic-friendly key). - Per-row CheckBox + delete button (PATCH/DELETE via todoModel.invoke() with `pending` role driving opacity). - "Mark all done" button (POST /api/mark-all-done). - "Open second window" button (Component { TodoWindow {} } pattern). Build / run delegated to the same Makefile shape as the skeleton, with SCRIPT_DIR/QT_BIN updated for the renamed binary (build/qml/todo). composer.json's path repo points at ../../../framework/php (one level deeper than the skeleton's path repo). Verified end-to-end with offscreen QPA: POST/PATCH/DELETE on /api/todos all round-trip, /api/mark-all-done flips every row, Mercure dual- publishes on every change. Clean shutdown. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 15:22:36 +02:00
anonymous
publish_origins *
cors_origins *
}
php_server
log {
output stderr
format console
}
}