Operating
Deployment
How to deploy a GOTTH+ project: the image, the database, and what to set before the first deploy.
The short version
make docker builds the production image from the Dockerfile (--docker). It is distroless and runs as a non-root user with GoEnv=production on port 8080. Fly.io, Railway, Render and most container platforms build that Dockerfile as it is.
make docker
docker run --rm -p 8080:8080 -v my-app-data:/data my-app # SQLite
docker run --rm -p 8080:8080 -e DatabaseURL='...' my-app # Postgres or MySQLPut a TLS-terminating proxy or platform in front of it, and point its health check at /healthz, which pings the database. Behind a proxy, read Security: Behind a proxy, or every visitor shares one rate-limit bucket.
The database
The image creates no tables: AutoMigrate only runs in the development seed route. Run your reviewed migrations before the first start, and before each deploy that changes the schema. Data: SQLite, Postgres or MySQL describes the options.
- SQLite: the file is on the /data volume (DatabasePath=/data/app.db). Keep the volume across deploys and back it up.
- Postgres or MySQL: pass DatabaseURL from the platform's secret store, connect over TLS, and log in as the app's own user with only the privileges it needs.
Before the first deploy
- GoEnv=production, so HSTS, Secure cookies and JSON logs are on, the strict rate limits apply, and /seed is gone.
- Configuration in the platform's environment or secret store, never a committed .env.
- The JavaScript libraries committed and pinned. Production never runs download-js.sh.
- With sign-in: BaseURL set to the public https:// address, and every setting the chosen option needs. Production refuses to start without them.
- With a cache: CacheURL pointing at a server only the app can reach.
- Backups of the database, tested by restoring them.
The generated SECURITY.md has the full checklist.
Was this page helpful?
Be the first to answer.