Mohamed Elashri

Self-hosted Firefox sync server


Firefox Sync is a powerful feature that allows you to keep your bookmarks, history, and other data in sync across all of your devices. It’s a great way to ensure that your favorite websites and browsing habits are always with you, no matter where you are.

If you’re a privacy-conscious user like me, you may be hesitant to rely on Mozilla’s servers to store your data. Fortunately, it’s possible to run your own Firefox Sync server, giving you complete control over where your data is stored and how it is accessed.

In this post, I will walk you through the steps for setting up your own Firefox Sync server. This installation method is going to be docker based, so you will need to have docker installed on your server. If you don’t have docker installed, you can follow the instructions here to install it. You can find instructions for doing this on the Install Docker-Engine. Also, you will need to install docker-compose, this is also available on the Install docker-compose.

Alternatively, you can use the following shell script to install docker and docker-compose on your server:

#!/bin/bash

apt-get update -y
apt-get install -y apt-transport-https ca-certificates curl software-properties-common

sudo mkdir -p /etc/apt/keyrings
 

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get update -y

apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

Next, create a file called docker-compose.yml in a new directory on your server. This file will contain the configuration for your Firefox Sync server. In this file you will need to add the following configuration:

version: "3.2"

services:
  firefox-syncserver:
    image: crazymax/firefox-syncserver:latest
    container_name: firefox
    ports:
      - target: 5000
        published: 5000
        protocol: tcp
    volumes:
      - "/home/<user>/firefox-sync/data:/data"
    env_file:
      - "/home/<user>/firefox-sync/firefox.env"
    restart: always

volumes:
  firefox-syncserver:

This configuration will create a docker container that will run the Firefox Sync server. It will also create a volume that will store the data for the server. You will need to replace the <user> with your username on the server. You can also change the port that the server is running on, if you want to. One important thing is that you will need to pass a .env file to the container. This file will contain the configuration for the server. You can find an example of this file in the following code

TZ=America/NewYork
PUID=1000
PGID=1000
FF_SYNCSERVER_PUBLIC_URL=http://<server>.<domain>
FF_SYNCSERVER_SECRET=736hdojh929jdmo
FF_SYNCSERVER_ALLOW_NEW_USERS=true

FF_SYNCSERVER_FORCE_WSGI_ENVIRON=false

The explanation for each of these variables is as follows: