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.com with DNS A/AAAA records pointing at the host. Vela serves from the root of an origin: VELA_PUBLIC_URL cannot 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 vela CLI 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.

ScenarioEnv fileDocker scriptProxyChoose when
fs-directenv/fs.env.exampledocker/run-fs.shnginx/fs-direct.conf, caddy/CaddyfileRecommended start. Go streams contents; any proxy works.
fs-accelenv/fs-accel.env.exampledocker/run-fs-accel.shnginx/fs-accel.confnginx serves local blobs itself. nginx must be able to read the blob directory.
r2env/r2.env.exampledocker/run-r2.shnginx/r2.conf, caddy/CaddyfileContents 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

  1. 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/vela

    Everything Vela stores lives here: vela.db (plus its WAL files), blobs/ and tmp/. In R2 mode only the database stays local. Vela sets permissions explicitly — database 0600, tmp/ 0700, blob directories 0755 and blob files 0644 — so you never have to fix them by hand.

  2. 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.env

    The 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.

  3. Start the container

    Run the scenario script with an explicit image version:

    export VELA_IMAGE=xchunk/vela:0.9.0
    ./examples/docker/run-fs.sh

    The 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.0

    The scripts publish the port on loopback only, refuse moving tags such as :latest, and accept these overrides:

    VariableDefaultMeaning
    VELA_IMAGErequiredImage 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
    healthy

    The delivery field confirms the mode: direct, accel /_blobs/, r2 proxy or r2 redirect.

  4. 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-For and X-Request-ID from the proxy;
    • preserve the query string on the HTTP→HTTPS redirect so signed links keep working.
  5. Trust exactly your proxy

    velad accepts X-Real-IP, X-Forwarded-For and X-Request-ID only from peers in VELA_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 velad sees 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.1
    VELA_TRUSTED_PROXIES=127.0.0.1/32,::1/128,172.17.0.1/32

    Then recreate the container (a restart does not reload --env-file). Alternatively, on Linux, run the container with --network host (drop -p) and set VELA_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.

  6. Create an admin key and log in

    API keys are managed only through velad inside 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-eW2jnoAR0c

    On your workstation:

    vela login --url https://store.example.com
    vela whoami

    Create narrower keys for automation — for example --scope rw --prefix ci/ — rather than sharing the admin key. See API Keys & Scopes.

  7. Verify the deployment

    Work through the post-deployment checks below before storing anything important.

Post-deployment checks

  1. curl -I https://store.example.com/healthz returns 200.
  2. 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
  3. Inspect the public and unlisted URLs with curl -I: you should see the right Content-Type and Content-Disposition, exactly one ETag: "sha256:…", and X-Robots-Tag: noindex, nofollow on the unlisted file. The private file's direct URL must return 404.
  4. Create a short link with vela share check/private.txt --ttl 5m. Fetch it and check Cache-Control: private, no-store; try a Range request and a HEAD too. Treat the URL as a credential: do not paste it into tickets or logs.
  5. Look at the proxy and velad logs: no signatures or query strings, and the client IP is your real address. For accel, confirm no X-Vela-* headers reach clients and that /_blobs/… returns 404 when requested directly.
  6. Delete the test files, confirm they are in the trash, and restore one.
  7. 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

TaskCommand
Follow logsdocker logs -f vela
Healthdocker exec vela velad healthcheck or GET /healthz
List keysdocker exec vela velad key list
Revoke a keydocker exec vela velad key revoke <id>
Run cleanup nowdocker exec vela velad janitor run
Back updocker exec vela velad backup /data/backups/<name>
Rotate link signing keydocker exec vela velad signing rotate
Change configurationEdit /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 Authorization header. 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.