Firefox Sync on Arch

alt Firefox Sync

As part of my desire to reduce my usage of third parties concerning my online data, I've always wanted to get my own sync server going for Firefox. I had tried this a few different times and had been unsuccessful each time until today. I've mostly been wanting to have one going to further reduce my dependence of third parties in regards to my online data. Of course, this has been mostly been directed at Google but I have extended it to Dropbox and now Mozilla. I don't really have any reasons to dis-trust Mozilla but, the Degooglify attitude shouldn't stop with just Google. If you have the option of fully taking control of your data, I feel that you should. ;)

So, looking at starting a FF Sync Server leads to this documentation that Mozilla has. After reading over it again, I realized that the dev setup is very similar to the basic setup of MediaGoblin that I currently have running here. My MediaGoblin setup is using a python server, running on a port which is then redirected to the sub-domain in the Apache configs, I wrote a little about that recently. The Python Paste server underneath my MediaGoblin install has seemed to work quite well for me so I figured that it'd do fine as I don't plan on having very many users accessing the Sync Server. In the Mozilla docs, it does say that the built-in server shouldn't be used in production due to it not handling a lot of load on it. So far, it seems quite fine with just one user. ;)

Anyway, since I already had the dependencies installed (mercurial, sqlite3, python-virtualenv and python2), I proceeded to clone the source into a directory on my webserver. One note about the dependencies, currently python in Arch is 3.2 and this sync server will need python 2 (it says 2.6 but I built it with 2.7). I checked the 'Makefile' prior to running 'make build' and noticed that I was going to need to add '--python=python2.7' to the virtualenv options on line 42. I also ended up needing to add '--force' to the buildapp options on line 46 before it'd build properly. In the end, it looked like this (also removed the no-site-packages option as it's deprecated):

build:
        $(VIRTUALENV) --python=python2.7 .
        $(INSTALL) MoPyTools
        $(INSTALL) Nose
        $(INSTALL) WebTest
        $(BUILDAPP) --force -c $(CHANNEL) $(PYPIOPTIONS) $(DEPS)

After those changes, it built properly and running 'make test' showed that all was good. I started the server with '.bin/paster serve development.ini' and was able to connect. WooHoo!

Final Configuration

For the final setup, I figured I'd just start with using the Paste server and see how it handled the load. I knew I'd be modifying my MediaGoblin Paste server init script link for this setup as well so starting and stopping the server would be a breeze. I started with the supplied 'development.ini' file and made a few modifications. I changed the host to the internal IP address of my server from being 127.0.0.1. This allows for the Sync server to be accessible from the outside (on the other side of my router). Wasn't necessary but I also changed the port that it would be running on. There is also a path to an error log that I changed to be consistent with the location of the rest of my logs. For the time being, I've left all the other settings as they are. The edited copy of this file I named 'paste.ini' and left it in the root of the Sync server directory. The other file that I edited is './etc/sync'. This file holds quite a few important settings. I changed cleanshutdown to true, turned off the captcha (for now), left it using sqlite for it's database and changed the sqluri path (for both 'storage' and 'auth') so that the database would be in the Sync directory. Also, the fallbacknode setting has to be changed to however you are going to access the server. For me, I changed this to the subdomain that I setup through dyndns.org. I setup apache the same way I did with MediaGoblin. For examples of these files check these links: paste.ini, sync.conf and httpd-vhosts.conf.

Prior to editing my init scrip, I knew that I wanted a separate user to run the Paste server for security reasons. I ended up creating a user named ffsync with:

useradd -d /srv/http/syncserver -r -s /bin/false -U ffsync

I also wanted the PID file to reside in /var/run/ffsyncd and the log file in /var/log/ffsyncd, therefore the init script ended up as this: Link

After tweaking my init script, I started it all and was able to connect Firefox on my various machines and devices. \o/

There are a few of the setting that I want to play with just yet, turn debug off in paste.ini, maybe lower the threadpool_workers some but, it seems to be working quite well so far. One thing that I have noticed is that on my phone and tablet, pulling up the list of tabs from my other computers seems to work quite a bit faster.

If anyone tries all this out and has issues, let me know in the comments below.

[EDIT] I just came across an article in the Arch wiki on the same subject. However, the procedure in this article seems hackish to me. Maybe I need to rewrite the article. ;)

References


Comments:

Kyriakos Brastianos

I think it worths to give it a try. Looks a bit complicated as you can use SyncPlaces with your own server for a simple home-brew sync solution but i guess this is the best option if you want a real Mozilla sync.

2012-05-06 14:23:40

jpope

I think my experience with setting up MediaGoblin made this an easy setup for me. For the most part though, the Python Paste server isn't that bad to work with though. It's getting the Paste server to work with your existing webserver that causes the complication in my opinion.

2012-05-06 15:04:59

Kyriakos Brastianos

Good to know. Thanks for letting us know about your experience Mr. Pope :)
Cheers.

2012-05-06 16:03:05

Chimo

Hey, great article!
I'd forgotten about how you can setup your own sync server like this.
I got mine working on arch + nginx based on this post.
Keep sharing!

2012-05-15 19:48:36

jpope

Glad I could help. :)

(also glad this comment wasn’t another gucci comment attempt. :D )

2012-05-15 19:52:19

sethuper

I have followed step by step in this tutorial, everything is describe, how to install and configure own Firefox Sync Server (Weave) with MySQL.
http://terminal28.com/how-to-install-and-configure-own-firefox-sync-server-weave-debian/

2013-10-14 18:00:25


Have a response to this post? Please use this link.