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!
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 clean_shutdown 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 fallback_node 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.
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.