Website of Daniel A. Mayer

Running Your Own Firefox Sync Server

I have been successfully running my own Mozilla Weave Sync Server for a while. However, after upgrading to Firefox 5 a few days ago, the authentication of Firefox to the server stopped working. Since I got to love the syncing of bookmarks and browsing history between computers, today I decided to upgrade to the new python-based Firefox Sync Server.

Installing Firefox Sync Server

Follow the installation instructions in the official documentation which are quite clear and straight-forward. Once installed, you might encouter the following error:

1
  KeyError: "Unknown fully qualified name for the backend: 'sql'"

As pointed out in this post in the Building Weave blog the /etc/sync.conf in the current code revision is referencing the database backend incorrectly. The correct values are

1
2
3
4
5
[storage]
backend = syncstorage.storage.sql.SQLStorage

[auth]
backend = services.auth.sql.SQLAuth

Configuring and Running the Server Behind Apache

Add a user and group to run the sync server under:

1
2
groupadd ffsync
useradd -g ffsync ffsync

Install mod_wsgi and configure apache to run the sync server using the provided sync.wsgi script.

1
apt-get install libapache2-mod-wsgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<Directory /path/to/sync>
  Order deny,allow
  Allow from all
</Directory>

<VirtualHost \*:80>
  ServerName example.com
  DocumentRoot /path/to/sync
  WSGIProcessGroup sync
  WSGIDaemonProcess sync user=ffsync group=ffsync processes=2 threads=25
  WSGIPassAuthorization On
  WSGIScriptAlias / /path/to/sync/sync.wsgi
  CustomLog /var/log/apache2/example.com-access.log combined
  ErrorLog  /var/log/apache2/example.com-error.log
</VirtualHost>

The sync server uses SQLalchemy to manage its database backend and therefore supports multiple databases. For small installations it is probably fine to use the default sqlite backend. However, the default location for the database is set to /tmp/test.db which is not the best choice for a production system. You can set the path in /path/to/sync/etc/sync.conf.

1
2
3
[auth]
backend = services.auth.sql.SQLAuth
sqluri = sqlite:////path/to/database/data.db

You also have to make sure that the chosen directory is writable by theffsync user.

1
chown ffsync:ffsync /path/to/database/

After this, restarting apache should be all that is required to run the server.

1
/etc/init.d/apache2 restart

References

Comments