Documentation

Deploy Desk on Fly.io

The repository's fly.toml runs Desk's published image on Fly.io. Before you start, read what every deployment needs.

fly.toml setsValue
Imageghcr.io/modelriver/desk:1
MachineOne, always on: shared CPU, 512 MB
Volumedesk_data, 1 GB, mounted at /data, created on the first deploy
HTTPSFly's, with HTTP redirected to HTTPS
Health checkGET /robots.txt every 30 seconds
Visitor addressesRead from Fly's Fly-Client-IP header (CLIENT_IP_HEADER), for rate limits

Desk stays on one machine with autostop off: rate limits live in memory, and team email notifications go out a few seconds after the event.

1. Install flyctl

Install flyctl and sign in with fly auth login.

2. Create the app

In an empty folder:

Bash
curl -fsSLO https://raw.githubusercontent.com/modelriver/desk/main/fly.toml
fly launch --copy-config --no-deploy --name your-desk

fly launch keeps the settings from fly.toml, asks for a region, and writes your app name into the file. App names are global on Fly, so pick your own.

3. Set the secrets

Bash
fly secrets set MODELRIVER_API_KEY=your-key \
DESK_SECRET_KEY="$(openssl rand -base64 32)" \
DESK_IDENTITY_SECRET="$(openssl rand -base64 48 | tr -d '\n')"

4. Deploy

Bash
fly deploy --ha=false

--ha=false keeps Desk to one machine, which it needs. The volume is created with the machine.

5. Create the first admin

Bash
fly ssh console --pty -C "desk-entrypoint node /app/scripts/create-admin.ts"

It asks for the admin's email, name and password. Desk is at https://your-desk.fly.dev; open /dashboard and sign in. Your first sign-in sets up two-factor authentication.

Your own domain

Bash
fly certs add support.acme.com

Add the DNS records it prints. Once the certificate is issued, set the address Desk uses for links:

Bash
fly secrets set APP_URL=https://support.acme.com

Set up email

Recommended. Raising and answering tickets, email verification for account lookups, and team notifications all need email (what changes without it). Use Resend, Postmark or Amazon SES, with EMAIL_FROM on a domain the provider has verified and SUPPORT_REPLY_TO set to a mailbox your team reads.

Set them as secrets; the machine restarts with them:

Bash
fly secrets set EMAIL_PROVIDER=resend RESEND_API_KEY=re_… \
EMAIL_FROM="Acme Support <[email protected]>" SUPPORT_REPLY_TO=support@acme.com

Then check it with Dashboard → Settings → Send a test email.

Running it

  • Logs: fly logs.
  • Change settings: fly secrets set NAME=value. The machine restarts with the new value. Never change DESK_SECRET_KEY.
  • Another admin, or a lost password or phone: run the command from step 5 again.
  • More room: fly volumes extend <volume-id> --size 3 grows the volume (fly volumes list shows the ID); fly scale memory 1024 adds memory.
  • Pin a version: change image in fly.toml to a full tag, like ghcr.io/modelriver/desk:1.0.1, and deploy.
  • Update: fly deploy pulls the newest image for the tag in fly.toml. See Updating to do it on a schedule.