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
desksystem 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:
git clone https://github.com/modelriver/desk.gitcd desksudo ./deploy/setup-server.sh --source . --domain support.acme.com --email you@acme.comThe script:
- asks for your ModelRiver API key, without showing it on screen. You can pass
MODELRIVER_API_KEYin the environment instead, but a key typed on the command line stays in your shell history. - generates
DESK_SECRET_KEYandDESK_IDENTITY_SECRET. - installs Node.js, builds Desk and starts the service.
- asks for the first admin's email, name and password (or set
ADMIN_EMAIL,ADMIN_NAMEandADMIN_PASSWORD). - 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
| Where | What |
|---|---|
/opt/desk | The app, replaced on every update |
/var/lib/desk | Your data: data/ (articles and notes), desk.db and support.config.json. Back this up |
/etc/desk/env | Settings and secrets, readable by root only |
/etc/nginx/sites-available/desk | The proxy config, written once; certbot adds HTTPS to it |
/usr/local/bin/desk-update | The update command (see below) |
/var/backups/desk | Backups desk-update makes before each update; the last 3 are kept |
Options
| Option | What it does |
|---|---|
--sample-data | Starts with the example articles |
--firewall | Turns on ufw, allowing only SSH, HTTP and HTTPS |
--no-tls | Skips the certificate, when HTTPS ends somewhere else |
--no-nginx | Skips nginx, when you have your own proxy |
--port | The port Desk listens on (default 3000) |
--node-version | A different Node.js version (26.12.1 or later) |
--repo, --branch | Clone from a fork, or another branch, instead of using --source |
--dry-run | Prints 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:
EMAIL_PROVIDER=resendRESEND_API_KEY=re_…EMAIL_FROM="Acme Support <[email protected]>"SUPPORT_REPLY_TO=support@acme.comThen restart: sudo systemctl restart desk.
Then check it with Dashboard → Settings → Send a test email.
Running it
- Change settings:
sudoedit /etc/desk/env, thensudo systemctl restart desk. Never changeDESK_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 examplesudo 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 --checkshows 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, runsudo apt-get install -y libatomic1and 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_HOPSin/etc/desk/envmatches the number of proxies in front.