From d9253211837c94c93ea285c4894646590dfdc2ab Mon Sep 17 00:00:00 2001 From: Donovan Preston Date: Wed, 30 Sep 2020 15:42:05 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20#246=20Switch=20to=20syncstorage-rs,=20an?= =?UTF-8?q?d=20document=20the=20additional=20depend=E2=80=A6=20(#248)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #246 Switch to syncstorage-rs, and document the additional dependencies required. --- .gitignore | 3 +++ README.rst | 22 +++++++++++++++++++++- run-syncstorage-rs.sh | 10 ++++++++++ syncserver.ini | 2 +- syncserver/__init__.py | 8 +++++++- 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 run-syncstorage-rs.sh diff --git a/.gitignore b/.gitignore index 45b872e..03e5263 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ local *~ nosetests.xml syncserver.db +*.DS_Store +syncstorage-rs +.vscode diff --git a/README.rst b/README.rst index d833174..d729b54 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,14 @@ Run-Your-Own Firefox Sync Server ================================ +Note +---- + +For the duration of Q4 2020 this documentation will be revised. This situation will only be temporary until tokenserver is ported to rust and this documentation is rewritten to leave out the old dependencies. + +About syncserver +---------------- + .. image:: https://circleci.com/gh/mozilla-services/syncserver/tree/master.svg?style=svg :target: https://circleci.com/gh/mozilla-services/syncserver/tree/master @@ -8,7 +16,7 @@ Run-Your-Own Firefox Sync Server :target: https://hub.docker.com/r/mozilla/syncserver/ 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" +It bundles the "tokenserver" project for authentication and the "syncstorage-rs" project for storage, to produce a single stand-alone webapp. Complete installation instructions are available at: @@ -35,6 +43,18 @@ following packages (or similar, depending on your operating system) installed: - ncurses-dev - openssl-dev +syncstorage-rs uses the following additional dependencies: + +- cmake +- golang +- libcurl4-openssl-dev +- libssl-dev +- pkg-config +- Rust stable https://rustup.rs/ +- MySQL 5.7 (or compatible) + - libmysqlclient (brew install mysql on macOS, apt install libmysqlclient-dev on Ubuntu) + + Take a checkout of this repository, then run "make build" to pull in the necessary python package dependencies:: diff --git a/run-syncstorage-rs.sh b/run-syncstorage-rs.sh new file mode 100644 index 0000000..02bac99 --- /dev/null +++ b/run-syncstorage-rs.sh @@ -0,0 +1,10 @@ +if [ ! -d "syncstorage-rs" ]; then + echo "Downloading syncstorage-rs" + git clone https://github.com/mozilla-services/syncstorage-rs +fi + +echo "Starting syncstorage-rs" + +cd syncstorage-rs + +SYNC_HUMAN_LOGS=1 RUST_LOG=trace cargo run diff --git a/syncserver.ini b/syncserver.ini index ccf1ae0..e296b18 100644 --- a/syncserver.ini +++ b/syncserver.ini @@ -55,4 +55,4 @@ force_wsgi_environ = false # MySQL based syncstorage-rs 1.5 server hosted at http://localhost:8000/1.5 # "{node}/1.5/{uid}" -# sync-1.5 = "http://localhost:8000/1.5/{uid}" +sync-1.5 = "http://localhost:8000/1.5/{uid}" diff --git a/syncserver/__init__.py b/syncserver/__init__.py index adebe54..92006cd 100644 --- a/syncserver/__init__.py +++ b/syncserver/__init__.py @@ -5,6 +5,7 @@ import binascii import os import logging +import subprocess try: from urlparse import urlparse, urlunparse, urljoin except ImportError: @@ -59,6 +60,8 @@ def includeme(config): if sqluri is None: rootdir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) sqluri = "sqlite:///" + os.path.join(rootdir, "syncserver.db") + else: + os.environ['SYNC_DATABASE_URL'] = sqluri # Automagically configure from IdP if one is given. idp = settings.get("syncserver.identity_provider") @@ -155,7 +158,10 @@ def includeme(config): # Include the relevant sub-packages. config.scan("syncserver", ignore=["syncserver.wsgi_app"]) - config.include("syncstorage", route_prefix="/storage") + + os.environ['SYNC_MASTER_SECRET'] = secret + subprocess.call("/usr/bin/env sh run-syncstorage-rs.sh &", shell=True) + config.include("tokenserver", route_prefix="/token") # Add a top-level "it works!" view.