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 repository of study materials related to Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: https://greenteapress.com/wp/think-python-2e/

Intro-To-Python This content is based on the book Think Python 2nd Edition by Allen B. Downey. More information about the book can be found here: http

Brent Eskridge 63 Jan 07, 2023
CEI Natural Disaster Tracking Portal

CEI Natural Disaster Tracking Portal (cc) Climatic Eye of ISCI We are an initiative that conducts studies in the field of Space Science, publishes pro

Baris Dincer 7 Dec 24, 2022
Check COVID locations of interest against Google location history

Location of Interest Checker Script to compare COVID locations of interest to Google location history. The script produces a map plot (as shown below)

9 Mar 30, 2022
Mannaggia is a python application to praise or more likely to curse the saints

Mannaggia-py 👼 Remember Mannaggia? This is a Python remake of it, with new features. mannaggia is a python application to praise or more likely to cu

Christian Visintin 9 Aug 12, 2022
The Python Fuzzer that the world deserves 🐍

pip3 install frelatage Current release : 0.0.2 The Python Fuzzer that the world deserves Installation | How it works | Features | Use Frelatage | Conf

Rog3r 219 Dec 21, 2022
Is a util for xferring skinning from one mesh to another

maya_pythonplugins skinTo: Is a util for xferring skinning from one mesh to another args: :param maxInfluences: is the number of max influences on the

James Dunlop 2 Jan 24, 2022
This is the Code Institute student template for Gitpod.

Welcome AnaG0307, This is the Code Institute student template for Gitpod. We have preinstalled all of the tools you need to get started. It's perfectl

0 Feb 02, 2022
My solutions to Advent of Code 2021 (written in Python)

Advent of Code 2021 This repository contains my solutions for the 2021 edition of Advent of Code. Please do not expect perfectly polished solutions, m

Nils 2 May 29, 2022
Consulta cpf fds

Consulta-cpf Consulta cpf fds Instalação: apt-get update -y

Moleey 1 Nov 24, 2021
Library for mocking AsyncIOMotorClient built on top of mongomock.

mongomock-motor Best effort mock for AsyncIOMotorClient (Database, Collection, e.t.c) built on top of mongomock library. Example / Showcase from mongo

Michael Kryukov 43 Jan 04, 2023
Box CRUD API With Python

Box CRUD API: Consider a store which has an inventory of boxes which are all cuboid(which have length breadth and height). Each Cuboid has been added

Akhil Bhalerao 3 Feb 17, 2022
This is a Blender 2.9 script for importing mixamo Models to Godot-3

Mixamo-To-Godot This is a Blender 2.9 script for importing mixamo Models to Godot-3 The script does the following things Imports the mixamo models fro

8 Sep 02, 2022
An osu! cheat made in c++ rewritten in python and currently undetected.

megumi-python An osu! cheat made in c++ rewritten in python and currently undetected. Installation Guide Download python 3.9 from https://python.org C

Elaina 2 Nov 18, 2022
A Python 3 client for the beanstalkd work queue

Greenstalk Greenstalk is a small and unopinionated Python client library for communicating with the beanstalkd work queue. The API provided mostly map

Justin Mayhew 67 Dec 08, 2022
Small tool to use hero .json files created with Optolith for The Dark Eye/ Das Schwarze Auge 5 to perform talent probes.

DSA5-ProbeMaker A little tool for The Dark Eye 5th Edition (Das Schwarze Auge 5) to load .json from Optolith character generation and easily perform t

2 Jan 06, 2022
A Non profit app built on top of Frappe framework & ERPNext

Non Profit A Non profit app built on top of Frappe framework & ERPNext. People who change the world need the tools to do it! The Non Profit Modules of

Frappe 16 Nov 17, 2022
Python interface to IEX and IEX cloud APIs

Python interface to IEX Cloud Referral Please subscribe to IEX Cloud using this referral code. Getting Started Install Install from pip pip install py

IEX Cloud 41 Dec 21, 2022
A framework to create reusable Dash layout.

dash_component_template A framework to create reusable Dash layout.

The TolTEC Project 4 Aug 04, 2022
InfiniPy has some neat features - like the endpoint for function

InfiniPy has some neat features - like the endpoint for function

ZeroTwo 7 Nov 20, 2022
Qt-creator-boost-debugging-helper - Qt Creator Debugging Helper for Boost Library

Go to Tools Options Debugger Locals & Expressions. Paste the script path t

Dmitry Bravikov 2 Apr 22, 2022