Firefox Sync Server - ArchWiki

Jump to content

# Firefox Sync Server

From ArchWiki

Firefox Sync is a protocol developed by Mozilla to synchronize a browser configuration and profile between different Firefox instances which could run on different platforms (e.g. mobile and desktop). In a default configuration, the user data is encrypted and stored on Mozilla servers.

This page details on how to setup an own Firefox Sync Server and how to configure the client software to use it.

## Server setup

### Installation

mozilla-firefox-sync-serverAUR is available in the AUR.

### Configuration

One file is available to configure a firefox sync server: `/etc/webapps/mozilla-firefox-sync-server/syncserver.ini`. Most options are explained clearly in the official documentation. You might want to change two variables, the accepted domain name (`public_url`) and the database backend (`sqluri`):

    /etc/webapps/mozilla-firefox-sync-server/syncserver.ini

    public_url = https://sync.example.com
    sqluri = sqlite:////var/lib/mozilla-firefox-sync-server/syncserver.db

#### Database

Other databases can be used as backend for the firefox sync server such as MySQL or PostgreSQL instead of SQLite. In order to achieve this it is necessary to add python packages via pip.

For MySQL

    /usr/share/webapps/mozilla-firefox-sync-server/local/bin/pip install PyMySQL

For PostgreSQL

    /usr/share/webapps/mozilla-firefox-sync-server/local/bin/pip install psycopg2

Then appropriate databases and users must be created in the database engine that will be used.

The syncserver.ini file should also be modified to reflect the change of database and it uses the SQLAlchemy syntax.

For MySQL

    /etc/webapps/mozilla-firefox-sync-server/syncserver.ini

    [syncserver]
    sqluri = pymysql://username:password@db.example.com/sync

For PostgreSQL

    /etc/webapps/mozilla-firefox-sync-server/syncserver.ini

    [syncserver]
    sqluri = postgresql://username:password@db.example.com/sync

### Example nginx and uwsgi setup

It is recommended to serve the firefox sync server with uwsgi in a production environment. In this case you have to install uwsgi-plugin-python. Create following uwsgi configuration file:

    /etc/uwsgi/mozilla-firefox-sync-server.ini

    [uwsgi]
    socket = /run/uwsgi/%n.sock
    uid = ffsync
    gid = ffsync
    chdir = /usr/share/webapps/mozilla-firefox-sync-server
    master = true
    plugins = python2
    file = syncserver.wsgi

Enable and start the `uwsgi@mozilla\\x2dfirefox\\x2dsync\\x2dserver` service.

An example Nginx configuration looks something like this:

    /etc/nginx/sites-enabled/sync.example.com

    server {
      server_name sync.example.com;
      access_log /var/log/nginx/sync.example.com.access.log;
      error_log /var/log/nginx/sync.example.com.error.log info;
      server_tokens off;

      client_max_body_size 15M;

      location / {
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/mozilla-firefox-sync-server.sock;
      }
    }

## Client configuration

Note: Since version 1.5 of the protocol, a Firefox Account is required in order to use the synchronization service.

To configure desktop Firefox to talk to your new Sync server, go to `about:config`, search for `identity.sync.tokenserver.uri` and change its value to the URL of your server with a path of `token/1.0/sync/1.5`:

    identity.sync.tokenserver.uri: http://example.com/token/1.0/sync/1.5

Tip: Enter `about:sync-log` in the Firefox URL bar to get a list of logs related to Firefox Sync.

## See also

- Official Mozilla Firefox Sync Server Howto
- Howto with Apache support by Eric Hameleers
- Howto with nginx and systemd support by Timothée Ravier
- Howto with nginx support
- Howto using MySQL
- OwnCloud has mozilla sync server application

Categories:

- Synchronization
- Servers
- Mozilla