Docker Compose on a server
Install Docker with Compose v2, then run the v0.4.0 release bundle on your server. It needs no Git, pulls the published image by digest, and can be verified before you run it:
curl -fLO https://github.com/BerriAI/lens/releases/download/v0.4.0/lens-install-0.4.0.tar.gz
tar xzf lens-install-0.4.0.tar.gz
cd lens-0.4.0
./start
The script generates credentials in deploy/lens/.env and starts Lens with ClickHouse. Sign in at /ui/ by opening Admin token and pasting the LENS_ADMIN_TOKEN value from that file. Stop with docker compose -f deploy/lens/compose.yaml down and restart with ./start. Keep the extracted bundle, environment file and persistent volume
For help configuring an existing deployment, use Set it up for me. To connect the Lens service to an existing gateway, use Add Lens to LiteLLM
Configure the public address
Point a hostname such as lens.example.com at your server and provision its TLS certificate. The initial setup already wrote a LENS_PUBLIC_URL line to deploy/lens/.env. Edit that line instead of adding a second one:
LENS_PUBLIC_URL=https://lens.example.com
Replace the hostname with yours. This controls the browser origin, generated tracing address and secure session cookies. Keep the generated admin token and ClickHouse password unchanged
Apply the configuration
From the extracted lens-0.4.0 directory:
docker compose -f deploy/lens/compose.yaml up -d --wait
The starter binds Lens to 127.0.0.1:4318 and keeps ClickHouse on an internal network. When a reverse proxy runs in another container or host, use the deployment network settings to give it a reachable private Lens address
Route HTTPS traffic
Forward the standalone UI and API paths to Lens. This example uses HAProxy, the same L7 proxy as the LiteLLM gateway example, running on the same host. HAProxy reads the certificate and its private key from one file, so join them first:
sudo mkdir -p /etc/haproxy/certs
sudo sh -c 'cat /etc/letsencrypt/live/lens.example.com/fullchain.pem \
/etc/letsencrypt/live/lens.example.com/privkey.pem \
> /etc/haproxy/certs/lens.example.com.pem'
sudo chmod 600 /etc/haproxy/certs/lens.example.com.pem
Save this configuration with your hostname in the certificate path:
defaults
mode http
timeout connect 5s
timeout client 300s
timeout server 300s
frontend lens_https
bind :443 ssl crt /etc/haproxy/certs/lens.example.com.pem
http-request set-header X-Forwarded-Proto https
option forwardfor
default_backend lens
backend lens
option httpchk GET /health/ready
http-check expect status 200
server lens 127.0.0.1:4318 check
Check and reload HAProxy using your host's service manager. On a systemd host:
sudo haproxy -c -f /etc/haproxy/haproxy.cfg && sudo systemctl reload haproxy
Allow inbound HTTPS on port 443. Keep the database private and preserve the container's shipped filesystem, sandbox and resource settings
Check the installation
Open https://lens.example.com/ui/ using your hostname then open Admin token and paste the generated admin token. Complete the first-trace check from the agent's actual network. If you enabled investigations, verify one bounded investigation as well
Use Back up and restore Lens to retain the data, Keeper state, credentials and exact image together. Store backups outside this server and rehearse a restore. The supported database topology is one ClickHouse server; moving to external storage does not itself provide replication or automatic failover