Sync Server Configuration
To setup ObjectBox Sync Server to your needs, there are various configuration options, which are presented on this page.
Last updated
Was this helpful?
To setup ObjectBox Sync Server to your needs, there are various configuration options, which are presented on this page.
Last updated
Was this helpful?
There are two approaches to configure ObjectBox Sync Server:
command line parameters (CLI): simple/quick approach for most settings
configuration file (JSON): recommended for complex settings and required for clusters
Note that both approaches can be .
Running the Sync Server from the command line is simple way to get started. It's a 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.
Alternatively, you can choose to provide the configuration in a JSON file. This is the preferred choice if the options are getting more complex (e.g. you can checkin the configuration file into version control). Also, it's the only way to configure a .
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:
dbDirectory
directory where the database is stored (default: "objectbox").
dbMaxSize
database size limit; use a number with a unit, e.g. 256G (default: 100G)
K
for kibibytes, i.e. 1024 bytes
M
for mebibytes, i.e. 1024 kibibytes
G
for gibibytes, i.e. 1024 mebibytes
T
for tebibytes, i.e. 1024 gibibytes
modelFile
schema (model) file to create the database with or to use for a schema update
bind
Sync server will bind on this URL (schema, host and port). It should look like ws://hostname:port
, for example ws://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 by ifconfig
or ip addr
, e.g. ws://192.168.0.125:9999
.
adminBind
HTTP server (admin/web UI) will bind on this URL (schema, host and port combination).
adminThreads
number 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).
certificatePath
Supply a SSL certificate directory to enable SSL. This directory must contain the files cert.pem
and key.pem
.
auth.sharedSecret
if not empty, enables the shared secret authentication with the given key
auth.google.clientIds
a list of GoogleAuth client IDs (strings)
unsecuredNoAuthentication
allows connections without any authentication. Note: this is unsecure and shall only be used to simplify test setups.
workers
sets the number of concurrent workers for the main task pool (default is hardware dependent, e.g. 3 times the number of CPU cores).
You can mix both approaches, i.e. have a configuration file and use command line (CLI) options. In this case, CLI options have precedence over the options in the JSON config file. Thus, you can store your base configuration in a file, and override or add settings by providing command line arguments.
To setup a cluster, please refer to the page for specific configuration options.