Skip to main content

Setting up a service to synchronize Firefox version 1.5



If you use the Mozilla Firefox (Iceweasel) browser, you probably know about the great opportunity - data synchronization: passwords, bookmarks, settings, add-ons, etc. And having your own server on Linux, you can easily organize your own storage.

In version 1.0, the service was completely replaceable. That is, in the browser settings you could specify the address of your server and account registration, and data storage was performed on your server. But since version 1.5, the synchronization service is only part of the Mozilla services. You can still set up your synchronization service, but account registration will be done through the Mozilly website. And the data will be stored on your server. :)



True, you can start immediately Mozilla Accounts on your server. But this may be considered in the next article.

I also recommend that you necessarily create a user on whose behalf the Firefox synchronization service will be launched.

The content of the article:

Component installation

Install the necessary components:


  # aptitude install python-dev git-core python-virtualenv 

Now you can start building the service from source files. But first you need to copy them with git.

  # git clone https://github.com/mozilla-services/syncserver 

Go to the source folder.

  # cd syncserver 

And collect ...


  # make build 

Sync Server Setup

My website, through which data will be synchronized, works using the https protocol, and nginx acts as a web server. All synchronization requests are proxied from nginx to the synchronization service. Therefore, the configuration parameters will be given with this in mind.

The configuration file is syncserver.ini. Open it in your favorite text editor and change the following settings.

  [syncserver]
 public_url = https://mysite.com/dir/ 

Here you should indicate the address where the synchronization service will be available. Feel free to enter the address of your domain (with https, if supported). You can also specify the path, as in my example.

  sqluri = sqlite: ////path/to/database/file.db 

This is the path to the database file in SQLite format. The data file can be stored in the home directory of the user on whose behalf the service is launched.

Next, you need to specify the secret key. Run the following command in the console:

  # head -c 20 / dev / urandom |  sha1sum 

The command will randomly generate a secret key. Uncomment the secret parameter and specify the received key. For example:

  secret = db8a203aed5fe3e4594d4b75990acb76242efd35 

Bundle with nginx

Now let's organize the work of the synchronization service and nginx.

The [server: main] directive in the syncserver.ini configuration file is converted as follows:

  [server: main]
 use = egg: gunicorn
 host = 127.0.0.1
 port = 5000
 workers = 2
 timeout = 60 

After that, open the nginx configuration file with your site, add the following location there:

  server {
 ...
 location / dir {
 proxy_set_header Host $ http_host;
 proxy_set_header X-Forwarded-Proto $ scheme;
 proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
 proxy_set_header X-Real-IP $ remote_addr;
 proxy_redirect off;
 proxy_read_timeout 120;
 proxy_connect_timeout 10;
 proxy_pass http://127.0.0.1 span000/;
 }
 ...
 } 

And restart nginx. Then start the synchronization service:

  # local / bin / pserve syncserver.ini 

Starting sync server using screen

For the convenience of starting the synchronization service, create in the folder with the service a .sh file with an arbitrary name and write the following there:

  #! / bin / bash
 screen -A -d -m -S ffsync make serve

This will be your startup script. :) It only remains to start it and the service will work in the minimized mode. You can maximize the window with the command screen -x ffsync .

Sync setting in Firefox

In the new tab, open the about: config page by typing the address in the address bar. And find the services.sync.tokenServerURI parameter. In the value of this parameter you will need to specify the address of your server. For example:

  services.sync.tokenServerURI: http://sync.example.com/token/1.0/sync/1.5 

In this case, you should replace here only http://sync.example.com/ . If the synchronization service is configured on your folder, such as http://sync.example.com/dir/, then this path should be specified together with token / 1.0 / sync / 1.5 .

Firefox sync server update

Periodically, the service will need to be updated. And you can update it by executing the following commands in sequence:

  cd / path / to / syncserver
 git stash # save any local to configuration file
 git pull # get the latest updates from github
 git stash pop # reapply local changes from configuration file
 make build # pull out any updated dependencies 

UPD 05/30/2015: As a test, I tried to install firefox sync on the btrfs file system partition. But every time there was a problem with the base in sqlite. I did not observe such an error on the ext4 partition.



How do you rate the article?
Звёзд: 1Звёзд: 2Звёзд: 3Звёзд: 4Звёзд: 5 (No ratings yet)
Loading...

Add a comment

Your email will not be published.