Difference between revisions of "Mozilla Firefox Sync Server"

From ArchWiki
Jump to: navigation, search
(Automatic Startup of the Server)
(Version 1.5: Move personal remark to discussion page)
 
(25 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Web Server]]
+
[[Category:Web server]]
This page is about special operations required in order to install Mozilla Sync Server.
+
{{Poor writing|Various [[Help:Style|style]] problems. Personal comments should go in the Discussion page.}}
 +
From [[Wikipedia:Firefox_Sync|Wikipedia]]:
 +
: ''Firefox Sync, originally branded Mozilla Weave, is a browser synchronization feature that allows users to partially synchronize bookmarks, browsing history, preferences, passwords, filled forms, add-ons and the last 25 opened tabs across multiple computers.''
  
Newer versions of Mozilla Firefox feature bookmarks, passwords, settings and browsing history synchronization between all your computers and devices. Mozilla Foundation provides a public Sync server, but you can host your own one if you want.
+
: ''It keeps user data on Mozilla servers, but the data is encrypted in such a way that no third party, not even Mozilla, can access user information. It is also possible for the user to host their own Firefox Sync servers, or indeed, for any entity to do so.''
==Prerequisites==
+
 
===Dependencies===
+
This page details how you should proceed to host your own (Mozilla) Firefox Sync Server (shortened to FFSync), version 1.1 or version 1.5, and how to host your own Firefox Account server.
Before proceeding, you need to [[pacman|install]] {{pkg|python2}}, {{pkg|python2-virtualenv}}, {{pkg|sqlite3}}, {{pkg|mercurial}} and {{pkg|make}}, all available in the [[official repositories]].
+
 
===Accessibility===
+
{{Note| The 1.1 version of the Mozilla Firefox Sync Server has been deprecated in Firefox 29 and support has been removed from version 32. Version 1.5 of the Mozilla Firefox Sync Server is available for Firefox 29+. However, this now requires users create a Firefox Account. See the following links for details:
If you intend to use your server with itinerant clients, you should install it on an Internet reachable computer.
+
* https://wiki.mozilla.org/Identity/Firefox_Accounts
===Administration Rights===
+
* https://blog.mozilla.org/blog/2014/02/07/introducing-mozilla-firefox-accounts/
All installation instructions are commands relying on the superuser privileges, so open a terminal and type:
+
* https://blog.mozilla.org/services/2014/02/07/a-better-firefox-sync/
{{bc|
+
* https://blog.mozilla.org/futurereleases/2014/02/07/test-the-new-firefox-sync-and-customize-the-new-ui-in-firefox-aurora/
$ su -
+
Password:  
+
#
+
 
}}
 
}}
 +
{{Note| The 1.1 and 1.5 versions are currently conflicting for simplicity but one could have the two versions alongside on the same server with some changes. The databases should probably not be shared between different versions however.}}
 +
{{Tip| Enter {{ic|about:sync-log}} in the Firefox URL bar to get a list of logs related to Firefox Sync.}}
  
==Installation==
+
==Version 1.5==
Mozilla Sync Server depends on Python 2 during installation. Arch Linux provides Python 3 as default Python version so there are special tweaks needed before running Mozilla Sync Server setup.
+
Setup process creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.
+
===Python preparation===
+
Mozilla Sync Server setup needs Python 2.6 or newer. In default configuration, {{ic|/usr/bin/python}} is a symbolic link to {{ic|/usr/bin/python3}} whereas Python 2 is {{ic|/usr/bin/python2}}.
+
  
Before running setup, we must check the link and change it if necessary:
+
This is for Firefox version 29 and onward.
{{bc|
+
# cd /usr/bin
+
# ls -l python
+
  
    lrwxrwxrwx 1 root root 7  5 sept. 07:04 python -> python3
+
===Installation===
  
# ls -l virtualenv
+
{{AUR|mozilla-firefox-sync-server-git}} is available in the [[AUR]].
  
    ls: cannot access virtualenv: No such file or directory
+
The setup creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.
  
# ln -sf python2 python
+
===Server configuration===
# ln -sf virtualenv2 virtualenv
+
}}
+
  
===Setup===
+
One file is available to configure a FFsync server: {{ic|/opt/mozilla-firefox-sync-server/syncserver.ini}}. Most options are explained clearly in the [http://docs.services.mozilla.com/howtos/run-sync-1.5.html official documentation]. Here is a full example with comments:
Installation instructions:
+
{{bc|
+
# mkdir -p /opt/weave
+
# cd /opt/weave
+
# hg clone https://hg.mozilla.org/services/server-full
+
  
      ... source repository cloning messages ...
+
{{bc|1=
 +
# Use a Unix socket and the Gunicorn server
 +
[server:main]
 +
use = egg:gunicorn#main
 +
bind = unix:/run/ffsync/syncserver.sock
 +
workers = 2
 +
timeout = 60
 +
syslog = true
 +
syslog_prefix = ffsync
 +
syslog_facility = daemon
 +
 
 +
[app:main]
 +
use = egg:syncserver
  
# cd server-full
+
[syncserver]
# make build
+
# This must be edited to point to the public URL of your server,
 +
# i.e. the URL as seen by Firefox.
 +
public_url = <nowiki>http://example.com/ffsync/</nowiki>
  
      ... many build messages, including harmless warnings ...
+
# This defines the database in which to store all server data.
 +
sqluri = sqlite:////var/lib/ffsync/sync_storage.db
  
      ... end of the successful build messages:
+
# This is a secret key used for signing authentication tokens.
 +
# It should be long and randomly-generated.
 +
# The following command will give a suitable value on *nix systems:
 +
#
 +
#    head -c 20 /dev/urandom | sha1sum
 +
#
 +
# If not specified then the server will generate a temporary one at startup.
 +
secret = AZERTYUIOPQSDFGHJKLMWXCVBN
  
Building the app
+
# Set this to "false" to disable new-user signups on the server.
  Checking the environ  [ok]
+
# Only request by existing accounts will be honoured.
  Updating the repo  [ok]
+
allow_new_users = true
  Building Services dependencies
+
    Getting server-core    [ok]
+
    Getting server-reg    [ok]
+
    Getting server-storage    [ok]  [ok]
+
  Building External dependencies  [ok]
+
  Now building the app itself  [ok]
+
[done]
+
  
 +
# Uncomment and edit the following to use a local BrowserID verifier
 +
# rather than posing assertions to the mozilla-hosted verifier.
 +
# Audiences should be set to your public_url without a trailing slash.
 +
#[browserid]
 +
#backend = tokenserver.verifiers.LocalVerifier
 +
#audiences = <nowiki>https://localhost:5000</nowiki>
 
}}
 
}}
  
Check the end of the build messages, they should state "[done]". Otherwise, look at the first error messages, they give you hints on the problem and how to solve it.
+
===Running behind nginx===
  
===Python initial state restoration===
+
A sample from the nginx config:
Once the build is finished, restore the links in {{ic|/usr/bin}} to their original state.
+
 
{{bc|
+
{{bc|1=
# cd /usr/bin
+
        # Firefox sync config
# ln -sf python3 python
+
        location /ffsync/ {
# rm -f virtualenv
+
            rewrite  ^/ffsync(.+)$ $1 break;
 +
            proxy_pass <nowiki>http://unix:/run/ffsync/syncserver.sock;</nowiki>
 +
            proxy_set_header Host $http_host;
 +
            proxy_set_header X-Real-IP $remote_addr;
 +
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 +
            proxy_set_header X-Forwarded-Proto $scheme;
 +
            proxy_redirect off;
 +
            proxy_read_timeout 120;
 +
            proxy_connect_timeout 10;
 +
            gzip        off;
 +
        }
 
}}
 
}}
  
==Configuration==
+
===Client configuration===
===Server-side configuration files===
+
Configuration files are used to define where databases and logs will be created.
+
We will place databases in {{ic|/opt/weave/data}} and log files in {{ic|/var/log/weave}}, so we must create the directories.
+
# mkdir /opt/weave/data /var/log/weave
+
  
At least two configuration files must be changed in {{ic|/opt/weave/server-full}} in order to reflect these choices: {{ic|development.ini}} and {{ic|etc/sync.conf}}.
+
To configure desktop Firefox to talk to your new Sync server, go to {{ic|about:config}}, search for {{ic|services.sync.tokenServerURI}} and change its value to the URL of your server with a path of {{ic|token/1.0/sync/1.5}}:
 +
{{bc|1=
 +
services.sync.tokenServerURI: <nowiki>http://example.com/ffsync/token/1.0/sync/1.5</nowiki>
 +
}}
  
In {{ic|development.ini}}, locate the line:
+
===Firefox Account Server===
 +
 
 +
Until this section is completed, you will have to use the official Firefox Accounts service provided by Mozilla. You can try running your own by following the instructions from the [http://docs.services.mozilla.com/howtos/run-fxa.html official documentation].
 +
 
 +
==Version 1.1==
 +
 
 +
This is for Firefox version up to but not including version 32.
 +
 
 +
===Installation===
 +
 
 +
{{AUR|mozilla-firefox-sync-server-hg}} is available in the [[AUR]].
 +
 
 +
The setup creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.
 +
 
 +
===Server configuration===
 +
 
 +
Two files are used to configure a FFsync server: {{ic|/opt/mozilla-firefox-sync-server/development.ini}} and {{ic|/opt/mozilla-firefox-sync-server/etc/sync.conf}}.
 +
 
 +
====Basic configuration====
 +
 
 +
The fallback node URL must reflect the server's visible URL (here {{ic|<nowiki>https://example.com/ffsync/</nowiki>}}). In {{ic|/opt/mozilla-firefox-sync-server/etc/sync.conf}}, change:
 
{{bc|1=
 
{{bc|1=
args = ('/tmp/sync-error.log',)
+
[nodes]
 +
fallback_node = <nowiki>http://localhost:5000/</nowiki>
 
}}
 
}}
and change it to:
+
to:
 
{{bc|1=
 
{{bc|1=
args = ('/var/log/weave/sync-error.log',)
+
[nodes]
 +
fallback_node = <nowiki>https://example.com/ffsync/</nowiki>
 
}}
 
}}
  
In {{ic|etc/sync.conf}}, locate the line:
+
====Disable debug mode====
 +
 
 +
In {{ic|/opt/mozilla-firefox-sync-server/development.ini}}, set:
 
{{bc|1=
 
{{bc|1=
sqluri = sqlite:////tmp/test.db
+
[DEFAULT]
 +
debug = False
 
}}
 
}}
and change it to:
+
 
 +
====Set email====
 +
 
 +
In {{ic|/opt/mozilla-firefox-sync-server/etc/sync.conf}}, set:
 
{{bc|1=
 
{{bc|1=
sqluri = sqlite:////opt/weave/data/sync.db
+
[smtp]
 +
sender = ffsync@example.com
 
}}
 
}}
This statement appears twice in the file, both should be modified.
 
  
Bump the disk quota from 5 to 25 MB:
+
====Storage backend====
 +
 
 +
The default storage backend is sqlite which should be fine if you do not have a lot of users. To split the various databases into several files, edit the {{ic|sqluri}} fields in {{ic|/opt/mozilla-firefox-sync-server/etc/sync.conf}}.
 +
 
 +
The [http://docs.services.mozilla.com/howtos/run-sync.html Official FFsync server Howto] details setup with MySQL or LDAP as a backend.
 +
 
 +
====Disk quota====
 +
 
 +
The default disk quota is quite restrictive and will quickly be filled if a lot of bookmarks are stored. Bump the disk quota from 5 to 25 MB in {{ic|/opt/mozilla-firefox-sync-server/etc/sync.conf}}:
 
{{bc|1=
 
{{bc|1=
quota_size = 25600
+
[storage]
 +
...
 +
quota_size = 25600
 +
...
 
}}
 
}}
The fallback node URL must reflect the server's hostname (here {{ic|server-name.domain-name}}).
+
 
Change:
+
====Running behind a Web Server====
 +
 
 +
The default configuration runs a built-in server which should not be used in production.
 +
 
 +
=====Apache combined with mod_wsgi=====
 +
 
 +
See the [http://docs.services.mozilla.com/howtos/run-sync.html Official FFsync server Howto].
 +
 
 +
=====nginx with Gunicorn=====
 +
 
 +
The [[PKGBUILD]] available in the [[AUR]] installs the Gunicorn server, in the python {{ic|virtualenv}}, by default. Enable it by changing the following lines in {{ic|/opt/mozilla-firefox-sync-server/development.ini}}:
 +
 
 
{{bc|1=
 
{{bc|1=
fallback_node = <nowiki>http://localhost:5000/</nowiki>
+
[server:main]
 +
use = egg:gunicorn#main
 +
host = unix:/run/ffsync/syncserver.sock
 +
use_threadpool = True
 +
threadpool_workers = 60
 
}}
 
}}
to:
+
 
 +
Create the {{ic|/etc/tmpfiles.d/ffsync.conf}} file to create the {{ic|/run/ffsync/}} folder at boot:
 
{{bc|1=
 
{{bc|1=
fallback_node = <nowiki>http://server-name.domain-name:5000/</nowiki>
+
D /run/ffsync 0750 ffsync http
 
}}
 
}}
  
===Unprivileged User===
+
Create this folder now by running:
It is a good practice to run daemons as an unprivileged user. Create the group {{ic|weave}} and the user {{ic|sync}} for that purpose:
+
{{bc|1=
{{bc|
+
# systemd-tmpfiles --create ffsync.conf
# groupadd weave
+
# useradd -d /opt/weave -g weave -r -s /bin/bash sync
+
 
}}
 
}}
This new user must have read and write access on every file in {{ic|/opt/weave}} and {{ic|/var/log/weave}}
 
# chown -R sync:weave /opt/weave/*
 
# chown -R sync:weave /var/log/weave
 
  
===Automatic Startup of the Server===
+
Enable and start the Gunicorn serveur using the systemd service unit provided in {{AUR|mozilla-firefox-sync-server-hg}}:
In order to make the Sync Server start automatically at boot-time, create a startup script:
+
{{bc|1=
{{hc|
+
# systemctl enable ffsync
/etc/rc.d/mozillaweave|<nowiki>
+
# systemctl start ffsync
#!/bin/bash
+
}}
  
RUNDIR=/var/run/weave
+
Use this config extract to configure nginx:
DAEMON=/opt/weave/bin/python
+
{{bc|1=
PIDFILE=/var/run/weave.pid
+
# Firefox sync config
MESSAGELOG=/var/log/weave/sync-messages.log
+
location /ffsync/ {
 +
    rewrite  ^/ffsync(.+)$ $1 break;
 +
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 +
    proxy_set_header Host $http_host;
 +
    proxy_redirect off;
 +
    proxy_pass <nowiki>http://unix:/run/ffsync/syncserver.sock</nowiki>;
 +
}
 +
}}
  
. /etc/rc.conf
+
====Not recommended setup with default web server====
. /etc/rc.d/functions
+
  
PID=`pidof -x -o %PPID paster`
+
{{Style|vague statement ("outdated"), see [[Help:Style#Language register]]}}
case "$1" in
+
  start)
+
    stat_busy "Starting Mozilla Sync Server"
+
    [ -d $RUNDIR ] || mkdir $RUNDIR
+
    [ -z "$PID" ] && su sync -c "cd /opt/weave/server-full && bin/paster serve development.ini &>$MESSAGELOG &"
+
    if [ $? -gt 0 ]; then
+
      stat_fail
+
    else
+
      PID=`pidof -x -o %PPID paster`
+
      echo $PID >$PIDFILE
+
      add_daemon weave
+
      stat_done
+
    fi
+
    ;;
+
  stop)
+
    stat_busy "Stopping Mozilla Sync Server"
+
    [ ! -z "$PID" ]  && kill $PID &>/dev/null
+
    if [ $? -gt 0 ]; then
+
      stat_fail
+
    else
+
      rm_daemon weave
+
      stat_done
+
    fi
+
    ;;
+
  restart)
+
    $0 stop
+
    $0 start
+
    ;;
+
  *)
+
    echo "usage: $0 {start|stop|restart}" 
+
esac
+
exit 0
+
</nowiki>
+
}}
+
The script must have execution rights:
+
# chmod 755 /etc/rc.d/mozillaweave
+
Start the Sync Server at boot by including {{ic|mozillaweave}} in the [[Daemon]] list. It depends on the network so it should be placed accordingly.
+
  
For systemd:
+
(Outdated) systemd service unit:
 
{{hc|
 
{{hc|
/etc/systemd/system/mozillaweave.service|<nowiki>
+
/etc/systemd/system/ffsync.service|<nowiki>
 
[Unit]
 
[Unit]
Description=Mozilla Weave
+
Description=Mozilla Firefox Syn Server
 
After=network.target
 
After=network.target
  
 
[Service]
 
[Service]
 
Type=simple
 
Type=simple
User=sync
+
User=ffsync
WorkingDirectory=/opt/weave/server-full
+
Group=ffsync
ExecStart=/opt/weave/server-full/bin/python2 /opt/weave/server-full/bin/paster serve /opt/weave/server-full/development.ini
+
WorkingDirectory=/opt/mozilla-firefox-sync-server
StandardOutput=/var/log/weave/sync-messages.log
+
ExecStart=/opt/mozilla-firefox-sync-server/bin/python2 /opt/mozilla-firefox-sync-server/bin/paster serve /opt/mozilla-firefox-sync-server/development.ini
 +
StandardOutput=/var/log/ffsync/sync-messages.log
  
 
[Install]
 
[Install]
 
WantedBy=multi-user.target
 
WantedBy=multi-user.target
Alias=mozillaweave.service
+
Alias=ffsync.service
 
</nowiki>
 
</nowiki>
 
}}
 
}}
  
Test start the server using:
+
===Client configuration===
{{bc|
+
# systemctl start mozillaweave
+
# systemctl status mozillaweave
+
}}
+
  
Set the Sync Server to start at boot with:  
+
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Do not forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>https://example.com/ffsync/</nowiki>}}
{{bc|
+
# systemctl enable mozillaweave
+
}}
+
  
===Client-side configuration===
+
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.
Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Don't forget to choose "Custom server..." in the list, and input the server address: {{ic|<nowiki>http://server-name.domain-name:5000/</nowiki>}}
+
  
The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.
 
 
==See also==
 
==See also==
* [http://docs.services.mozilla.com/howtos/run-sync.html Mozilla Sync Server Howto]
+
 
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Great tutorial, by Eric Hameleers]
+
* [http://docs.services.mozilla.com/howtos/run-sync.html Official Mozilla Firefox Sync Server Howto]
 +
* [http://alien.slackbook.org/blog/setting-up-your-own-mozilla-sync-server/ Howto with Apache support by Eric Hameleers]
 +
* [https://tim.siosm.fr/blog/2012/12/11/firefox-sync-nginx-systemd/ Howto with nginx and systemd support by Timothée Ravier]
 +
* [http://amnesiak.org/blog/mozilla-sync-server-with-nginx.html Howto with nginx support]
 +
* [http://terminal28.com/how-to-install-and-configure-own-firefox-sync-server-weave-debian/ Howto using MySQL]
 +
* [[OwnCloud]] has mozilla sync server application

Latest revision as of 14:14, 3 July 2016

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Various style problems. Personal comments should go in the Discussion page. (Discuss in Talk:Mozilla Firefox Sync Server#)

From Wikipedia:

Firefox Sync, originally branded Mozilla Weave, is a browser synchronization feature that allows users to partially synchronize bookmarks, browsing history, preferences, passwords, filled forms, add-ons and the last 25 opened tabs across multiple computers.
It keeps user data on Mozilla servers, but the data is encrypted in such a way that no third party, not even Mozilla, can access user information. It is also possible for the user to host their own Firefox Sync servers, or indeed, for any entity to do so.

This page details how you should proceed to host your own (Mozilla) Firefox Sync Server (shortened to FFSync), version 1.1 or version 1.5, and how to host your own Firefox Account server.

Note: The 1.1 version of the Mozilla Firefox Sync Server has been deprecated in Firefox 29 and support has been removed from version 32. Version 1.5 of the Mozilla Firefox Sync Server is available for Firefox 29+. However, this now requires users create a Firefox Account. See the following links for details:
Note: The 1.1 and 1.5 versions are currently conflicting for simplicity but one could have the two versions alongside on the same server with some changes. The databases should probably not be shared between different versions however.
Tip: Enter about:sync-log in the Firefox URL bar to get a list of logs related to Firefox Sync.

Version 1.5

This is for Firefox version 29 and onward.

Installation

mozilla-firefox-sync-server-gitAUR is available in the AUR.

The setup creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.

Server configuration

One file is available to configure a FFsync server: /opt/mozilla-firefox-sync-server/syncserver.ini. Most options are explained clearly in the official documentation. Here is a full example with comments:

# Use a Unix socket and the Gunicorn server
[server:main]
use = egg:gunicorn#main
bind = unix:/run/ffsync/syncserver.sock
workers = 2
timeout = 60
syslog = true
syslog_prefix = ffsync
syslog_facility = daemon

[app:main]
use = egg:syncserver

[syncserver]
# This must be edited to point to the public URL of your server,
# i.e. the URL as seen by Firefox.
public_url = http://example.com/ffsync/

# This defines the database in which to store all server data.
sqluri = sqlite:////var/lib/ffsync/sync_storage.db

# This is a secret key used for signing authentication tokens.
# It should be long and randomly-generated.
# The following command will give a suitable value on *nix systems:
#
#    head -c 20 /dev/urandom

Running behind nginx

A sample from the nginx config:

# Firefox sync config
        location /ffsync/ {
            rewrite  ^/ffsync(.+)$ $1 break;
            proxy_pass http://unix:/run/ffsync/syncserver.sock;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_redirect off;
            proxy_read_timeout 120;
            proxy_connect_timeout 10;
            gzip        off;
        }

Client configuration

To configure desktop Firefox to talk to your new Sync server, go to about:config, search for services.sync.tokenServerURI and change its value to the URL of your server with a path of token/1.0/sync/1.5:

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

Firefox Account Server

Until this section is completed, you will have to use the official Firefox Accounts service provided by Mozilla. You can try running your own by following the instructions from the official documentation.

Version 1.1

This is for Firefox version up to but not including version 32.

Installation

mozilla-firefox-sync-server-hgAUR is available in the AUR.

The setup creates an isolated Python environment in which all necessary dependencies are downloaded and installed. Afterwards, running the server only relies on the isolated Python environment, independently of the system-wide Python.

Server configuration

Two files are used to configure a FFsync server: /opt/mozilla-firefox-sync-server/development.ini and /opt/mozilla-firefox-sync-server/etc/sync.conf.

Basic configuration

The fallback node URL must reflect the server's visible URL (here https://example.com/ffsync/). In /opt/mozilla-firefox-sync-server/etc/sync.conf, change:

[nodes]
fallback_node = http://localhost:5000/

to:

[nodes]
fallback_node = https://example.com/ffsync/

Disable debug mode

In /opt/mozilla-firefox-sync-server/development.ini, set:

[DEFAULT]
debug = False

Set email

In /opt/mozilla-firefox-sync-server/etc/sync.conf, set:

[smtp]
sender = ffsync@example.com

Storage backend

The default storage backend is sqlite which should be fine if you do not have a lot of users. To split the various databases into several files, edit the sqluri fields in /opt/mozilla-firefox-sync-server/etc/sync.conf.

The Official FFsync server Howto details setup with MySQL or LDAP as a backend.

Disk quota

The default disk quota is quite restrictive and will quickly be filled if a lot of bookmarks are stored. Bump the disk quota from 5 to 25 MB in /opt/mozilla-firefox-sync-server/etc/sync.conf:

[storage]
...
quota_size = 25600
...

Running behind a Web Server

The default configuration runs a built-in server which should not be used in production.

Apache combined with mod_wsgi

See the Official FFsync server Howto.

nginx with Gunicorn

The PKGBUILD available in the AUR installs the Gunicorn server, in the python virtualenv, by default. Enable it by changing the following lines in /opt/mozilla-firefox-sync-server/development.ini:

[server:main]
use = egg:gunicorn#main
host = unix:/run/ffsync/syncserver.sock
use_threadpool = True
threadpool_workers = 60

Create the /etc/tmpfiles.d/ffsync.conf file to create the /run/ffsync/ folder at boot:

D /run/ffsync 0750 ffsync http

Create this folder now by running:

# systemd-tmpfiles --create ffsync.conf

Enable and start the Gunicorn serveur using the systemd service unit provided in mozilla-firefox-sync-server-hgAUR:

# systemctl enable ffsync
# systemctl start ffsync

Use this config extract to configure nginx:

# Firefox sync config
location /ffsync/ {
    rewrite  ^/ffsync(.+)$ $1 break;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unix:/run/ffsync/syncserver.sock;
}

Not recommended setup with default web server

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: vague statement ("outdated"), see Help:Style#Language register (Discuss in Talk:Mozilla Firefox Sync Server#)

(Outdated) systemd service unit:

/etc/systemd/system/ffsync.service
[Unit]
Description=Mozilla Firefox Syn Server
After=network.target

[Service]
Type=simple
User=ffsync
Group=ffsync
WorkingDirectory=/opt/mozilla-firefox-sync-server
ExecStart=/opt/mozilla-firefox-sync-server/bin/python2 /opt/mozilla-firefox-sync-server/bin/paster serve /opt/mozilla-firefox-sync-server/development.ini
StandardOutput=/var/log/ffsync/sync-messages.log

[Install]
WantedBy=multi-user.target
Alias=ffsync.service

Client configuration

Use the Sync Configuration Wizard in Firefox' Settings to create a new account on the server. Do not forget to choose "Custom server..." in the list, and input the server address: https://example.com/ffsync/

The "Advanced Settings" button allows fine tuning of the synchronized elements list, and the definition of the client hostname.

See also