A simple Docker container and Docker Compose configuration to get started with mozilla-services/syncstorage-rs to self-host a Firefox sync server.
I didn't have much luck with the existing documentation and wrote this for my own infrastructure. There's no guarantee it will work for you.
So far these steps have been shown to work on Debian based distros including Raspbian and Debian Bullseye.
To get started clone this repository. You will need to have Docker and Docker Compose installed.
The Docker Compose file makes use of environment variables. To configure them, make a copy of example.env
cp example.env .envNow edit the new .env file to add configuration and secrets. Keep in mind the SYNC_MASTER_SECRET and METRICS_HASH_SECRET require 64 characters.
docker compose up -d --build && docker compose logs -fThe first time you run the application, it will do a few things:
-
MariaDB container will be pulled and on first run it will load the
./data/init/init.sqlscript that creates the required databases and user permissions. This will only run during the initial setup. -
Next the Dockerfile will build the syncserver app. This is a Rust app and all of the required dependencies will be loaded into the environment, as well as cloning the Mozilla syncstorage-rs repo. This will take several minutes.
-
Once everything is compiled and configured you should see startup logs begin to appear. Subsequent runs of
docker compose up -dwill happen much faster because the build artifacts are cached. Data is persisted in the database (./data/config) between restarts.
In the course of setting this up, you may need to tear down and rebuild your instance. To remove persisted data and artifacts, run the following.
docker compose down
docker image rm app-syncserver
docker builder prune -af
rm -rf ./data/configThis will delete the compiled Rust app and any cached layers, and also delete the database data.
Once your app is running, you can configure Firefox by updating the about:config settings.
identity.sync.tokenserver.uri needs to be set to the SYNC_URL configured in your .env file followed by /1.0/sync/1.5.
To confirm the sync is working you can enable success logs in about:config also. Set services.sync.log.appender.file.logOnSuccess to true. Now you should see sync logs in about:sync-log
Syncing is usually very quick, and when a sync occurs you can see logs in docker compose logs -f also.