EasyXrayEasyXray

Database

EasyXray storage backends — SQLite (default) and PostgreSQL — the database path, connection pool, and SQLite-to-PostgreSQL migration.

EasyXray 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/easyxray/EasyXray.db. Zero setup, ideal for small and medium deployments. The folder is configurable with EASYXRAY_DB_FOLDER (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/easyxray:

/etc/default/easyxray
EASYXRAY_DB_TYPE=postgres
EASYXRAY_DB_DSN=postgres://easyxray:password@127.0.0.1:5432/easyxray?sslmode=disable

Tune the connection pool with EASYXRAY_DB_MAX_OPEN_CONNS and EASYXRAY_DB_MAX_IDLE_CONNS.

Docker

docker compose up -d keeps using SQLite. To run with the bundled PostgreSQL service, uncomment the two EASYXRAY_DB_* lines in docker-compose.yml and start with the profile:

docker compose --profile postgres up -d

Migrate SQLite → PostgreSQL

Move an existing SQLite install to PostgreSQL with the built-in command:

easyxray migrate-db --dsn "postgres://easyxray:password@127.0.0.1:5432/easyxray?sslmode=disable"

Then set EASYXRAY_DB_TYPE and EASYXRAY_DB_DSN in /etc/default/easyxray and restart:

systemctl restart easyxray

The source SQLite file is left untouched — remove it manually only after you've verified the new backend works.

Backups

Whichever backend you use, back it up regularly — see Backup & restore.

On this page