Flux Shared DB is a solution for persistent, shared database storage on the Flux network. It handles replication between MySQL instances.
Operator nodes discover each other using the FluxOS API and immediately form a cluster. Each Operator node connects to a DB engine through a connection pool. Read queries are proxied directly to the DB engine, while write queries are sent to the master node. The master node timestamps and sequences incoming write queries, then immediately forwards them to slave nodes.

The Operator exposes three interfaces:
To use Flux Shared DB in your project, link it to a DB engine and the Operator handles the rest. A common setup is to run it alongside a DB engine. You can also add your application to the same compose stack and connect directly to the Operator DB port.
mysql.mysql:latest.Commands field: --disable-log-bin.[
"MYSQL_ROOT_PASSWORD=PASSWORD",
"MYSQL_ROOT_HOST=172.0.0.0/255.0.0.0"
]
operator.runonflux/shared-db:latest.s:/app/dumps.Cont. Ports field: [3307,7071,8008].Ports field, map those ports to new ones, for example: [13307,17071,18008].Domains field, add this: ["","",""].[
"DB_COMPONENT_NAME=mysql",
"INIT_DB_NAME=my-db",
"DB_INIT_PASS=PASSWORD",
"DB_USER=root",
"DB_PORT=13307",
"API_PORT=17071"
]
"server=operator:3307;uid=DB_USER;pwd=DB_INIT_PASS;database=INIT_DB_NAME"
Three image variants are published to Docker Hub:
| Image | Contents | Tags | DB component needed? |
|---|---|---|---|
runonflux/shared-db:latest / :dev | Distroless operator only (DB-less) | latest (master), dev (development) | Yes - a separate DB component |
runonflux/shared-db:latest-mysql / :dev-mysql | Operator + MySQL 8 bundled | latest-mysql, dev-mysql | No - DB runs inside the container |
runonflux/shared-db:latest-mariadb / :dev-mariadb | Operator + MariaDB bundled | latest-mariadb, dev-mariadb | No - DB runs inside the container |
dev* tags are built from the development branch, latest* from master.
Pick the DB-less image if you want to run and manage the DB engine as a separate component (setup above). Pick a bundled image for a single self-contained component (setup below). Do not use both approaches for the same deployment.
The bundled images run the DB engine (MySQL 8 or MariaDB) inside the same container as the Operator, so you only register a single component.
operator.runonflux/shared-db:latest-mysql (or runonflux/shared-db:latest-mariadb).DB_COMPONENT_NAME (it defaults to localhost, connecting to the in-container DB).s:/app/dumps|/app/db.
s:/app/dumps holds SQL backups and is synced across instances (the s: flag)./app/db is the DB engine data directory. It must be persistent but node-local (no s: flag) - each node keeps its own copy and replication is handled by the Operator.Cont. Ports field: [3307,7071,8008].Ports field, map those ports to new ones, for example: [13307,17071,18008].Domains field, add this: ["","",""].[
"INIT_DB_NAME=my-db",
"DB_INIT_PASS=PASSWORD",
"DB_USER=root",
"DB_PORT=13307",
"API_PORT=17071"
]
Note: DB_INIT_PASS sets the DB root password on first boot only. Changing it later will not re-key an already-initialized /app/db datadir.
| Variable | Description | Default |
|---|---|---|
DB_COMPONENT_NAME | Hostname for the DB engine component. Required for the DB-less image; leave unset for bundled images (defaults to localhost). | localhost |
INIT_DB_NAME | Initial database name created immediately after initialization | Required |
DB_INIT_PASS | Root password for the DB engine | secret |
DB_USER | Username that can authenticate with the Operator | root |
DB_PORT | External DB port for the DB Interface, first item in the Ports array | Required |
API_PORT | External API port for cluster communication, second item in the Ports array | Required |
WHITELIST | Comma-separated list of IPs that can connect remotely to DB_PORT | Optional |
AUTH_MASTER_ONLY | If set to "true", only the master node authenticates DB access from the app. This is useful if you want to keep a single reachable master node and return an error page to FDM so only the master node is reachable to end users. | false |
Content type
Image
Digest
sha256:36f5f5fcd…
Size
97.2 MB
Last updated
3 days ago
docker pull runonflux/shared-db