Firefox Sync on SheevaPlug ARM

Firefox Sync

From the Firefox Sync website:

Firefox Sync is a service that lets you synchronize your bookmarks,
history, passwords and open tabs with another copy of Firefox - like one
on another computer or on a mobile phone.

Mozilla offers this service for free to all users - but the source code of their sync server is also available. And since I usually prefer to run services that store information about me myself, I decided to set one up.

Minimal Weave (Deprecated, PHP)

Previously I have used the minimal-weave server, but I have always felt it to be a bit incomplete. It is written in PHP and provides a very minimal weave server, as the name implies. It does work, though. I have used it successfully for quite a while.

Lately I have been trying to completely remove PHP from my servers, and minimal weave was the last roadblock. I have already replaced wTorrent with pyroTorrent

These days a much better solution is available, written in Python. I'll just call it New Firefox Sync.

New Firefox Sync

Written in Python, using the SQLAlchemy backend it supports several SQL servers including PostgreSQL, MySQL and SQLite.

Warning

A guide on how to set up the server can be found on the firefox-sync project website. It is not my intention to provide a full installation guide - Mozilla has already done this. I'm just pointing out the problems I ran into.

Setting up the Server

Building the Server

The firefox-sync guide alone did not suffice for me - after the initial hg clone; make build failed.

As it turned out - it took me some time to figure this out - the virtualenv module decided to use Python 3.1, even though my default system python is 2.6.

Luckily, we can point virtualenv in the proper direction:

--- a/Makefile  Tue Aug 16 16:58:30 2011 +0200
+++ b/Makefile  Fri Sep 02 17:40:50 2011 +0200
@@ -39,7 +39,7 @@
 all:   build

 build:
-       $(VIRTUALENV) --no-site-packages --distribute .
+       $(VIRTUALENV) --no-site-packages --distribute . --python=python2.6
        $(INSTALL) MoPyTools
        $(INSTALL) Nose
        $(INSTALL) WebTest

After this, I re-ran make build - and it still failed. It wanted me to commit my Makefile changes. So I committed them with hg commit and re-ran make build - this time the build was successful.

Build on ARM Woes

On x86-64 (64 bit Intel) make build worked.

However, on the ARM Sheevaplug - the computer I wanted to install this on the first place - it had several problems installing just the base Python packages. Luckily, I was able to simply copy my x86-64 folder (in which I just ran make build) to the sheevaplug, working around ever calling make build on sheevaplug.

After I copied it; I replaced the python interpreter binaries in bin/ and replaced all the ARM .so libraries to lib/ and lib64/ with the system ones. (I got them from /usr/lib64/python2.6/lib-dynload/) (Otherwise you won't be able to use the Python in the virtualenv, you need the native modules)

If you've done this all correctly, running ./bin/paster serve development.ini should work.

Running the server

After editing etc/sync.conf, changing the SQLite path to something other than /tmp, editing a few other settings. The server just worked.

However, SQLite as backend has some issues - I got errors like Database Locked and Firefox just didn't sync all my data. After I started using the PostgreSQL database - everything worked fine. Here's the Gentoo Guide on how to setup PostgreSQL.

That's it!

And I was finally able to remove dev-lang/php from my system completely. :-)