copyright 1998-2018 by Mark Verboom
ipv6 ready RSS Feed Schakel naar Nederlands

Go back to What's new

Firefox sync

To blog index

Thursday, 14 July, 2011

Firefox sync

I really like the sync feature of firefox. Having access to the same information in each firefox instance you are using. However, I like to keep that information private, so I prefer to run the sync server on my own system.

Fortunately installing a sync server isn't too difficult. Below is what I did on one of my zones (debian based).

I want to have the software store its information in a mysql database. I already have a database server running. So I first logged in to my database server and created the database called sync.

mysqladmin create sync

Then you need to grant permission on the database for a user. Please use a more secure password then the example below has.

echo "grant ALL on sync.* to sync IDENTIFIED BY 'password';" | mysql mysql

Now to install the software.

First install the prerequisite packages.

apt-get install python-dev mercurial sqlite3 python-virtualenv libmysqlclient-dev

I want to have the software installed in /opt/sync. So create the directory and check out the software

mkdir -p /opt/sync
cd /opt/sync
hg clone https://hg.mozilla.org/services/server-full

Now we need to build the software. I creates a self contained environment.

cd server-full
make build

We also need mysql support, so build that as well.

bin/easy_install Mysql-Python

Now the base software installation is complete. You need to edit the configuration file to point to the sql server and set the right url in the auth section. Edit the file in etc/sync.confg. This is the content of mine.

[captcha]
use = false
public_key = 6Le8OLwSAAAAAK-wkjNPBtHD4Iv50moNFANIalJL
private_key = 6Le8OLwSAAAAAEKoqfc-DmoF4HNswD7RNdGwxRij
use_ssl = false

[storage]
backend = syncstorage.storage.sql.SQLStorage
sqluri = mysql://sync:password@db/sync
standard_collections = false
use_quota = true
quota_size = 5120
pool_size = 100
pool_recycle = 3600
reset_on_return = true
display_config = true
create_tables = true

[auth]
backend = services.auth.sql.SQLAuth
sqluri = mysql://sync:password@db/sync
pool_size = 100
pool_recycle = 3600
create_tables = true
fallback_node = http://web:5000

[smtp]
host = localhost
port = 25
sender = weave@mozilla.com

[cef]
use = true
file = syslog
vendor = mozilla
version = 0
device_version = 1.3
product = weave

So, now the server should be able to start. Try it with:

bin/paster serve development.ini

Now the server should be running. Next task is to configure a firefox instance and see if it will work.

Select Set Up Sync from the Tools menu.

Select Create a New Account

Fill in your account details, and change the sever to reflect your own server.

Now press the Next button

You will now see your sync key. Don't loose this, your stored data on the sync server is encrypted with this key.

Press Next

You should now see a completed screen.

In the window where you have stared the sync server, you will see a lot of output where the firefox client has queried the sync server. You shouldn't see any errors there. Something like this:

2011-07-14 21:24:17,477 INFO [syncserver] 192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "DELETE /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/tabs HTTP/1.1" 200 5 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"
192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "DELETE /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/tabs HTTP/1.1" 200 5 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"
2011-07-14 21:24:17,494 INFO [syncserver] 192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "POST /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/tabs HTTP/1.1" 200 70 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"
192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "POST /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/tabs HTTP/1.1" 200 70 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"
2011-07-14 21:24:17,569 INFO [syncserver] 192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "PUT /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/meta/global HTTP/1.1" 200 13 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"
192.168.1.48 - hprz27nt4vcqnyzxofrmomlx6dhbg4mb [14/Jul/2011:21:24:17 +0200] "PUT /1.1/hprz27nt4vcqnyzxofrmomlx6dhbg4mb/storage/meta/global HTTP/1.1" 200 13 "-" "Firefox/5.0 FxSync/1.8.0.20110615151330.desktop"

Now you're all set.

I run the service behind an apache server in proxy mode with https, so all data is transmitted securely. There are also other options to do this, please take a look at:

http://docs.services.mozilla.com/howtos/run-sync.html

Happy syncing! :)