Files
l-ui/docs/content/docs/en/reference/database.mdx
T
Muse 6a5ee8f77b rename: 3x-ui/x-ui -> L-UI/l-ui/lui-agent (paths, services, env, assets)
Display L-UI; panel binary/process l-ui, agent lui-agent.
Dirs /usr/local/l-ui, /etc/l-ui, /var/log/l-ui; DB /etc/l-ui/l-ui.db
(name file drives it via GetName), probe.db beside it, cert
/etc/l-ui/cert, bin /usr/local/l-ui/bin. Services l-ui.service /
lui-agent.service, OpenRC lui-agent, l-ui.sh, cmd/lui-agent.
Env prefix XUI_ -> LUI_ (code reads new prefix only). Release
assets l-ui-linux-* / lui-agent-linux-*; Gitea repo rogue/l-ui is
a placeholder pending user confirmation (see selfupdate.go note).
Go module path github.com/mhsanaei/3x-ui/v3 intentionally kept.
Versions unchanged: panel V2.6.0 / agent A2.5.0.
2026-10-24 12:00:55 +00:00

65 lines
1.8 KiB
Plaintext

---
title: Database
description: L-UI storage backends — SQLite (default) and PostgreSQL — the database path, connection pool, and SQLite-to-PostgreSQL migration.
icon: Database
---
L-UI stores everything — inbounds, clients, settings — in a database. You choose
the backend at install time; both are first-class.
## SQLite (default)
A single file at `/etc/l-ui/l-ui.db`. Zero setup, ideal for small and medium
deployments. The folder is configurable with
[`LUI_DB_FOLDER`](/docs/reference/env-vars#database) (on Windows it defaults next
to the binary).
## PostgreSQL
Recommended for high client counts or multi-node setups. The installer can
install PostgreSQL locally for you, or accept a DSN to an existing server. At
runtime the backend is selected via environment variables, which the installer
writes to `/etc/default/l-ui`:
```bash title="/etc/default/l-ui"
LUI_DB_TYPE=postgres
LUI_DB_DSN=postgres://xui:password@127.0.0.1:5432/xui?sslmode=disable
```
Tune the connection pool with `LUI_DB_MAX_OPEN_CONNS` and
`LUI_DB_MAX_IDLE_CONNS`.
### Docker
`docker compose up -d` keeps using SQLite. To run with the bundled PostgreSQL
service, uncomment the two `LUI_DB_*` lines in `docker-compose.yml` and start
with the profile:
```bash
docker compose --profile postgres up -d
```
## Migrate SQLite → PostgreSQL
Move an existing SQLite install to PostgreSQL with the built-in command:
```bash
l-ui migrate-db --dsn "postgres://xui:password@127.0.0.1:5432/xui?sslmode=disable"
```
Then set `LUI_DB_TYPE` and `LUI_DB_DSN` in `/etc/default/l-ui` and restart:
```bash
systemctl restart l-ui
```
<Callout type="info">
The source SQLite file is left untouched — remove it manually only after you've
verified the new backend works.
</Callout>
## Backups
Whichever backend you use, back it up regularly — see
[Backup & restore](/docs/operations/backup-restore).