Run-Your-Own Firefox Sync Server

Overview

Run-Your-Own Firefox Sync Server

https://circleci.com/gh/mozilla-services/syncserver/tree/master.svg?style=svg https://img.shields.io/docker/automated/mozilla-services/syncserver.svg?style=flat-square

This is an all-in-one package for running a self-hosted Firefox Sync server. It bundles the "tokenserver" project for authentication and the "syncstorage" project for storage, to produce a single stand-alone webapp.

Complete installation instructions are available at:

https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html

Quickstart

The Sync Server software runs using python 2.7, and the build process requires make and virtualenv. You will need to have the following packages (or similar, depending on your operating system) installed:

  • python2.7
  • python2.7-dev
  • python-virtualenv
  • gcc and g++
  • make
  • libstdc++
  • libffi-dev
  • mysql-dev
  • musl-dev
  • ncurses-dev
  • openssl-dev

Take a checkout of this repository, then run "make build" to pull in the necessary python package dependencies:

$ git clone https://github.com/mozilla-services/syncserver
$ cd syncserver
$ make build

To sanity-check that things got installed correctly, do the following:

$ make test

Now you can run the server:

$ make serve

This should start a server on http://localhost:5000/.

Now go into Firefox's about:config page, search for a setting named "tokenServerURI", and change it to point to your server:

identity.sync.tokenserver.uri:  http://localhost:5000/token/1.0/sync/1.5

(Prior to Firefox 42, the TokenServer preference name for Firefox Desktop was "services.sync.tokenServerURI". While the old preference name will work in Firefox 42 and later, the new preference is recommended as the old preference name will be reset when the user signs out from Sync causing potential confusion.)

Firefox should now sync against your local server rather than the default Mozilla-hosted servers.

For more details on setting up a stable deployment, see:

https://mozilla-services.readthedocs.io/en/latest/howtos/run-sync-1.5.html

Customization

All customization of the server can be done by editing the file "syncserver.ini", which contains lots of comments to help you on your way. Things you might like to change include:

  • The client-visible hostname for your server. Edit the "public_url" key under the [syncerver] section.
  • The database in which to store sync data. Edit the "sqluri" setting under the [syncserver] section.
  • The secret key to use for signing auth tokens. Find the "secret" entry under the [syncserver] section and follow the instructions in the comment to replace it with a strong random key.

Database Backend Modules

If your python installation doesn't provide the "sqlite" module by default, you may need to install it as a separate package:

$ ./local/bin/pip install pysqlite2

Similarly, if you want to use a different database backend you will need to install an appropriate python module, e.g:

$ ./local/bin/pip install PyMySQL
$ ./local/bin/pip install psycopg2

Runner under Docker

Dockerhub Page

There is experimental support for running the server inside a Docker container. The docker image runs with UID/GID 1001/1001. Build the image like this:

$ docker build -t syncserver:latest .

Then you can run the server by passing in configuration options as environment variables, like this:

$ docker run --rm \
    -p 5000:5000 \
    -e SYNCSERVER_PUBLIC_URL=http://localhost:5000 \
    -e SYNCSERVER_SECRET= \
    -e SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db \
    -e SYNCSERVER_BATCH_UPLOAD_ENABLED=true \
    -e SYNCSERVER_FORCE_WSGI_ENVIRON=false \
    -e SYNCSERVER_DEBUG_ENABLED=true \
    -e PORT=5000 \
    mozilla/syncserver:latest

or

$ docker run --rm \
    -p 5000:5000 \
    -e SYNCSERVER_PUBLIC_URL=http://localhost:5000 \
    -e SYNCSERVER_SECRET_FILE= \
    -e SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db \
    -e SYNCSERVER_BATCH_UPLOAD_ENABLED=true \
    -e SYNCSERVER_FORCE_WSGI_ENVIRON=false \
    -e PORT=5000 \
    -v /secret/file/at/host:  \
    mozilla/syncserver:latest

Don't forget to generate a random secret key to use in the SYNCSERVER_SECRET environment variable or mount your secret key file!

And you can test whether it's running correctly by using the builtin function test suite, like so:

$ /usr/local/bin/python -m syncstorage.tests.functional.test_storage \
    --use-token-server http://localhost:5000/token/1.0/sync/1.5

If you'd like a persistent setup, you can mount a volume as well:

$ docker run -d \
    -v /syncserver:/data \
    -p 5000:5000 \
    -e SYNCSERVER_PUBLIC_URL=http://localhost:5000 \
    -e SYNCSERVER_SECRET= \
    -e SYNCSERVER_SQLURI=sqlite:////data/syncserver.db \
    -e SYNCSERVER_BATCH_UPLOAD_ENABLED=true \
    -e SYNCSERVER_FORCE_WSGI_ENVIRON=false \
    -e PORT=5000 \
    mozilla/syncserver:latest

Make sure that /syncserver is owned by 1001:1001

Docker Compose can also be used for structured deployments:

version: '3.7'
services:
    syncserver:
        container_name: syncserver
        image: mozilla/syncserver:latest
        volumes:
            - /syncserver:/data
        ports:
            - 5000:5000
        environment:
            SYNCSERVER_PUBLIC_URL: 'http://localhost:5000'
            SYNCSERVER_SECRET: ''
            SYNCSERVER_SQLURI: 'sqlite:////data/syncserver.db'
            SYNCSERVER_BATCH_UPLOAD_ENABLED: 'true'
            SYNCSERVER_FORCE_WSGI_ENVIRON: 'false'
            PORT: '5000'
        restart: always

Removing Mozilla-hosted data

If you have previously uploaded Firefox Sync data to the Mozilla-hosted storage service and would like to remove it, you can use the following script to do so:

$ pip install PyFxA
$ python ./bin/delete_user_data.py [email protected]

Questions, Feedback

Owner
Mozilla Services
see also http://blog.mozilla.com/services
Mozilla Services
A tool to help you to do the monthly reading requirements

Monthly Reading Requirement Auto ⚙️ A tool to help you do the monthly reading requirements Important ⚠️ Some words can't be translated Links: Synonym

Julian Jauk 2 Oct 31, 2021
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python

Scalene: a high-performance CPU, GPU and memory profiler for Python by Emery Berger, Sam Stern, and Juan Altmayer Pizzorno. Scalene community Slack Ab

PLASMA @ UMass 7k Dec 30, 2022
Машинное обучение на ФКН ВШЭ

Курс "Машинное обучение" на ФКН ВШЭ Конспекты лекций, материалы семинаров и домашние задания (теоретические, практические, соревнования) по курсу "Маш

Evgeny Sokolov 2.2k Jan 04, 2023
Fast STL (ASCII & Binary) importer for Blender

blender-fast-stl-importer Fast STL (ASCII & Binary) importer for Blender based on https://en.wikipedia.org/wiki/STL_(file_format) Technical notes: flo

Iyad Ahmed 7 Apr 17, 2022
A numbers check python package

A numbers check python package

Fayas Noushad 3 Nov 28, 2021
Today I Commit (1일 1커밋) 챌린지 알림 봇

Today I Commit Challenge 1일1커밋 챌린지를 위한 알림 봇 config.py github_token = "github private access key" slack_token = "slack authorization token" channel = "

sunho 4 Nov 08, 2021
PIP Manager written in python Tkinter

PIP Manager About PIP Manager is designed to make Python Package handling easier by just a click of a button!! Available Features Installing packages

Will Payne 9 Dec 09, 2022
How to use Microsoft Bing to search for leaks?

Installation In order to install the project, you need install its dependencies: $ pip3 install -r requirements.txt Add your Bing API key to bingKey.t

Ernestas Kardzys 2 Sep 21, 2022
Module for remote in-memory Python package/module loading through HTTP/S

httpimport Python's missing feature! The feature has been suggested in Python Mailing List Remote, in-memory Python package/module importing through H

John Torakis 220 Dec 17, 2022
Union oichecklists For Python

OI Checklist Union Auto-Union user's OI Checklists. Just put your checklist's ID in and it works. How to use it? Put all your OI Checklist IDs (that i

FHVirus 4 Mar 30, 2022
Like Docker, but for Squeak. You know, for kids.

Squeaker Like Docker, but for Smalltalk images. You know, for kids. It's a small program that helps in automated derivation of configured Smalltalk im

Tony Garnock-Jones 14 Sep 11, 2022
My Analysis of the VC4 Assembly Code from the RPI4

My Analysis of the VC4 Assembly Code from the RPI4

Nicholas Starke 31 Jul 13, 2022
A bot to use in a pump & dump event

A bot to use in a pump & dump event on Binance.com. Please note the bot is in heavy devleopment currently so be aware of errors. If you experience err

Freddie Jonas 189 Dec 24, 2022
An-7 tool for python

***An-7 tool - Anonime-X Team*** An-x Menu : SPAM Android web malware interpreter Spam Tools : scampages letters mailers smtpcrack wpbrute shell Andro

Hamza Anonime 8 Nov 18, 2021
Convert temps in your Alfred search bar

Alfred Temp Converter Convert temps in your Alfred search bar. Download Here Usage: temp 100f converts to Celsius, Kelvin, and Rankine. temp 100c conv

Justin Hamilton 4 Apr 11, 2022
Localization and multifractal properties of the long-range Kitaev chain in the presence of an Aubry-André-Harper modulation

This repository contains the code for the paper Localization and multifractal properties of the long-range Kitaev chain in the presence of an Aubry-André-Harper modulation.

Joana Fraxanet 2 Apr 17, 2022
This is a Docker-based pipeline for preparing sextractor-ready multiwavelength images

Pipeline for creating NB422-detected (ODI) catalog The repository contains a Docker-based pipeline for preprocessing observational data. The pipeline

1 Sep 01, 2022
Template for pre-commit hooks

Pre-commit hook template This repo is a template for a pre-commit hook. Try it out by running: pre-commit try-repo https://github.com/stefsmeets/pre-c

Stef Smeets 1 Dec 09, 2021
The code behind sqlfmt.com, a web UI for sqlfmt

The code behind sqlfmt.com, a web UI for sqlfmt

Ted Conbeer 2 Dec 14, 2022
VAST - Visualise Abstract Syntax Trees for Python

VAST VAST - Visualise Abstract Syntax Trees for Python. VAST generates ASTs for a given Python script and builds visualisations of them. Install Insta

Jesse Phillips 2 Feb 18, 2022