Configuration
To set up ObjectBox Sync Server to your needs, there are various configuration options, which are presented on this page.
There are two approaches to configure ObjectBox Sync Server:
command line parameters (CLI): simple/quick approach for basic settings (limitations apply)
configuration file (JSON): recommended for complex settings and required for sync filters and clusters
Note that both approaches can be combined (CLI parameters take precedence over file configuration).
Configuration via command line (CLI)
Running the Sync Server from the command line is a simple way to get started. It's a good idea to look at the output of running sync-server --help (your output may vary, e.g. when using a newer version of the Sync Server).
More details about the options can be found in the section on the configuration file. Just note that the naming convention is different (e.g. dbMaxSize instead of db-max-size), but both refer to the same underlying option.
Configuration file
In the long run, you should store the configuration in a JSON file. This is the preferred choice if our options are getting more complex. Also, you can check in the configuration file into version control.
Note that some options are only available in the config file (not the CLI):
By default, the configuration file is read from sync-server-config.json in the current working directory. To use a different location, supply it via the --conf <path-to-config> option.
Some options have a default value, so if you are OK with the default, there is no need to specify it.
Example file for a local development setup (not intended for production use as auth is disabled):
Primary options
dbDirectorydirectory where the database is stored (default: "objectbox").dbMaxSizedatabase size limit; use a number with a unit, e.g. 256G (default: 100G)Kfor kibibytes, i.e. 1024 bytesMfor mebibytes, i.e. 1024 kibibytesGfor gibibytes, i.e. 1024 mebibytesTfor tebibytes, i.e. 1024 gibibytes
modelFileschema (model) file to create the database with or to use for a schema updatebindSync server will bind on this URL (scheme, host and port). It should look likews://hostname:port, for examplews://127.0.0.1:9000. You can also bind to a specific IP address on the server machine by providing the exact address, as given byifconfigorip addr, e.g.ws://192.168.0.125:9999.adminBindHTTP server (admin/web UI) will bind on this URL (schema, host and port combination).
Developer and debug options
unsecuredNoAuthenticationallows connections without any authentication. Note: this is unsecure and should only be used to simplify test setups.logLevelset the runtime log level. Accepted values:all,trace,verbose,debug,info,warn,error,none. Example:"logLevel": "debug". Also available as CLI argument--log-level.debugLog(deprecated) — use"logLevel": "debug"instead. If still present, a warning is logged;logLeveltakes precedence when both are set.noStacksdisable stack traces when logging errors (default:false)
When using debug logs, advanced users can enable additional logs for internal components (e.g. ObjectBox support may ask you to enable specific logs). This is done using boolean flags in the log JSON object (all default to false when omitted).
transactionRead: Log the lifecycle of read transactions (begin/commit/abort).
transactionWrite: Log the lifecycle of write transactions and commits to help diagnose write-related issues.
queries: Log executed queries to aid in understanding which lookups are performed at runtime.
queryParameters: Log parameter values bound to queries. May include sensitive data.
asyncQueue: Log asynchronous operations.
cacheHits: Log cache hits and misses to evaluate cache effectiveness (note: only a few metadata items are cached).
cacheAll: Log all cache operations (puts/gets/evictions); very verbose and intended for deep diagnostics.
tree: Log special tree data models.
exceptionStackTrace: Attempt to include stack traces for certain internal error logs (Linux-only, experimental).
threadingSelfTest: Run a quick threading self-test at startup and log its progress and results.
wal: Enable detailed write-ahead logging (WAL, not used by default) debug output.
idMapping: Log how IDs are mapped between local and global spaces during synchronization.
syncFilterVariables: Log values of sync filter variables per client (e.g. derived from JWT or the login message). May include sensitive data.
Example to enable sync-related debug logs (this quickly gets excessive; don't do this by default):
Authentication options
auth.jwtJWT is the primary method for authentication. See the JWT authentication page for details.
Sync filter expressions
syncFiltersthis JSON object contains all filter expressions. Each filter has the type as key and a string value as the expression. Details are available in the sync filters page.
Client schema validation
The clientSchemaValidation JSON object lets you configure client schema validation behavior. By default, validation is non-strict: clients with unknown schemas can still connect.
strict(boolean; default:false): iftrue, the server rejects clients whose schema hash cannot be resolved to a known, enabled schema version.defaultHash(string): a hex-encoded hash used that identifies the fallback schema for clients with unknown hashes. When set, unknown clients are treated as if they have this schema version, receiving only types known to that version. To get a hash, go to the "Schema Version" Admin page and click on the short hashes of a schema version. This will open a dialog with the full-length hashes (32 characters); copy one of the client hash values. Do not add a0xprefix to the hash, just use the 32 hex characters.
Example ("0123456789abcdef0123456789abcdef" is a placeholder hash; you need to lookup the hash of the schema version you want to use):
For further details about schema versions and client validation, see the data model page.
Sync history size limit
The Sync Server maintains a sync history (sync logs), which is used to synchronize clients that reconnect after being offline. By default, this history grows without limit, which can cause the database to grow indefinitely. To prevent this, you can configure a maximum history size. Once the limit is reached, old history logs are automatically deleted.
historySizeMaxKbmaximum size (in kibibytes) of the sync TX log history. Once this size is reached, old sync logs are deleted to stay below the limit. Default:0(no limit).historySizeTargetKbtarget size (in kibibytes) when cleaning up old TX logs. When the maximum size is reached, old sync logs are deleted until this target size is reached. This allows the Sync Server to reserve some space for future sync logs and thus "delays" the next cleanup. The value must be lower thanhistorySizeMaxKb. Default:0(same ashistorySizeMaxKb, i.e. delete just enough to stay below the limit).
Example configuration to limit history to 5 GB, cleaning up to 4.9 GB (thus triggering cleanup every ~100 MB of sync logs):
Backup and restore (CLI only)
These options are available only via command line arguments (not via JSON config).
--restore-backup <file>restores the database from the given backup file. By default, restoration only takes place if no database exists yet.--backup-overwrites-dbforces the restoration of the backup even if a database already exists. Danger: this permanently overwrites the existing database.
Advanced options
adminThreadsnumber of threads the HTTP server uses (default: 4). A low number is typically enough as it's for admins only. You may need to increase if running in some cloud setups that keep the connections active (e.g. Kubernetes).auth.sharedSecretenables the shared secret authentication. Can be a plain string (the secret) or an object withvalue(the secret) andrequired(boolean; iftrue, clients must provide a shared secret to connect). Example as object:auth.google.clientIdsa list of GoogleAuth client IDs (strings). The enclosingauth.googleobject also accepts arequiredboolean (iftrue, clients must provide Google credentials).auth.obxAdminenables ObjectBox Admin users for sync authentication (e.g. for small deployments and tests). Can betrueor an object with arequiredboolean (iftrue, clients must provide Admin user credentials). Example as object:asyncTxSlotif asynchronous DB transactions are "too fast", this adds a delay (in microseconds) to fill up the transaction slot. This can reduce the maximum amount of transactions and thus disk usage (default: 3000).certificatePathSupply a SSL certificate directory to enable SSL. This directory must contain the filescert.pemandkey.pem.workerssets the number of concurrent workers for the main task pool (default is hardware-dependent, e.g. the number of the reported hardware threads).removeWithoutObjectDataby default, the server includes full object data in sync logs for remove operations, which allows sync filters to filter removes based on object content. Set totrueto disable this and only include the object ID (reduces sync log size but prevents filtering of remove operations).fullSyncMessageSplitMbthreshold (in MiB) at which large full-sync messages are split into smaller chunks. Accepts integer or floating-point values (e.g.8or5.5). Minimum: 1 MiB, default: 4 MiB. Lower values reduce peak memory usage on clients receiving a full sync; higher values reduce per-message overhead. Also, to reduce any "partially synced state," you can increase this value.crasherKeyis not a regular option and is described in a separate document.
Last updated