Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Default Configuration for Spanner & MySQL Builds

This page describes the out-of-the-box configuration needed to run the two standard syncstorage-rs builds:

  • MySQL build — the default cargo build / make run_mysql target and the syncstorage-rs-mysql Docker image. Both Syncstorage and Tokenserver run against MySQL.
  • Spanner buildmake run_spanner and the syncstorage-rs-spanner Docker image. This mirrors production: Syncstorage runs against Google Cloud Spanner while Tokenserver runs against MySQL.

Annotated, copy-paste-ready templates live in the repo:

Copy one to config/local.toml and edit the values marked REQUIRED:

cp config/local.example.toml config/local.toml          # MySQL
# or
cp config/local.example.spanner.toml config/local.toml  # Spanner

Every setting can also be supplied as an environment variable prefixed with SYNC_ (nested keys use __). For example syncstorage.database_url becomes SYNC_SYNCSTORAGE__DATABASE_URL. Environment variables take precedence over the config file. The complete list of options and their defaults is in the Application Configuration reference, and the source of truth is the doc-commented Settings structs in the *-settings crates.

Minimum required settings

Most settings have sensible defaults. Regardless of backend you must supply:

SettingWhy
master_secretDerives the Hawk signing/token secrets. No default.
syncstorage.database_urlNo usable default; the server fails fast at startup if unset.
tokenserver.database_urlRequired when tokenserver.enabled = true (fails fast if unset).

Backend-specific notes:

  • MySQL: set tokenserver.node_type = "mysql". Syncstorage MySQL schema migrations run automatically at startup; set tokenserver.run_migrations = true to apply the Tokenserver schema too.
  • Spanner: syncstorage.database_url must use the spanner://projects/.../instances/.../databases/... form — the spanner:// scheme is what selects the Spanner backend. Leave tokenserver.node_type at its default ("spanner"). To run against the local emulator instead of GCP, set syncstorage.spanner_emulator_host (e.g. localhost:9010); for real Spanner, point GOOGLE_APPLICATION_CREDENTIALS at a service-account key.

Run it out of the box with Docker

For a zero-to-running MySQL stack (database + server, schema applied automatically, ready to serve), see the one-shot MySQL docker compose recipe. It brings up MySQL and the server, runs migrations, and bootstraps the storage node so that curl http://localhost:8000/__heartbeat__ succeeds with no further setup.

A Spanner stack cannot be fully zero-config: real Spanner requires GCP credentials, and the local emulator requires extra wiring (see docker/docker-compose.spanner.yaml and make run_spanner).