Documentation

Deploy Desk on an Ubuntu Server

deploy/setup-server.sh sets up Desk on a fresh Ubuntu 22.04 or later server in one command:

  • Node.js, the version in .nvmrc, checked against nodejs.org's checksums
  • a desk system user that owns the app and its data
  • the systemd service, restarted automatically if it stops
  • nginx with per-IP limits in front of Desk
  • a Let's Encrypt certificate, renewed automatically

It's the lightest way to run Desk, with no container runtime, so it suits small servers (512 MB of memory to run, about 1 GB while building). Before you start, read what every deployment needs.

1. Point your domain at the server

Add an A record (and AAAA for IPv6) for your Desk's domain, for example support.acme.com, pointing at the server. Open ports 80 and 443 in your provider's firewall: Let's Encrypt checks the domain over port 80.

2. Run the script

On the server:

Bash
git clone https://github.com/modelriver/desk.git
cd desk
sudo ./deploy/setup-server.sh --source . --domain support.acme.com --email you@acme.com

The script:

  1. asks for your ModelRiver API key, without showing it on screen. You can pass MODELRIVER_API_KEY in the environment instead, but a key typed on the command line stays in your shell history.
  2. generates DESK_SECRET_KEY and DESK_IDENTITY_SECRET.
  3. installs Node.js, builds Desk and starts the service.
  4. asks for the first admin's email, name and password (or set ADMIN_EMAIL, ADMIN_NAME and ADMIN_PASSWORD).
  5. configures nginx and gets the certificate.

--email is for the certificate; passing it accepts the Let's Encrypt terms. Open https://support.acme.com/dashboard and sign in. Your first sign-in sets up two-factor authentication.

Where everything lives

WhereWhat
/opt/deskThe app, replaced on every update
/var/lib/deskYour data: data/ (articles and notes), desk.db and support.config.json. Back this up
/etc/desk/envSettings and secrets, readable by root only
/etc/nginx/sites-available/deskThe proxy config, written once; certbot adds HTTPS to it
/usr/local/bin/desk-updateThe update command (see below)
/var/backups/deskBackups desk-update makes before each update; the last 3 are kept

Options

OptionWhat it does
--sample-dataStarts with the example articles
--firewallTurns on ufw, allowing only SSH, HTTP and HTTPS
--no-tlsSkips the certificate, when HTTPS ends somewhere else
--no-nginxSkips nginx, when you have your own proxy
--portThe port Desk listens on (default 3000)
--node-versionA different Node.js version (26.12.1 or later)
--repo, --branchClone from a fork, or another branch, instead of using --source
--dry-runPrints every command without running it

--help lists them all.

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.

Add the settings to /etc/desk/env with sudoedit /etc/desk/env:

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

Then restart: sudo systemctl restart desk.

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

Running it

  • Change settings: sudoedit /etc/desk/env, then sudo systemctl restart desk. Never change DESK_SECRET_KEY.
  • Another admin, or a lost password or phone: sudo /opt/desk/deploy/create-admin.sh. For an existing account it sets a new password and resets two-factor.
  • Logs: journalctl -u desk -f.
  • Back up: copy /var/lib/desk (for example sudo tar czf desk-data.tgz -C /var/lib/desk .).
  • Update: sudo desk-update. It backs up your data, builds the new release next to the running one, switches over with a few seconds' restart, and goes back on its own if the new version doesn't start. sudo desk-update --check shows what's new first. See Updating.

Troubleshooting

  • The certificate step fails. Usually the domain doesn't point at the server yet, or port 80 is closed by your provider's firewall. Fix that and run the script again.
  • Node.js won't start: libatomic.so.1: cannot open shared object file. Minimal images (Lightsail, for one) leave out a library Node.js needs. Desk 1.1.1 and later install it; on an older script, run sudo apt-get install -y libatomic1 and run the script again.
  • The build runs out of memory. On a 1 GB server, add swap first: sudo fallocate -l 2G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile.
  • You can't sign in to the dashboard. It only works over HTTPS. If HTTPS ends at another proxy, check that it forwards to Desk and that TRUST_PROXY_HOPS in /etc/desk/env matches the number of proxies in front.