Build And Deploy

Deployment Checklist

Run a built GoLazy binary with production address, assets, and smoke checks.

By Guillermo Alvarez - Published - Updated

Run the binary

Build the app:

go build -o .tmp/build/sample-app ./cmd/app

Run it with the production address:

ADDR=0.0.0.0:8080 .tmp/build/sample-app

ListenAndServe reads ADDR, then PORT, then defaults to :3000.

Provide secrets through the platform

Application code reads environment variables:

key := os.Getenv("SECURE_COOKIE_KEY")

Production deployments should provide those variables through the hosting platform or secret store. Development files such as secrets/development.env are examples, not production configuration.

Unpack assets when needed

Most deployments can serve assets from the Go binary. If a platform needs static files beside the app, use the asset registry:

if err := appinit.App().Assets.Unpack(
    "public",
    lazyassets.WithUnpackMode(lazyassets.UnpackPermanent),
); err != nil {
    log.Fatal(err)
}

UnpackBoth writes logical and permanent paths. UnpackLogical writes only logical paths. UnpackPermanent writes only content-hashed permanent paths.

Smoke test the deployment

After starting the deployed process, request the app and one public asset:

curl -i http://127.0.0.1:8080/
curl -i http://127.0.0.1:8080/styles.css

Check that the app route returns HTML and the asset response includes cache headers and an ETag.

Keep platform concerns outside GoLazy

GoLazy leaves TLS termination, process supervision, log shipping, service discovery, and platform routing to the deployment environment. The application binary should stay a normal Go HTTP process.