Deployment Basics
A generated GoForj App is a Go application with explicit runtime commands.
Deployment is mostly deciding which binary to run, which runtime commands to start, and which environment variables select infrastructure.
Build
Build the App:
bash
forj buildforj build refreshes generated components, runs Wire, indexes APIs, and builds the binary.
Runtime Commands
Common production commands:
bash
./bin/app run
./bin/app api
./bin/app worker
./bin/app scheduler
./bin/app migrateUse run for standalone topology. Use specific runtime commands when HTTP, workers, and scheduler should be separate processes.
Environment
Set runtime environment through process env, .env files, or your deployment platform.
Important areas:
APP_ENVAPP_SHUTDOWN_TIMEOUTRUNTIME_MODE- HTTP host and port
- supported and selected drivers
- secrets
- metrics ports
- readiness token
Deployment Order
Typical order:
- build the App
- configure environment
- run migrations when database schema changed
- start runtime processes
- verify health and readiness
- verify metrics and logs
Common Mistakes
Common mistakes
- Do not deploy a binary after changing generated drivers without running
forj build. - Do not run every runtime in one process just because local development does.
- Do not start multiple scheduler processes unless the schedules support it.
- Do not make required configuration appear optional.
