Deploy on Fly.io
One machine, one volume, close to your visitors. Needs the flyctl CLI.
1. fly.toml
In an empty folder, create fly.toml:
app = "my-piqo"
primary_region = "iad"
[build]
image = "ghcr.io/mddanishyusuf/piqo-selfhost:0"
[env]
PORT = "3000"
DATABASE_PATH = "/app/data/piqo.db"
[[mounts]]
source = "piqo_data"
destination = "/app/data"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
[[http_service.checks]]
interval = "30s"
timeout = "5s"
grace_period = "30s"
method = "GET"
path = "/api/health"
[[vm]]
memory = "1gb"
cpu_kind = "shared"
cpus = 12. Create the app, volume and secrets
fly launch --no-deploy --copy-config
fly volumes create piqo_data --size 5
fly secrets set \
AUTH_SECRET="$(openssl rand -base64 48)" \
APP_URL=https://my-piqo.fly.dev \
PIQO_LICENSE_KEY=PIQOSH-XXXXX-XXXXX-XXXXX-XXXXX
fly deploy3. Finish in the app
fly open, create the owner account on /setup, and you're in.
Keep it to one machine. SQLite lives on the volume, and a volume attaches to a single machine. The config above pins
min_machines_running = 1 and disables auto-stop so the cron jobs (rollups, backups, license check-in) keep running.Custom domain
fly certs add analytics.example.com
fly secrets set APP_URL=https://analytics.example.comUpdating
fly deployFly pulls the latest :0 image. Migrations run on boot and the volume carries the data across.