Documentation
Deployment
Ship the generated app to production.
The generated server supports graceful shutdown, so it plays well with orchestrators that send termination signals during rollouts.
Build the binary
bash
make buildThis writes the API binary to bin/api. Run migrations with go run ./cmd/migrate up or build cmd/migrate the same way.
Containers
New projects include a multi-stage Dockerfile and a .dockerignore. The build stage compiles ./cmd/api and ./cmd/migrate, and the runtime stage is a small Alpine image that runs as a non-root user and listens on port 8080. SQLite projects store the database in a /data volume.
bash
docker build -t myapp .
docker run -p 8080:8080 --env-file .env myappPass configuration through environment variables. For PostgreSQL or MySQL, point the container at your database through the same settings as your .env file.
Checklist
- Provide production configuration and secrets through your platform, not committed files.
- Point the app at a managed PostgreSQL or MySQL instance.
- Run migrations before starting the new version.
- Collect Zerolog's structured output in your log pipeline.