Firefox Sync Server : create your own Sync Server
Contents
Software version | |
---|---|
Operating System | Debian 7 |
Website | Firefox Sync Server Website |
Last Update | 05/09/2013 |
Others | MariaDB 5.5 |
1 Introduction
Firefox Sync, originally branded Mozilla Weave, is a browser synchronization feature that allows users to partially synchronize bookmarks, browsing history, preferences, passwords, filled forms, add-ons and the last 25 opened tabs across multiple computers.
It keeps user data on Mozilla servers, but the data is encrypted in such a way that no third party, not even Mozilla, can access user information.
Firefox Sync was originally an add-on for Mozilla Firefox 3.x and SeaMonkey 2.0, but it has been a built-in feature since Firefox 4.0 and SeaMonkey 2.1.[1]
2 Prerequisite
First of all, we need to install those dependencies :
aptitude install python-dev mercurial python-virtualenv make gcc |
Then we will install MariaDB.
To install MariaDB, it's unfortunately not embedded in Debian, so we'll add a repository. First of all, install a python tool to get aptkey :
aptitude |
aptitude install python-software-properties |
Then let's add this repository (https://downloads.mariadb.org/mariadb/repositories/) :
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db add-apt-repository 'deb http://mirrors.linsrv.net/mariadb/repo/10.0/debian wheezy main' |
We're now going to change apt pinning to prioritize MariaDB's repository :
/etc/apt/preferences.d/mariadb |
Package: * Pin: release o=MariaDB Pin-Priority: 1000 |
Then install MariaDB :
aptitude |
aptitude update aptitude install mariadb-server |
Now we will need that package also to be able to build the server.
aptitude install libmariadbclient-dev |
3 Installation
We can now get the sources :
hg |
cd /usr/share hg clone https://hg.mozilla.org/services/server-full firefox_sync cd firefox_sync |
And launch the build :
Let's install the latest Python module and Guinicorn (WSGI HTTP Server) :
pip |
./bin/pip install Mysql-Python ./bin/pip install gunicorn |
We are going to create a dedicated user for this application and reset rights :
groupadd firefoxsync useradd -d /usr/share/firefox_sync -g firefoxsync -r -s /bin/bash firefoxsync chown -Rf firefoxsync. /usr/share/firefox_sync |
4 Configuration
Alright, all the installation is now finished. Let's configure everything.
4.1 MariaDB
You need to create a database and user (fit with your informations) :
4.2 Sync Server
Edit the configuration to set database informations :
WARNING |
It's preferable to use SSL connection. If you have autosigned certificates, open manually the URL with firefox to accept them and avoiding errors |
If you're not going to use Nginx, check that your firewall port is open on 5000 port number :
iptables |
iptables -t filter -A INPUT -p tcp --dport 5000 -j ACCEPT |
For more security and if you're going to use a web server like Nginx, it's better to listen only on localhost. In addition, you need to change the 'use' parameter from http to gunicorn. And to finish, you also need to change the log path :
Then let's create those folders :
mkdir -p /var/log/firefoxsync /var/run/firefoxsync chown firefoxsync. /var/log/firefoxsync /var/run/firefoxsync |
You can now try to manually launch the server if you want and sync a user :
paster |
su - firefoxsync -c '/usr/share/firefox_sync/bin/gunicorn_paster /usr/share/firefox_sync/development.ini &' |
Then kill it once you've tested it as we're going to add an init script for it.
4.3 Nginx
Adapt the configuration to your needs :
Then enable it :
ln -s /etc/nginx/sites-available/firefoxsync.deimos.fr /etc/nginx/sites-enabled/ service nginx reload |
4.4 Debian
As there is no init script to launch it automatically on boot, we're going to change that :
Then update it on runlevels and start it :
cd /etc/init.d chmod 755 firefoxsync update-rc.d firefoxsync defaults /etc/init.d/firefoxsync start |
4.5 Logrotate
You will see logs are verbose enough to install a logrotate script :
5 Upgrade
To upgrade the sever, simply run those commands as root :
/etc/init.d/firefox_sync stop cd /usr/share/firefox_sync su - firefoxsync hg pull hg update make build exit /etc/init.d/firefox_sync start |
6 Client
On the client side, there is one account to create and specify the url of the server. Then you could associate all your device to this account.