Self-hosting setup and maintenance
start -r sync
, for example docker run powersync start -r sync
.
Only one process can replicate at a time. If multiple are running concurrently, you may see an error [PSYNC_S1003] Sync rules have been locked by another process for replication
.
If you use rolling deploys, it is normal to see this error for a short duration while multiple processes are running.
Memory and CPU usage of the replication container is primarily driven by write load on the source database. A good starting point is 1GB memory and 1 vCPU for the container, but this may be scaled down depending on the load patterns.
Set the environment variable NODE_OPTIONS=--max-old-space-size=800
for 800MB, or set to 80% of the total assigned memory if scaling up or down.
start -r api
, for example docker run powersync start -r api
.
Each API container is limited to 200 concurrent connections, but we recommend targeting 100 concurrent connections or less per container. This may change as we implement additional performance optimizations.
Memory and CPU usage of API containers are driven by:
NODE_OPTIONS=--max-old-space-size=800
for 800MB, or set to 80% of the total assigned memory if scaling up or down.
compact
, for example docker run powersync compact
.
The compact job uses up to 1GB memory for compacting, if available. Set the environment variable NODE_OPTIONS=--max-old-space-size=800
for 800MB, or set to 80% of the total assigned memory if scaling up or down.
/probes/liveness
. This endpoint is expected to have a 200 response when the container is healthy. See Healthchecks for details.
migrate up
, for example docker run powersync migrate up
.
In this case, disable automatic migrations in the config: