Deploying Vela
A production Vela is one container, one data directory and a TLS reverse proxy in front. This guide walks through the reference deployment from an empty Linux host to a verified store, using the examples that ship in the repository's examples/ directory.
Who owns whatVela supports velad and its VELA_* configuration. The proxy, TLS certificates, firewall, backups and updates are yours. The examples are well-tested starting points, not managed deployments — replace every CHANGE ME and validate the result for your environment.
Before you begin
- A Linux host with Docker (amd64 or arm64).
- A dedicated hostname such as
store.example.comwith DNS A/AAAA records pointing at the host. Vela serves from the root of an origin:VELA_PUBLIC_URLcannot contain a path, so it needs its own (sub)domain. - nginx or Caddy for TLS. Caddy obtains certificates automatically; for nginx, prepare certificates with the tool of your choice.
- The
velaCLI on your workstation (Installation). - A clone of the repository on the host for the example files:
git clone https://github.com/x-chunk/vela.git.
Choose a scenario
Three scenarios are provided. Each has an env file, a Docker script and a proxy configuration that belong together.
| Scenario | Env file | Docker script | Proxy | Choose when |
|---|---|---|---|---|
| fs-direct | env/fs.env.example | docker/run-fs.sh | nginx/fs-direct.conf, caddy/Caddyfile | Recommended start. Go streams contents; any proxy works. |
| fs-accel | env/fs-accel.env.example | docker/run-fs-accel.sh | nginx/fs-accel.conf | nginx serves local blobs itself. nginx must be able to read the blob directory. |
| r2 | env/r2.env.example | docker/run-r2.sh | nginx/r2.conf, caddy/Caddyfile | Contents in a private R2/S3 bucket; only metadata on local disk. |
If in doubt, start with fs-direct. You can switch to accel later by changing one variable and the proxy configuration, and you can migrate to R2 at any time. The rest of this guide uses fs-direct and points out the differences.
Deploy step by step
-
Prepare the data directory
The container runs as UID/GID 65532 (distroless
nonroot), so the bind-mounted directory must belong to that user:sudo mkdir -p /srv/vela sudo chown 65532:65532 /srv/vela sudo chmod 755 /srv/velaEverything Vela stores lives here:
vela.db(plus its WAL files),blobs/andtmp/. In R2 mode only the database stays local. Vela sets permissions explicitly — database0600,tmp/0700, blob directories0755and blob files0644— so you never have to fix them by hand. -
Write the environment file
Copy the scenario's env file into a private directory and edit it:
sudo install -d -m 0700 /etc/vela sudo install -m 0600 examples/env/fs.env.example /etc/vela/vela.env sudoedit /etc/vela/vela.envThe one value you must change is the public origin:
# CHANGE ME: public origin; required, with no path or trailing slash. VELA_PUBLIC_URL=https://store.example.com VELA_STORAGE=fs # Empty selects direct delivery (Go streams files). VELA_ACCEL_PREFIX=The file lists every applicable setting with its default; see the Configuration reference. Never commit a populated env file — R2 credentials live in it.
-
Start the container
Run the scenario script with an explicit image version:
export VELA_IMAGE=xchunk/vela:0.9.0 ./examples/docker/run-fs.shThe script is equivalent to:
docker run -d --name vela --restart unless-stopped \ --env-file /etc/vela/vela.env \ -p 127.0.0.1:8080:8080 \ --mount type=bind,src=/srv/vela,dst=/data \ -e VELA_STORAGE=fs -e VELA_ACCEL_PREFIX= \ xchunk/vela:0.9.0The scripts publish the port on loopback only, refuse moving tags such as
:latest, and accept these overrides:Variable Default Meaning VELA_IMAGErequired Image with an explicit version tag or digest. VELA_HOST_DATA_DIR/srv/velaHost directory mounted at /data.VELA_ENV_FILE/etc/vela/vela.envEnv file passed with --env-file.VELA_CONTAINER_NAMEvelaContainer name used by docker exec.VELA_HOST_PORT8080Loopback port for the proxy upstream. The container always listens on 8080. Check that it is healthy:
$ docker logs vela {"level":"INFO","msg":"root directory index","index":"on","source":"config"} {"level":"INFO","msg":"velad started","version": "v0.9.0","commit":"36b4360…","listen":"[::]:8080","public_url":"https://store.example.com","data_dir":"/data","delivery":"direct"} $ docker exec vela velad healthcheck && echo healthy healthyThe
deliveryfield confirms the mode:direct,accel /_blobs/,r2 proxyorr2 redirect. -
Put a TLS proxy in front
Install the proxy configuration for your scenario. Follow nginx or Caddy; both guides explain every directive. The essentials:
- stream API request bodies (no request buffering) and keep the body limit equal to
VELA_MAX_UPLOAD; - never log query strings — signed links carry their signatures there;
- set
X-Real-IP,X-Forwarded-ForandX-Request-IDfrom the proxy; - preserve the query string on the HTTP→HTTPS redirect so signed links keep working.
- stream API request bodies (no request buffering) and keep the body limit equal to
-
Trust exactly your proxy
veladacceptsX-Real-IP,X-Forwarded-ForandX-Request-IDonly from peers inVELA_TRUSTED_PROXIES, which defaults to loopback (127.0.0.1/32,::1/128). Client IPs drive the authentication rate limit and appear in logs, so this matters.With a host proxy and Docker's default bridge network, the peer that
veladsees is the bridge gateway, not loopback. Find it and add that single address:$ docker network inspect bridge --format '{{(index .IPAM.Config 0).Gateway}}' 172.17.0.1VELA_TRUSTED_PROXIES=127.0.0.1/32,::1/128,172.17.0.1/32Then recreate the container (a restart does not reload
--env-file). Alternatively, on Linux, run the container with--network host(drop-p) and setVELA_LISTEN=127.0.0.1:8080; the proxy then connects over loopback and the default is already correct.Never trust an entire shared Docker subnet just to make forwarding headers work. Any container on that network could then spoof client IPs to dodge the auth rate limit or inject request IDs into your logs.
-
Create an admin key and log in
API keys are managed only through
veladinside the container. The key is printed to stdout once; the server keeps only its hash.$ docker exec vela velad key create --name workstation --scope admin Created key "workstation": id 7apjsr2yg5, scope admin, prefix (none). Store it now; it cannot be shown again. vela_7apjsr2yg5_Rpnr-qrO1g8AP3FPVFS9mVpIng-pO3Tf-eW2jnoAR0cOn your workstation:
vela login --url https://store.example.com vela whoamiCreate narrower keys for automation — for example
--scope rw --prefix ci/— rather than sharing the admin key. See API Keys & Scopes. -
Verify the deployment
Work through the post-deployment checks below before storing anything important.
Post-deployment checks
curl -I https://store.example.com/healthzreturns200.- Upload a small file in each visibility and compare the downloaded bytes:
vela put test.txt check/public.txt --public vela put test.txt check/unlisted.txt --unlisted vela put test.txt check/private.txt --private vela get check/private.txt - | cmp - test.txt && echo identical - Inspect the public and unlisted URLs with
curl -I: you should see the rightContent-TypeandContent-Disposition, exactly oneETag: "sha256:…", andX-Robots-Tag: noindex, nofollowon the unlisted file. The private file's direct URL must return404. - Create a short link with
vela share check/private.txt --ttl 5m. Fetch it and checkCache-Control: private, no-store; try aRangerequest and aHEADtoo. Treat the URL as a credential: do not paste it into tickets or logs. - Look at the proxy and
veladlogs: no signatures or query strings, and the client IP is your real address. For accel, confirm noX-Vela-*headers reach clients and that/_blobs/…returns 404 when requested directly. - Delete the test files, confirm they are in the trash, and restore one.
- Take a backup and practice restoring it on a scratch host.
A compact version of this list, with the matching commands, is in Security → Production checklist.
Updating
docker exec vela velad backup /data/backups/$(date -u +%Y%m%dT%H%M%SZ)
docker pull xchunk/vela:0.9.0
docker stop vela && docker rm vela
VELA_IMAGE=xchunk/vela:0.9.0 ./examples/docker/run-fs.sh
Migrations run automatically on start. Read the Upgrade Guide for version-specific notes.
Day-to-day operations
| Task | Command |
|---|---|
| Follow logs | docker logs -f vela |
| Health | docker exec vela velad healthcheck or GET /healthz |
| List keys | docker exec vela velad key list |
| Revoke a key | docker exec vela velad key revoke <id> |
| Run cleanup now | docker exec vela velad janitor run |
| Back up | docker exec vela velad backup /data/backups/<name> |
| Rotate link signing key | docker exec vela velad signing rotate |
| Change configuration | Edit /etc/vela/vela.env, then recreate the container |
Every administrative command is described in The velad Server.
Firewall and exposure
- Expose only ports 80 and 443 (the proxy). The container port is bound to
127.0.0.1. - The public side is read-only and the API accepts keys only in the
Authorizationheader. The optional web sign-in is read-only too and rate-limits failed attempts itself. Still, rate limiting at the proxy is a sensible extra layer. - Keep the data directory and backups readable only by root and UID 65532 — the database contains the link signing keys.
Sizing
Vela is light: one process, SQLite with a single writer, and streaming I/O. Plan resources around your traffic rather than Vela itself.
- Disk: the sum of stored files plus trash (14 days by default) plus a 15-minute grace period for replaced content. In R2 mode only the database is local.
- Memory: small in filesystem mode. In R2 mode multipart buffers dominate — about 192 MiB at the defaults with four concurrent uploads. See R2 memory planning.
- Bandwidth: in fs-direct and R2 proxy modes all download bytes pass through
velad; accel moves them to nginx, and R2 redirect moves them to the bucket.