Auto-creates & maintains MySQL range partitions for StackSaga event-stores — zero code.
706
StackSaga SQL Partition Runner (MySQL) automatically creates and maintains the future range partitions of the StackSaga event-store tables (es_transaction, es_transaction_execution_tryout, es_resume_context, es_terminated_transaction) on your MySQL databases.
Instead of building and maintaining a custom Spring Boot application, just run this pre-built image and point it at your databases — no code required. Run one partition runner per database engine; this image is the MySQL one (use stacksaga/partition-runner-postgres for PostgreSQL).
| Tag | Base OS | C Library | Recommended Use |
|---|---|---|---|
stacksaga/partition-runner-mysql:alpinestacksaga/partition-runner-mysql:<version>-alpine | Alpine Linux | musl | Lightweight: minimal footprint, for local, dev and resource-constrained environments. |
stacksaga/partition-runner-mysql:lateststacksaga/partition-runner-mysql:<version> | Ubuntu Jammy | glibc | Production: full glibc, broad compatibility. |
Images are also published to GitHub Container Registry:
ghcr.io/stacksaga/partition-runner-mysql.
TZ=Etc/UTC so the "today" and ahead-count partitions never shift by a day across hosts. Keep your database server on UTC too.ALTER / CREATE on the target schemas (it runs ALTER TABLE … REORGANIZE PARTITION p_max …). Your application services keep DML-only privileges — only this runner needs DDL rights.RANGE-partitioned with a p_max catch-all partition (the StackSaga MySQL reactive support creates them). The runner reorganizes p_max into the upcoming dated partitions.docker run -d --name partition-runner-mysql \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_URL=r2dbc:mysql://db-host:3306/order_db \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_USERNAME=partition_admin \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_PASSWORD=secret \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_UNIT=DAYS \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_AHEAD_COUNT=7 \
stacksaga/partition-runner-mysql:latest
A single runner serves any number of MySQL datasources — add another ..._DATASOURCES_<NAME>_... group per database.
docker run --rm)docker run --rm \
-e STACKSAGA_PARTITIONING_SQL_CRON=none \
-e STACKSAGA_PARTITIONING_SQL_EXIT_ON_COMPLETION=true \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_URL=r2dbc:mysql://db-host:3306/order_db \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_USERNAME=partition_admin \
-e STACKSAGA_PARTITIONING_SQL_DATASOURCES_ORDERDB_PASSWORD=secret \
stacksaga/partition-runner-mysql:latest
The container runs once, creates the upcoming partitions, and exits 0 on success or 1 on failure.
Mount an application.yml at /app/config/application.yml and keep passwords in env/secrets:
stacksaga:
partitioning:
sql:
datasources:
orderdb: { url: "r2dbc:mysql://db-host:3306/order_db", username: partition_admin, unit: DAYS, ahead-count: 7 }
inventorydb: { url: "r2dbc:mysql://db-host:3306/inventory_db", username: partition_admin, unit: MONTH, ahead-count: 1 }
| Environment Variable | Property | Default | Description |
|---|---|---|---|
STACKSAGA_PARTITIONING_SQL_ENABLED | stacksaga.partitioning.sql.enabled | true | Enable/disable the runner. |
STACKSAGA_PARTITIONING_SQL_CRON | …sql.cron | 0 0 12 * * * | Daily schedule. Set to none to disable internal cron (for Kubernetes CronJob). |
STACKSAGA_PARTITIONING_SQL_EXIT_ON_COMPLETION | …sql.exit-on-completion | false | Exit after the startup run (0 success / 1 failure). Set true for one-shot jobs. |
STACKSAGA_PARTITIONING_SQL_RUN_ON_STARTUP | …sql.run-on-startup | true | Create partitions immediately on startup. |
STACKSAGA_PARTITIONING_SQL_VALIDATE_ON_STARTUP | …sql.validate-on-startup | true | Test DB connectivity at startup. |
STACKSAGA_PARTITIONING_SQL_VALIDATE_PRIVILEGES | …sql.validate-privileges | true | Verify ALTER/CREATE privileges at startup. |
STACKSAGA_PARTITIONING_SQL_CONCURRENCY | …sql.concurrency | 4 | Datasources processed in parallel. |
STACKSAGA_PARTITIONING_SQL_CONNECT_TIMEOUT | …sql.connect-timeout | 10s | R2DBC connect timeout. |
STACKSAGA_PARTITIONING_SQL_DATASOURCES_<NAME>_URL | …datasources.<name>.url | — | R2DBC URL, e.g. r2dbc:mysql://host:3306/db. |
STACKSAGA_PARTITIONING_SQL_DATASOURCES_<NAME>_USERNAME | …<name>.username | — | DB user with partition privileges. |
STACKSAGA_PARTITIONING_SQL_DATASOURCES_<NAME>_PASSWORD | …<name>.password | — | DB password. |
STACKSAGA_PARTITIONING_SQL_DATASOURCES_<NAME>_UNIT | …<name>.unit | DAYS | Interval unit: DAYS, WEEK, MONTH, YEAR. |
STACKSAGA_PARTITIONING_SQL_DATASOURCES_<NAME>_AHEAD_COUNT | …<name>.ahead-count | 1 | Future intervals to pre-create. |
Use lowercase-alphanumeric datasource names (
orderdb,inventorydb) so the env-var mapping is unambiguous.
docker pull stacksaga/partition-runner-mysql:latest