Direct link: https://firefox.atticstudios.be
(little point in clicking it, read on below!)

Based on: syncserver by Ryan KellyGithub

Table of Contents

Description

Earlier this week, I decided to switch default browsers. Back to my old friend Firefox (and a derivate, Waterfox, on desktop). Apart from being Open Source solutions, the main compelling argument was the availability of an Open Source, self-hosted Firefox Sync Server. This allows syncing bookmarks, form data, passwords, add-ons, history and tabs among Firefox browsers, while keeping the database with all that personal information well-encrypted on your own host. Pretty much an identical feature set as Vivaldi Sync, the proprietary solution I was using until, well… today!

It all still starts with a Firefox Account at Mozilla. There are some scraps available about running your own Accounts server, but even the documentation itself states it is “preliminary and vastly incomplete”. I think it might just be slightly out of my league still to get that up and running, maybe in a next project…

I started with the installation following “Run your own Sync-1.5 Server” from the author of the package. Building the application seemed easy enough, but this was the first time ‘make’ did not just work… Moving folders around during setup and building tends to break things, I have learned. My SQL skills improved with repeatedly recreating the database and user account.

Things really started falling apart, however, when I tried adding the syncserver Python app as a uwsgi app behind Nginx on the same machine. If you do not yet understand some component of a solution entirely, flicking options about to see what they do is not the fastest way to get things working. Neither is accidentally overwriting config files of other apps ????‍♂️
I spent some time rebuilding Searx and getting Nextcloud and this website back up and running.

After restarting from scratch several times, Firefox Sync is now running happily alongside several other servers and is available on https://firefox.atticstudios.be. There is little point in browsing there ????

Usage

If you want to use the sync service, you need to change an “advanced option” in Firefox. To do this, type “about:config” in the address bar and hit enter. Search for “token”, then change the value of “identity.sync.tokenserver.uri” to “https://firefox.atticstudios.be/token/1.0/sync/1.5”:

After that, sign up for or in with a Firefox account by clicking the account icon on the toolbar. This will take you to the Firefox Account sign in page. Once you create an account, or log in if you already have one, Firefox will begin syncing with the Attic Firefox Sync Server.

I chose not to sync bookmarks and logins, all other content is synced safely and privately with my own server.

As with all Open Projects, feel free to use it if you like. If you want to run your own, let me know if I can help!

Installation

It took some iterations, but the final installation is pretty compact and worked nicely in my environment on Debian 10 “Buster”.

Parameters
server_fqdn:the full public FQDN of your server, e.g. firefox.atticstudios.be.
_ip_address_the internal IP address of the machine running the server.
sql_passwd:the password of the SQL user account for accessing the database (in this example ‘ffsync’ and ‘syncstorage’ respectively). I could not get this to work with some special characters in the password.
strong_random_secret:…a strong, random secret. I used a long string of alphanumeric characters.
# Install
cd /opt
sudo git clone https://github.com/mozilla-services/syncserver
cd syncserver
sudo make build
sudo make test

# User
sudo useradd -d /opt/syncserver -m ffsync
sudo adduser www-data ffsync

sudo chown ffsync:ffsync /opt/syncserver -R

# MySQL
sudo mysql -u root -p
	create database syncstorage;
	GRANT ALL PRIVILEGES ON syncstorage.* TO ffsync@localhost IDENTIFIED BY '_sql_password_';
	flush privileges;
	quit;
	
# Config
sudo nano /opt/syncserver/syncserver.ini
	# Update/uncomment the following parameters:
        public_url = https://_server_fqdn_/
        sqluri = pymysql://ffsync:_sql_passwd_@127.0.0.1:3306/syncstorage
        secret = '_strong_random_secret_'
        force_wsgi_environ = true
	
sudo nano /etc/uwsgi/apps-available/ffsync.ini
	[uwsgi]
	socket = /run/uwsgi/app/ffsync/ffsync.sock
	uid = ffsync
	gid = ffsync
	chdir = /opt/syncserver/
	master = true
	plugins = python27
	file = syncserver.wsgi
	
sudo nano /etc/nginx/sites-available/ffsync
	server {
	        listen 8050 default_server;
	        server_name _;
	        location / {
	            include uwsgi_params;
	            uwsgi_pass unix:/run/uwsgi/app/ffsync/ffsync.sock;
	        }
	}

# Enable
sudo ln -s /etc/nginx/sites-available/ffsync /etc/nginx/sites-enabled/
sudo ln -s /etc/uwsgi/apps-available/ffsync.ini /etc/uwsgi/apps-enabled/
sudo systemctl restart uwsgi nginx

# This runs the Firefox Sync Server on port 8050
# Nginx reverse proxy on remote machine:
	server {
	    listen 443 ssl http2;
	    ssl_certificate /etc/letsencrypt/live/_server_fqdn_/fullchain.pem;
	    ssl_certificate_key /etc/letsencrypt/live/_server_fqdn_/privkey.pem;
	
	    server_name _server_fqdn_;
	
	    root /var/www/html/_server_fqdn_;
	
	    location / {
	        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://_ip_address_:8050;
    }

All feedback welcome below. Let me know if it works for you!