Recently, I tried to install the Sync Server on a NgInx server but the big Internet could not help me much, so I decided to write this blog entry in an attempt to complete the official documentation.
For those who don’t know, the Sync Server provides passwords, bookmarks and sessions synchronisation features between multiple running Firefox’s instances. In the past, I used other alternatives, such as SyncPlaces, but the lack of integration within Firefox finally pushed me away from this solution.
Setting up Firefox to use Mozilla Foundation’s Sync Server (i.e. as a client) is pretty straightforward and if you don’t mind being dependent of the Mozilla foundation, you might choose to upload your data to their server. Privacy should not be to much of a concern as they (supposedely) encode your personnal information before transfering it to the server. Still, if, like me, you decide to have your own Sync Server (say, for the sake of being independent) you can do so as it is open source. A first version of the Sync Server was in PHP, but thanks to Tarek Ziade a Python server now also exists. Today, only the Python version of the server will be of interest to us.
As I said in the intro, I found out that setting up the Sync Server using NgInx (and Gunicorn) can be tricky, especially when you are new to the tools (as I am).
In a way, you can see this page as a complement to the excellent Sync Server documentation.
So, let’s get started!
First, you need to download the Sync Server:
In order to complete our installation with some important tools, you may want to type in the following command:
Now, let’s take a look at the configuration files. In the developpement.ini file, modify the server:main block so it looks like this:
This configuration will enable gunicorn to listen on the syncserver.sock socket file. You may want you syncserver.sock to be only read/write accessible to your NgInx server, either by relaxing the permission on the file, or by starting the gunicorn_paster with the same group as your Nginx server.
That’s it, this part is done. You can check that everything is in order by starting the Sync server. In the Sync server source directory, type the following:
It should output something similar to this:
On the NgInx side:
Here you can witness some “rewrite” wizardery. I use it because we do not want your sync server to sit on the root of my website. If you want to use the sync server directly at the root of your website, you can remove it.
If you want to automate when the server starts, you could easily make a script out of it. I choose not too, so I won’t document that aspect. However, if you write one, I’ll be interested in knowing which solution you choose.
That’s it for today.