Deploy Duplicati | (Just Updated) Self-Hosted Encrypted Backup Server, Backup to S3, SFTP, B2, REST API, Login Generated
Duplicati backup server, encrypted backups to S3, SFTP, B2, REST API
duplicati
Just deployed
/data
Deploy and Host Duplicati on Railway
Built for an LLM agent to deploy and use. The deploy form has no fields to fill: the web login and the settings encryption key are generated, the server cannot start without them, and the settings database lives on a volume. Duplicati is a self-hosted backup server with a web UI and a REST API that encrypts, deduplicates and compresses backups and uploads them to S3, Backblaze B2, SFTP, WebDAV, Google Drive and dozens of other destinations, an open-source alternative to Veeam, Backblaze and Arq.
About Hosting Duplicati
This template runs one service, duplicati: the upstream Duplicati 2.4.1.0 image, pinned by digest, through a thin wrapper, with a volume at /data that holds the settings database, the local backup folder /data/backups and the local source folder /data/source. One public domain serves the web UI and the REST API at /api/v1. The server listens on Railway's injected PORT, and the healthcheck is GET /health.
What the wrapper fixes. Upstream Duplicati starts with no password when none is set (it prints a one-time sign-in link in the log instead) and keeps its settings database, which holds every backup passphrase and destination credential, unencrypted when SETTINGS_ENCRYPTION_KEY is missing. It also answers sign-in with 403 from any Host header outside its allowlist, so on a Railway domain the login page loads and every sign-in is refused until you work out DUPLICATI__WEBSERVICE_ALLOWED_HOSTNAMES, and it listens on the 8200 baked into the image, ignoring Railway's PORT. The wrapper refuses to start without DUPLICATI__WEBSERVICE_PASSWORD (at least 8 characters) and SETTINGS_ENCRYPTION_KEY, listens on PORT, and allows any Host header. Measured on an unmodified duplicati/duplicati:2.4.1.0 run locally: with no variables it started with the message No database encryption key was found. The database will be stored unencrypted, and a sign-in with the correct password sent with the Host x.up.railway.app answered 403 while the same sign-in sent with the Host localhost answered 200. On the wrapper the same sign-in with the right password answers 200 with an access token, and a start without the secrets exits with a message. Not reproduced on a Railway control of the incumbent listing.
Using it. Open the domain and sign in with DUPLICATI__WEBSERVICE_PASSWORD. Add a backup, pick a destination (S3, B2, SFTP, WebDAV, a cloud drive, or the local folder /data/backups), choose the source folders, and set a schedule. Every setting is also reachable through the REST API, so an agent can create, run and restore backups without the web UI. Keep SETTINGS_ENCRYPTION_KEY and write it down: it protects the stored settings, and changing it later locks you out of the existing settings database. Redeploys keep the same login and the same backup jobs.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of theduplicatiservice) - Private URL:
http://duplicati.railway.internal:8080 - Credentials: the variable
DUPLICATI__WEBSERVICE_PASSWORDon theduplicatiservice is the web login;SETTINGS_ENCRYPTION_KEYencrypts the stored settings and is not sent by any client - Auth:
POST /api/v1/auth/loginwith a JSON body{"Password":"...","RememberMe":false}returnsAccessToken; send it as the headerAuthorizationwith the valueBearerplus a space plus the token on every/api/v1call. Without the token a write answers 401. There is no account registration. - Health:
GET /healthreturns 200 without credentials
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN, DUPLICATI__WEBSERVICE_PASSWORD (variables of the duplicati service); also curl, sed, grep.
R="https://$RAILWAY_PUBLIC_DOMAIN"
J="Content-Type: application/json"
STAMP=$(date +%s)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/health"
# signup: none - Duplicati has one web login, set by DUPLICATI__WEBSERVICE_PASSWORD, and no account registration
# a stranger cannot write: creating a backup job without a token or with a wrong one is refused
BODY="{\"Backup\":{\"Name\":\"agent-$STAMP\",\"TargetURL\":\"file:///data/backups/agent-$STAMP\",\"Settings\":[{\"Name\":\"--no-encryption\",\"Value\":\"true\"}],\"Sources\":[\"/data/source/\"],\"Filters\":[],\"Metadata\":{}},\"Schedule\":null}"
curl -s -X POST -H "$J" -d "$BODY" "$R/api/v1/backups" -o /dev/null -w "write without key: %{http_code}\n"
curl -s -X POST -H "$J" -H "Authorization: Bearer not-a-token" -d "$BODY" "$R/api/v1/backups" -o /dev/null -w "write with wrong key: %{http_code}\n"
# a wrong login is refused, the generated one returns an access token
curl -s -X POST -H "$J" -d "{\"Password\":\"wrong$STAMP$STAMP\",\"RememberMe\":false}" "$R/api/v1/auth/login" -o /dev/null -w "login with wrong password: %{http_code}\n"
LOGIN=$(curl -s -X POST -H "$J" -d "{\"Password\":\"$DUPLICATI__WEBSERVICE_PASSWORD\",\"RememberMe\":false}" "$R/api/v1/auth/login")
TOKEN=$(echo "$LOGIN" | sed -n 's/.*"AccessToken":"\([^"]*\)".*/\1/p')
if [ -n "$TOKEN" ]; then echo "login with key: ok"; else echo "login with key: FAILED"; fi
A="Authorization: Bearer $TOKEN"
curl -s -H "$A" "$R/api/v1/serverstate" | sed -n 's/.*"ProgramState":"\([A-Za-z]*\)".*/server state: \1\n/p'
# with the token a backup job is created, run, and its result read back
ID=$(curl -s -X POST -H "$J" -H "$A" -d "$BODY" "$R/api/v1/backups" | sed -n 's/.*"ID":"\([0-9]*\)".*/\1/p')
if [ -n "$ID" ]; then echo "write with key: ok"; else echo "write with key: FAILED"; fi
curl -s -X POST -H "$A" "$R/api/v1/backup/$ID/run" -o /dev/null -w "run backup: %{http_code}\n"
n=0; until curl -s -H "$A" "$R/api/v1/backup/$ID" | grep -q '"LastBackupFinished"'; do n=$((n+1)); [ "$n" -le 30 ] || break; sleep 2; done
curl -s -H "$A" "$R/api/v1/backup/$ID" | sed -n 's/.*"SourceFilesCount":"\([0-9]*\)".*/source files backed up: \1/p'
Expected output against a fresh deploy (measured on the wrapper image run locally; the Railway deploy output is recorded in template.md):
health: 200
write without key: 401
write with wrong key: 401
login with wrong password: 401
login with key: ok
server state: Running
write with key: ok
run backup: 200
source files backed up: 1
The refusals are the contract: write without key: 401 and write with wrong key: 401 on the backup create, and login with wrong password: 401. There is no sign-up route, which the # signup: none line in the snippet states.
Why Deploy Duplicati on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Duplicati on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Agent-ready - no deployer fields, a contract block, and one script that proves the server is healthy, a stranger cannot write, and the generated password signs in and runs a real backup.
- Locked from the first request - the server will not start without a password, so there is no open window before you sign in.
- Credentials encrypted at rest - the settings database that holds backup passphrases and destination keys is encrypted with the generated
SETTINGS_ENCRYPTION_KEY. - Works on first deploy - the listener follows Railway's injected
PORTand the login accepts the Railway domain. - Data survives redeploys - the settings database and local backup folder live on one volume.
- Pinned - the upstream image is pinned by digest and the wrapper by tag and digest.
Common Use Cases
- Offsite backups to S3, B2 or SFTP - schedule encrypted, deduplicated backups of servers and home folders to the storage you already pay for.
- Backup orchestration through an API - an agent creates a job, runs it and reads the result over
/api/v1. - Self-hosted alternative to Veeam, Backblaze and Arq - one open-source server, no per-seat license.
Dependencies for Duplicati Hosting
- The duplicati service with its volume, created by the template. A backup destination (an S3 bucket, a B2 bucket, an SFTP host) is yours to supply when you add a backup.
Deployment Dependencies
Template Content
