Skip to content
Unreleased: these pages follow the main branch. The latest release is v0.5.

7. Deploy

You build the app for production: one binary with everything in it, or a container image.

Build it

$ go tool anetos build
built bin/tracker (linux/amd64, 19.4 MB)

The binary holds the migrations, the views and the files of public/ and locales/. It needs its settings, from the environment: deploy/production.env.example lists them. Try it locally with production settings and a database of its own:

export APP_ENV=production APP_DEBUG=false APP_KEY=$(go tool anetos key:generate --show | cut -d= -f2-)
export DB_NAME=/tmp/tracker.db STORAGE_ROOT=/tmp/tracker-files HTTP_ADDR=:8081
./bin/tracker migrate
./bin/tracker run

APP_DEBUG=false overrides .env, which the app still reads in the project’s folder. Production cookies are HTTPS-only, so logging in needs HTTPS: put a proxy in front, as the deploy guide shows.

Or as an image

The project has a Dockerfile:

docker build -t tracker .
docker run --rm --env-file production.env tracker migrate
docker run -d -p 8080:8080 --env-file production.env -v tracker-data:/data tracker

production.env is your copy of deploy/production.env.example, filled in; keep it out of git. With SQLite, the database is on the /data volume.

Where to run it

Deploy covers a server with systemd, Docker and Docker Compose, HTTPS, and running the queue’s workers apart from the web server as traffic grows; Deploy to a cloud platform, Google Cloud Run, Azure Container Apps, Amazon ECS, DigitalOcean App Platform, Kubernetes, Fly.io and Render.

What’s next

You’ve built an app with accounts, pages, forms, htmx, search, events, a queue and email, with its tests. From here:

  • examples/tracker grows this app into a team’s tool: projects with roles, labels, files, history, a daily digest, an admin and a JSON API.
  • The guides take one feature at a time.
  • The concepts explain how Anetos works underneath.