How to set up a new Firefox Sync server
If you are using the Firefox web browser you know that you can sync various information so that they become available on all devices that you use.
Sync works out of the box with Mozilla servers, but you can set up your own custom Firefox Sync server as well to use it instead.
The main advantage here is that you have full control over the data at any point in time.
Mozilla switched the sync technology used to synchronize data in Firefox 29. This version is currently available as a Beta version only, but will be rolled out to stable users next month.
I have reviewed the new Sync previously here on Ghacks. The core difference between the old and new version of Sync is that the new requires you to create a Firefox account that is being used to sync the data. The old system where you used keys has been replaced by this.
The new Firefox Sync allows you to set up your own custom server and use it.
Mozilla has published instructions on how this is done here.
- Python 2.7
Installation and setting up
To install all the required components on a fresh Ubuntu server, you would run the following command:
$ sudo apt-get install python-dev git-core python-virtualenv
To build the server, you need to run the following set of commands:
$ git clone https://github.com/mozilla-services/syncserver
$ cd syncserver
$ make build
If you want to test the installation, use the command
$ make test
Once the server has been set up, you need to configure it. Open the file etc/sync.conf and locate the [syncserver] line in the file. It states:
public_url = http://localhost:5000/
While this works for local tests, you should replace the public_url with an url that is remotely accessible so that remote computers can connect to the sync server.
The server uses an in-memory database by default. If you restart it, the data is lost. You can configure a file database instead so that the data is stored permanently instead.
To run the server, you use the following command
$ local/bin/pserve syncserver.ini
Last but not least, you may also want to check for updates regularly:
$ cd /path/to/syncserver
$ git stash # to save any local changes to the config file
$ git pull # to fetch latest updates from github
$ git stash pop # to re-apply any local changes to the config file
$ make build # to pull in any updated dependencies
I suggest you check out the documentation over at the Mozilla website. It contains additional information that you may find useful, for instance how to run the production server.
You need to configure Firefox to use the new sync server:
- Type about:config in the address bar.
- Confirm you are careful.
- Search for services.sync.tokenServerURI
- Double-click the preference to edit its value.
- Replace the value with the sync server url that you have defined with a path of "token/1.0/sync/1.5, e.g. http://sync.example.com/token/1.0/sync/1.5