Browse Source

fix build

imwald
Silberengel 7 days ago
parent
commit
c2bbabf139
  1. 2
      README.md
  2. 18
      compose.hub.yaml

2
README.md

@ -170,7 +170,7 @@ Adjust the **articles:get** window as needed.
### Scheduled `app:prewarm` on hub ### Scheduled `app:prewarm` on hub
The **`prewarm`** service in `compose.hub.yaml` uses the **same** image as `php` and runs **`app:prewarm` every 10 minutes** (same cadence as dev’s `docker/cron`). It starts only after the **database** is healthy and the **`php`** service passes its healthcheck (so migrations from the `php` entrypoint have typically completed). **Optional** `PREWARM_FLAGS` in `.env` is passed into that container; after changing it, run: The **`prewarm`** service uses the **same** image as `php` and runs **`app:prewarm` every 10 minutes** (same cadence as dev’s `docker/cron`). It waits in an **entrypoint loop** until **`http://php/`** returns (Caddy up after DB + migrations), so the first boot is not blocked on Compose’s `php` healthcheck timing. **Optional** `PREWARM_FLAGS` in `.env` is passed into that container; after changing it, run:
```bash ```bash
docker compose -f compose.hub.yaml up -d --force-recreate prewarm docker compose -f compose.hub.yaml up -d --force-recreate prewarm

18
compose.hub.yaml

@ -38,12 +38,14 @@ services:
- caddy_config:/config - caddy_config:/config
ports: ports:
- "${HTTP_PUBLISH:-9080}:80/tcp" - "${HTTP_PUBLISH:-9080}:80/tcp"
# Caddy/FrankenPHP only listen after the entrypoint finishes DB wait + migrations — allow a slow
# first MySQL + migrate on a small host (avoids "unhealthy" + failed `up` for dependents).
healthcheck: healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1/", "-o", "/dev/null"] test: ["CMD", "curl", "-fsS", "http://127.0.0.1/", "-o", "/dev/null"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 6 retries: 10
start_period: 120s start_period: 180s
depends_on: depends_on:
database: database:
condition: service_healthy condition: service_healthy
@ -53,14 +55,14 @@ services:
pull_policy: always pull_policy: always
restart: unless-stopped restart: unless-stopped
working_dir: /app working_dir: /app
# Same app image as `php`, but not FrankenPHP: wait for DB + `php` healthy (migrations done), then # Do not `depends_on: php: service_healthy`: Compose can time out the stack while `php` is still
# run `app:prewarm` every 10 minutes (dev `docker/cron` uses the same interval). # starting (DB retries + migrations); `prewarm` waits in-script for http://php:80/ = same as ready.
entrypoint: ["/bin/sh", "-c"] entrypoint: ["/bin/sh", "-c"]
command: command:
- | - |
until php bin/console dbal:run-sql -q "SELECT 1" 2>/dev/null; do echo "prewarm: waiting for app at http://php/ (Caddy + migrations)…"
echo "prewarm: waiting for database..." until curl -fsS "http://php/" -o /dev/null 2>/dev/null; do
sleep 2 sleep 3
done done
while true; do while true; do
sleep 600 sleep 600
@ -77,7 +79,7 @@ services:
database: database:
condition: service_healthy condition: service_healthy
php: php:
condition: service_healthy condition: service_started
database: database:
image: mysql:${MYSQL_VERSION:-8.0} image: mysql:${MYSQL_VERSION:-8.0}

Loading…
Cancel
Save