Starport

Storage backends

Learn the KV, SQL, and blob roles, the backend settings for each role, and the local files that a shared deployment still needs.

Starport writes durable state to three roles. Each role has its own backend setting, and each backend has its own failure and backup procedure.

The three roles

RoleSettingValuesDefaultHolds
KVSTARPORT_STORAGE_MODEbadger, valkeybadgerKeys, provider credentials, rate limits, presets, usage, file records, accepted catalog generations
SQLSTARPORT_STORAGE_SQL_MODEsqlite, postgres, mysqlsqliteUsers, teams, memberships, and account grants
BlobSTARPORT_FILES_BACKENDfilesystem, objectstorefilesystemThe bytes of uploaded files

The console storage panel shows these roles as Records, Relational, and File bytes.

Why the roles stay separate

Each role has a different access pattern. The KV store holds many small records that each request reads and changes. The SQL store holds the identity plane, which needs relations and transactions. The blob store holds large file bytes. A file record goes to the KV store, and its bytes go to the blob store.

The separation also sets the recovery order. An activation releases the blob store first, the KV store second, and the SQL store last.

The shared recipe

When STARPORT_STORAGE_MODE=valkey, startup applies these rules:

  • The SQL mode must be postgres. MySQL is not permitted with Valkey.
  • The files backend must be objectstore.
  • Valkey cluster mode must stay off. Starport needs one controlled primary.

Badger permits each SQL mode and each files backend.

Badger settings

SettingDefaultEffect
STARPORT_STORAGE_BADGER_PATH<data>/badgerThe database directory
STARPORT_STORAGE_BADGER_SYNC_WRITEStrueWrites each change to disk before the reply. false causes a startup warning.
STARPORT_STORAGE_BADGER_COMPRESSIONsnappynone, snappy, or zstd
STARPORT_STORAGE_BADGER_GC_INTERVAL5mThe interval between value log collection attempts
STARPORT_STORAGE_BADGER_GC_DISCARD_RATIO0.5Must be more than zero and less than one

The engine uses a 256 MiB block cache and five 64 MiB memtables. Only one process can open a Badger directory.

Valkey settings

All names start with STARPORT_STORAGE_VALKEY_.

SettingDefaultEffect
URLvalkey://localhost:6379valkeys:// or rediss:// selects TLS
USERNAME, PASSWORDNoneSupply the password from a secret source
CA_FILENoneTrust roots for this connection. Without it, TLS uses the system roots.
ALLOW_INSECUREfalseA plaintext endpoint needs a loopback host or true
MAX_CONNECTIONS50The maximum number of live sockets
MIN_IDLE_CONNS10Must be less than the maximum
DIAL_TIMEOUT5sThe limit for connection setup and TLS
READ_TIMEOUT, WRITE_TIMEOUT3sThe command deadline
IDLE_TIMEOUT5mThe pool cleanup interval
CLUSTER_MODEfalseMust be false for the shared recipe

The adapter does not retry a failed command. A failed write can have an unknown result. Use the recovery procedure of the operation before you send the change again.

STARPORT_STORAGE_MODE=valkey
STARPORT_STORAGE_VALKEY_URL=valkeys://<valkey-host>:6379/0
STARPORT_STORAGE_VALKEY_USERNAME=<valkey-user>
STARPORT_STORAGE_VALKEY_CA_FILE=/etc/starport/certificates/valkey-ca.pem

SQL settings

STARPORT_STORAGE_SQL_SQLITE_PATH sets the SQLite file. STARPORT_STORAGE_SQL_POSTGRES_URL and STARPORT_STORAGE_SQL_MYSQL_DSN hold service coordinates. Supply a coordinate that contains a password from a secret source. Never write it into a shared file.

Blob settings

SettingDefault
STARPORT_FILES_PATH<data>/files
STARPORT_FILES_MAX_UPLOAD_BYTES536870912
STARPORT_FILES_RETENTION720h
STARPORT_FILES_SWEEP_INTERVAL1h

The object store backend uses STARPORT_FILES_OBJECT_STORE_BUCKET, _REGION, _ENDPOINT, _PREFIX, _ACCESS_KEY_ID, and _SECRET_ACCESS_KEY. It accepts an S3-compatible service, such as Amazon S3, Cloudflare R2, MinIO, or Backblaze B2. An incomplete object store setting stops startup. Refer to the operator guide.

Supported versions

ServiceQualified release
Valkey7.2.14
PostgreSQL16.15

The real-backend qualification covers these releases only. The Valkey qualification covers one standalone writable primary. CI pins each release by image digest. Another release of either service stays UNVERIFIED until a qualification run records it.

Redis, MySQL, and Valkey Cluster are not qualified. Each one needs its own compatibility result. The code does not state a minimum object store version. Test your own service versions before production use.

Local files of a shared deployment

The shared recipe moves the three roles to services. Each gateway process still uses local files:

  • The configuration file, or the environment that replaces it.
  • The CA files for Valkey and the other services.
  • One catalog runtime directory for each instance, under STARPORT_CATALOG_STATE_DIR.
  • The source caches under the cache root.
  • The journal directories of a migration or a recovery.

Give each process its own STARPORT_INSTANCE_ID and runtime directory. Use the same STARPORT_DEPLOYMENT_ID on each replica. A different deployment ID selects different storage.

To list the local files for the selected recipe, run this command:

starport config paths --files

Response cache isolation

The optional response cache needs a separate service from the durable KV store. A database number or a key prefix does not isolate memory, eviction, or failure. Refer to Optional caches.

On this page