2.9 KiB
2.9 KiB
Deployment Benchmark And Coolify Notes
Local build timings
Measured on this workstation on 2026-03-21:
bun run buildcold-ish run:26.00swall timebun run buildwarm run:20.68swall time- Turbopack compile phase inside those runs:
8.8scold-ish,7.8swarm
Observed repeated work on every build:
- taxonomy generation
- workflow manifest generation
- TypeScript validation performed by Next during build
- static page generation
Docker attempt
The local Docker daemon did not respond during validation. docker build and docker info both stalled until externally timed out, so the image could not be run end-to-end on this machine in this session.
That means the application build was validated locally, but container execution still depends on a healthy Docker engine on the target host.
Changes made for deployment
- Added a
prod-depsstage so the runtime image uses production dependencies instead of the full development install. - Bundled
scripts/bootstrap-production.tsintobootstrap-production.jsduring image build so the runtime image no longer needs the full TypeScript source tree just to run startup bootstrap. - Changed the runtime command to execute the bundled bootstrap directly and then
execthe standalone Next server. - Set
HOSTNAME=0.0.0.0in the runtime image so direct Dockerfile-based deployments behave correctly without compose overrides. - Reduced the Docker build context by excluding docs, tests, local metadata, and
rust/target.
Coolify requirements
This project is viable on Coolify if it is deployed as a multi-service Docker Compose stack, not as a single app without Postgres.
Required runtime conditions:
- single replica only
- persistent Docker volumes for
/app/dataand Postgres data WORKFLOW_TARGET_WORLD=@workflow/world-postgresWORKFLOW_POSTGRES_URL=postgres://workflow:workflow@workflow-postgres:5432/workflowDATABASE_URL=file:/app/data/fiscal.sqlite- valid
BETTER_AUTH_SECRET BETTER_AUTH_BASE_URLandBETTER_AUTH_TRUSTED_ORIGINSset to the final public Coolify URL
Highest-impact deployment optimizations
- Keep build cache warm on the same Coolify builder. The Dockerfile now benefits from Bun dependency cache mounts, a separate production dependency stage, and
.next/cache. - Avoid invalidating image builds with non-runtime file changes. The updated
.dockerignorekeeps docs, tests, and local artifacts out of the build context. - Consider moving taxonomy generation out of the hot path if the data does not change on every deploy. It currently runs on every application build.
- Consider splitting bootstrap responsibilities further if startup latency becomes a problem. Right now startup still performs workflow setup and SQLite migrations before the app binds its port.
- If horizontal scaling is required later, move the app database off SQLite. Coolify can run this as-is, but only safely as a single-writer instance.