---
url: https://trail.karanjot.co.in/docs/install/fly.md
description: Deploy Trail to one Fly.io machine with a volume for the database.
---

# Fly.io

The repository includes `fly.toml.example`. It builds from the `Dockerfile`, mounts a volume at `/data`, forces HTTPS and keeps one machine running.

```sh
git clone https://github.com/karanjot786/trail && cd trail
cp fly.toml.example fly.toml          # then set `app` to your app name
fly launch --no-deploy --copy-config
fly volumes create trail_data --size 1
fly secrets set TRAIL_PASSWORD=change-me   # optional: without it, the first start logs a generated password
fly deploy
```

Open `https://<app>.fly.dev` and sign in with `TRAIL_PASSWORD`, or with the generated password from `fly logs | grep 'Log in'`. The session key is kept in the database on the volume, so logins survive deploys without `TRAIL_SECRET`. If you skipped `TRAIL_SITES`, add your site under **Settings → Add site**.

## What the example config sets

| Key | Value | Why |
|---|---|---|
| `[env] TRAIL_DB` | `/data/trail.db` | The file lives on the volume |
| `[env] TRAIL_TZ` | `Asia/Kolkata` | Change it to your timezone for daily buckets |
| `[mounts]` | `trail_data` → `/data` | One volume, one machine |
| `auto_stop_machines` | `off` | Ingest must answer at any time |
| `min_machines_running` | `1` | |
| `[[vm]] memory` | `256mb` | |

Run exactly one machine. SQLite is a local file, so a second machine would have its own separate database.

## Backups

Fly takes daily volume snapshots. For a copy you control, see [Backups](/operations/backups); on Fly run the commands through `fly ssh console`.

## Next

* Serve the tracker from your own domain: [Rewrites](/install/rewrites).
* Then [add the script tag](/add/script-tag) to your site.
