Set up private firefox sync server

Firefox sync is very handy, if you use firefox on several computers. Since all data is encrypted before it is sent to the server, I could life with my bookmarks stored on a cloud server. However, it wanted the added security of using my own server. Here's how to install one:

$ apt-get install python-dev mercurial sqlite3 python-virtualenv apache2-mpm-prefork libapache2-mod-wsgi make

Add user ffsync:

$ adduser --group --system --home /usr/local/firefox-sync-server --disabled-password ffsync

Add apache user (www-data) to group ffsync:

$ adduser www-data ffsync

Change user:

$ su - ffsync

Download source files:

$ hg clone https://hg.mozilla.org/services/server-full

Create tmp and data subdirectories

$ mkdir data tmp

Change permissions

$ chmod 770 data tmp

Compile sync server

$ cd server-full
$ make build

Change config files, paths in default install store user data in /tmp, not very useful.

$ vi sync.wsgi
[..]
os.environ['PYTHON_EGG_CACHE'] = ‘/usr/local/firefox-sync-server/tmp/python-eggs’
[..]
$ vi development.ini
[..]
[handler_syncserver_errors]
class = handlers.RotatingFileHandler
args = (‘/usr/local/firefox-sync-server/tmp/sync-error.log’,)
[..]
$ vi etc/sync.conf
[..]
[storage]
backend = syncstorage.storage.sql.SQLStorage
sqluri = sqlite:////usr/local/firefox-sync-server/data/usersettings.db
[..]
[auth]
backend = services.auth.sql.SQLAuth
sqluri = sqlite:////usr/local/firefox-sync-server/data/usersettings.db
[..]
fallback_node = http://sync.mytestdomain.com/
[..]

Change login shell of ffsync to /bin/false.

$ usermod -s /bin/false ffsync

Enable wsgi module

$ a2enmod wsgi

Create new apache virtual host

$ vi /etc/apache2/sites-available/firefox-sync

<VirtualHost *:80>
ServerName sync.mytestdomain.com
ServerAdmin webmaster@mytestdomain.com

DocumentRoot /usr/local/firefox-sync-server/server-full

CustomLog ${APACHE_LOG_DIR}/firefox-sync-server_access.log combined
ErrorLog ${APACHE_LOG_DIR}/firefox-sync-server_error.log

<Directory /usr/local/firefox-sync-server/server-full>
Order deny,allow
Allow from all
</Directory>

WSGIProcessGroup ffsync
WSGIDaemonProcess ffsync user=ffsync group=ffsync processes=2 threads=25
WSGIPassAuthorization On
WSGIScriptAlias / /usr/local/firefox-sync-server/server-full/sync.wsgi
</VirtualHost>

Activate virtual host

$ cd /etc/apache2/sites-enabled
$ ln -s ../sites-available/firefox-sync .

Check config and restart apache

$ apachectl configtest &amp;&amp; /etc/init.d/apache restart

Now you can configure firefox sync with Tools>Sync

Ref: http://www.apfelschwein.net/firefox-sync-now-mit-eigenem-apache-server.html