How to set up a new Firefox Sync server

Martin Brinkmann
Mar 24, 2014
Updated • Mar 24, 2014
Firefox
|
2

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.

Requirements

  1. Python 2.7
  2. Virtualenv
  3. python-dev
  4. make
  5. git

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:

[syncserver]
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.

Addendum

You need to configure Firefox to use the new sync server:

  1. Type about:config in the address bar.
  2. Confirm you are careful.
  3. Search for services.sync.tokenServerURI
  4. Double-click the preference to edit its value.
  5. 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
Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Nitrox said on March 24, 2014 at 4:20 pm
    Reply

    I think you missed one more important point.

    Once the server is launched, you need to tell Firefox about its location. Go to “about:config”, search for “services.sync.tokenServerURI” and change its value to the URL of your server with a path of “token/1.0/sync/1.5”:

    services.sync.tokenServerURI: http://sync.example.com/token/1.0/sync/1.5

    sync.example.com will need to be replaced with your own domain or IP address that points to your server.

    Source: http://docs.services.mozilla.com/howtos/run-sync-1.5.html

    1. Martin Brinkmann said on March 24, 2014 at 4:25 pm
      Reply

      You are right of course. I’ll add the information to the article. Thanks!

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.