Deploy & Host Kopia | Railway

Kopia Repository Server — Deploy and Host

Kopia is a fast and secure open-source backup tool. This template deploys a Kopia Repository Server on Railway — a central server that stores backups from all your machines, with a built-in web UI and per-user access control.

About Hosting

Kopia runs as a single container on port 51515. Railway provides compute, TLS at the edge, and a public URL. The repository (encrypted backup data), cache, and logs live at /app — a Railway Volume keeps them persistent across restarts and redeploys.

On first deploy, the entrypoint creates the filesystem repository automatically. The web UI and API are protected by basic auth (KOPIA_SERVER_USERNAME / KOPIA_SERVER_PASSWORD).

Why Deploy

Common Use Cases

Dependencies for Kopia

Deployment Dependencies

Configuration

Variable Description
KOPIA_PASSWORD Repository password (encrypts the backup repository). Generated once on first deploy.
KOPIA_SERVER_PASSWORD Web UI / API basic-auth password. Generated on deploy.
KOPIA_SERVER_USERNAME Web UI / API basic-auth username (default kopia).
PORT HTTP listen port (default 51515, matches Railway's routing).

Connect a client

On each machine you want to back up, install Kopia and connect to the server:

kopia repository connect server \
  --url=https://YOUR-SERVER.up.railway.app \
  --override-username=user@laptop \
  --override-hostname=laptop

The server admin adds the user first via the web UI or kopia server user add user@laptop.

Snapshots

Once connected, take snapshots:

kopia snapshot create /home/user/documents

FAQ

How do I add users?

Open the web UI (basic auth with KOPIA_SERVER_USERNAME/KOPIA_SERVER_PASSWORD), or run kopia server user add user@hostname from a connected admin client. Each user gets their own snapshot space.

Where is my data stored?

All repository data lives at /app/repository on the Railway Volume, encrypted with KOPIA_PASSWORD. Railway never sees plaintext backup contents.

Can I use S3/B2/GCS storage instead of the volume?

Yes. Replace the repository create filesystem call in entrypoint.sh with repository create s3 (or any supported provider) and connect the server to it. The volume then only holds cache and config.

What happens if the volume isn't mounted?

Without a volume the repository is recreated empty on every restart — all backups would be lost. The volume is required.

Is the connection encrypted?

Yes, twice: Railway terminates TLS at the edge, and Kopia's repository-level encryption protects data end-to-end — content is encrypted on the client before upload.

How do I restore a backup?

From any connected client: kopia snapshot list then kopia restore /restore/target. Mounting is also supported: kopia mount /mnt/restore.