Go
Deploy a Go application with a separate DB initializer binary.
Assumed Structure
- App server:
go/main.go→ built toout/app - DB initializer:
cmd/db/main.go→ built toout/db - Setup builds both binaries; pre-deploy runs
out/dbto initialize the schema; start command launches the server
Deploy Commands
| Field | Value (example) |
|---|---|
| Setup Command | go build -trimpath -ldflags='-s -w' -o out/app ./go;go build -trimpath -ldflags='-s -w' -o out/db ./cmd/db |
| Pre-deploy Command | out/db |
| Start Command | out/app |
All commands run from the repository root.
Environment Variables
The PORT environment variable is set by default. Your app should use this value as the listen port.
When a database is selected during app creation, the following variables are also automatically set:
DB_HOST,DB_PORT,DB_NAME,DB_USER,DB_PASSWORDDATABASE_URL— full connection string
Starter App
See the starter app for reference: kamui-project/go-starter