Skip to main content
Always run python tools/dbtool.py update before starting any server process. Running the server against an uninitialized or out-of-date database will cause errors.
1

Install MariaDB

2

Create the database and user

Connect to MariaDB as root and create the database:
The default database name (xidb), user (xiadmin), and host (127.0.0.1) match settings/default/network.lua. You can change them, but must update the settings file or environment variables to match.
3

Configure database credentials

The server reads credentials from settings/network.lua (or environment variables). The defaults are:
To override without editing the file, set environment variables:
4

Install Python dependencies for dbtool

dbtool.py manages all database imports and migrations. Install its dependencies:
Or, using a virtual environment:
5

Run the initial database import

Import all SQL files and run any pending migrations:
On first run against an empty database, dbtool.py will:
  1. Detect that the database is empty.
  2. Import all sql/*.sql files in sorted order (ending with triggers.sql).
  3. Check and run all pending migrations from tools/migrations/.
  4. Write the current git commit hash to tools/config.yaml as db_ver.
A successful run ends with:
6

(Optional) Configure dbtool via config.yaml

tools/config.yaml controls dbtool behavior between runs. It is created automatically on first run. Key options:
In Docker, mount this file to preserve state across container restarts:

dbtool.py command reference