# Run Litebackup behind your firewall

Litebackup works without internet access. Give the server the URL your
people and machines reach it at, and it never contacts litebackup.com: it
runs in a container, answers plain HTTP behind your own proxy, signs people
in with an email and a password, and runs under a license file you download
once and import. Use it on networks with no outbound access, or when your
platform runs every service in containers behind its own proxy.

The container image `ghcr.io/litebackup/server` is the supported way to run
it. The same image is published as a `docker save` tarball on
litebackup-cdn.com for networks that can't reach ghcr.io:

```bash
curl \
    --fail --silent --show-error --location --remote-name \
    https://litebackup-cdn.com/litebackup/VERSION/litebackup-server-VERSION-linux-amd64.tar
docker load -i litebackup-server-VERSION-linux-amd64.tar
docker tag ghcr.io/litebackup/server:VERSION-amd64 ghcr.io/litebackup/server:VERSION
```

Replace `VERSION` with the release, such as `1.11.0`, here and in the
examples below.

## Get a license

On litebackup.com, add a server with a license file to your team and
download its license. The Free plan works too. The license names the server's instance
ID: a server accepts only licenses for its own ID, and the first license it
imports sets it. Download the license again at any time.

A license is a text block like this one. Only the signed body is trusted;
the header is a description of it. Rewrapped lines, indentation, and
Windows line ends are fine. The server accepts a license issued up to a day
after its own clock; set the clock if it is further behind.

```text
-----BEGIN LICENSE-----
Product: Litebackup
Plan: Business (month)
Instance ID: 01a2...
Valid: 2026-12-01 to 2027-12-01
Revision: 1
Format: 1

eyJrZXlfaWQiOi...
-----END LICENSE-----
```

## Run it behind a proxy

The server listens on port 8080 in the container and keeps its data in the
`/var/lib/litebackup` volume. Your proxy ends TLS and forwards to it with HTTP/2 without
TLS (h2c). Tell the server the URL people and machines use with
`LITEBACKUP_URL` (or `--url`), which is what runs the server this way: it
sets the links the server shows, the origin its forms must come from, and
whether its cookies are Secure.

The server limits failed sign-ins by client address, which it takes from
X-Forwarded-For only when the connection comes from a proxy it trusts:
loopback by default. Name your proxy's address with
`LITEBACKUP_TRUSTED_PROXIES` (addresses or CIDRs), as the example below
does with a fixed address for Caddy. Name only the proxy, not a whole
network: any machine the server trusts can claim any client address.
Until it is set, every client behind the proxy shares one address, and the
server's log says so.

A compose file with Caddy, which gets the certificate:

```yaml
services:
  litebackup:
    image: ghcr.io/litebackup/server:VERSION
    environment:
      LITEBACKUP_URL: https://backup.example.com
      LITEBACKUP_TRUSTED_PROXIES: 172.31.250.10
    volumes:
      - litebackup-data:/var/lib/litebackup
    networks: [backup]
  caddy:
    image: caddy:2.10.2
    ports:
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
    networks:
      backup:
        ipv4_address: 172.31.250.10
networks:
  backup:
    ipam:
      config:
        - subnet: 172.31.250.0/24
volumes:
  litebackup-data:
```

```text
backup.example.com {
	reverse_proxy h2c://litebackup:8080
}
```

Caddy sends X-Forwarded-For on its own. Raise the proxy's timeouts to 15
minutes, because syncs and waiting polls hold requests open. With HAProxy,
use `proto h2` on the server line and `option forwardfor`, or it sends no
client address. A plain `http://` URL works, for a closed lab network, but
every console page then warns that passwords and keys cross the network
unencrypted.

## Set it up

Open the server's URL. Setup takes four steps:

1. **Setup code.** The server prints it to its log at start and writes it to
   `setup-code` in its data directory, so only someone who can read either
   can set the server up. `LITEBACKUP_SETUP_CODE` chooses it instead.
2. **License.** Paste the license or choose its file.
3. **First admin.** An email and a password of at least 12 characters.
4. **Storage.** The same storage wizard as every server: a bucket, the
   recovery kit or passphrase, and retention.

Until a license is imported, machines that sync or join wait. Health checks,
setup, sign-in, and `litebackup server recover` work without one.

### Unattended setup

Set these on the first start and the server skips the setup code, license,
and admin steps; the storage step remains, in the console or with
`litebackup server bucket create` and `litebackup server setup complete`:

| Variable | What it does |
| --- | --- |
| `LITEBACKUP_LICENSE` | The license text itself. |
| `LITEBACKUP_LICENSE_FILE` | A file holding the license. |
| `LITEBACKUP_ADMIN_EMAIL` | The first admin's email. |
| `LITEBACKUP_ADMIN_PASSWORD_FILE` | A file holding the first admin's password. |
| `LITEBACKUP_ADMIN_KEY_FILE` | A file the server writes an admin API key to, for `litebackup admin` in scripts. |

The server runs as uid 65532, so files it reads, such as Compose secrets,
must be readable by it: `chmod 0644`, or `chown 65532`. The admin values
apply only while the server has no user: a restart with
them still set changes nothing, so a key you revoke in the console stays
revoked. A license from `LITEBACKUP_LICENSE` or `LITEBACKUP_LICENSE_FILE` is
imported at every start when it is newer than the one the server has (a
later end date or a higher revision), so a renewal reaches the server by a
restart. An older or broken one is logged and the current license stays.

## Licenses over time

The server stores the license it accepted last in its data directory. Until the
license's end date, its plan's limits apply. In the 30 days before the end
date the console, the log, `litebackup admin` commands, and the
`litebackup_license_state` metric warn. For 14 days after the end date the
limits stay as they were. After that, the server refuses only new
databases: backups, replication, and restores of existing databases keep
working, and nothing ever depends on reaching a license server.

To renew, download the new license from the link on the console's License
page and import it there, or set it in `LITEBACKUP_LICENSE_FILE` and restart. At start, a
license with a higher revision replaces the stored one, and at the same
revision one that ends later; an import on the License page replaces it
whatever it is, so a downgrade applies.

Licenses are not stored in the bucket, which stays independent of any one
server. After `litebackup server recover`, import the license again, or let
`LITEBACKUP_LICENSE_FILE` import it at start.

## Users and passwords

Admins invite people from the console's Users page as on any server. An
invitee opens the link, chooses a password, and is signed in. Sign-in
attempts are limited per email and per address.

To reset a forgotten password, an admin runs this on the server's host,
which reaches the server through its admin socket:

```bash
docker compose exec litebackup litebackup server reset-password admin@example.com
```

To run `litebackup admin` from your own machine, sign in once and approve it
in the browser:

```bash
litebackup admin login --instance https://backup.example.com
```

## Install the CLI on your machines

The server hands out the `litebackup` command itself, so machines on its
network install it without reaching the internet:

```bash
curl --fail --silent --show-error --location https://backup.example.com/cli.sh | bash
```

The installer downloads the binary from the server's `/downloads/` and
checks it against the SHA-256 in the image. A binary the image does not
hold comes from litebackup-cdn.com over HTTPS, without that check. Over a
plain `http://` server URL the check guards only against a damaged
download, not a tampered one. Then join the machine with a join token from the
console, as on any server ([connect your app machines](/sdk-litebackup-client)).

[SDK guides](/sdk-guides) · [Source on GitHub](https://github.com/litebackup/sdk/blob/v1.11.0/docs/litebackup-behind-firewall.md)
