Deploy to your own server
FlarePanel runs on one Linux machine with Docker: ClickHouse for events, Redis for buffers and queues, Redpanda for the event stream, one container for the API and background jobs, and one for the dashboard. Everything needed is in the self-hosting folder of the repository. For how this compares with the Cloudflare install, see Choose how to self-host.
Requirements
- A Linux server with Docker and the Compose plugin, 4 GB of memory or more (ClickHouse and Redpanda take most of it) and a disk sized for your events.
- Two hostnames pointing at the server, one for the dashboard and one for the
API, for example
analytics.example.comandapi.analytics.example.com.
Install
Get this folder. The two FlarePanel images are published, for amd64 and
arm64, so there is nothing to build:
git clone https://github.com/flarepanel-dev/flarepanel.git
cd flarepanel/self-hosting
cp env.example .envEdit .env:
- Set
DASHBOARD_URL,API_URL,DASHBOARD_HOST,API_HOSTandCUSTOM_COOKIE_DOMAINto your hostnames. - Fill
COOKIE_SECRETandENCRYPTION_KEY, each with the output ofopenssl rand -hex 32. Keep a copy ofENCRYPTION_KEY: without it, stored AI and integration keys cannot be read.
Start everything, with the bundled TLS proxy:
docker compose --profile proxy up -dOpen the dashboard address and create the first account. With
ALLOW_REGISTRATION=false (the default here) everyone after that needs an
invitation.
Your own proxy
Leave out --profile proxy. The dashboard then listens on 127.0.0.1:3300
and the API on 127.0.0.1:3333; point your proxy at them. The API serves
WebSockets under /live/, so the proxy must pass upgrade requests through.
Point your SDKs at it
Use your API address as apiUrl and load the script from your dashboard:
<script src="https://analytics.example.com/op1.js" defer async></script>Upgrade
git pull
docker compose --profile proxy pull
docker compose --profile proxy up -dThe migrate service applies database changes before the app starts. Back up
first (below).
The images
| Image | Runs |
|---|---|
ghcr.io/flarepanel-dev/flarepanel-api | The API and background jobs |
ghcr.io/flarepanel-dev/flarepanel-dashboard | The dashboard |
They are built by this repository's Docker images workflow from a clean
checkout, with no build secrets, and run as a non-root user. latest follows
main; a release also gets its version (1.2.3, 1.2). Each image carries a
signed build record, which you can check with the GitHub CLI:
gh attestation verify oci://ghcr.io/flarepanel-dev/flarepanel-api:latest -R flarepanel-dev/flarepanelTo build them yourself instead (the dashboard build needs about 6 GB of
memory), run this from the repository root and name the results in .env
(FLAREPANEL_API_IMAGE, FLAREPANEL_DASHBOARD_IMAGE):
docker build -f apps/api/Dockerfile -t flarepanel-api:local .
docker build -f apps/start/Dockerfile -t flarepanel-dashboard:local .Check an install
On a fresh install, before the first account exists and before SMTP is set (the script signs up without confirming an email):
API_URL=https://api.analytics.example.com DASHBOARD_URL=https://analytics.example.com ./smoke-test.shIt creates a test account and project, sends five events and reads them back.
Use the same addresses as in .env. It leaves the test account behind.
Back up and restore
./backup.sh # writes ./backups/flarepanel-<UTC time>/
./backup.sh /mnt/backups # or into another folder
./restore.sh ./backups/flarepanel-20261127-101500A backup holds the SQLite file (accounts, projects, settings) and a ClickHouse
backup (events, sessions, profiles, replays). It runs while the app is up.
Queues in flight (Redis, Redpanda) are not part of it, so events that arrive
during the backup may be missing. Run it on a schedule, copy the folder off
the server, and keep .env with it: ENCRYPTION_KEY is needed to read stored
keys after a restore.
restore.sh stops the app, replaces both databases with the backup and starts
it again. It asks before it overwrites anything.
Keep events for a limited time
ClickHouse keeps events until you say otherwise (replay chunks are kept 30 days, AI prompt text 30 days). To drop events and sessions after, say, 400 days:
docker compose exec clickhouse clickhouse-client -q \
"ALTER TABLE flarepanel.events MODIFY TTL toDateTime(created_at) + INTERVAL 400 DAY"
docker compose exec clickhouse clickhouse-client -q \
"ALTER TABLE flarepanel.sessions MODIFY TTL toDateTime(created_at) + INTERVAL 400 DAY"ALTER TABLE flarepanel.events REMOVE TTL undoes it. Rows already deleted do
not come back.
Behind a proxy
The API reads the visitor's address from the header named in
TRUSTED_IP_HEADER_ORDER (default x-forwarded-for). It feeds the location
lookup and the tracking limit of 600 requests a minute per address. Your proxy
must overwrite that header, never pass on a value the visitor sent; the
bundled Caddy does.