Difference between revisions of "Mozilla sync server"

From SME Server
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
 
  yum install smeserver-extrarepositories-centos-sclo --enablerepo=smedev,smecontribs
 
  yum install smeserver-extrarepositories-centos-sclo --enablerepo=smedev,smecontribs
 
  signal-event yum-modify
 
  signal-event yum-modify
  yum install make git-core  gcc gcc-c++  phyton27-build scl-utils scl-utils-build python27-python-devel  python27-python-virtualenv python27-build   --enablerepo=centos-sclo*
+
  yum install make git-core  gcc gcc-c++  phyton27-build scl-utils scl-utils-build python27-python-devel  python27-python-virtualenv python27-build python27-mod_wsgi  --enablerepo=centos-sclo*
  
 +
without building locally those might be required
 +
yum install python27-python-sqlalchemy  scl-utils scl-utils-build  python27-python-virtualenv python27-build python27-mod_wsgi  --enablerepo=centos-sclo*
  
 
=== download and build===
 
=== download and build===
  
 +
cd /opt
 
  git clone https://github.com/mozilla-services/syncserver
 
  git clone https://github.com/mozilla-services/syncserver
 
  cd syncserver  
 
  cd syncserver  
 
  scl enable python27 bash
 
  scl enable python27 bash
 
  make build
 
  make build
 +
 +
this will install via pip in the ./local dir all the required tools.
 +
 +
Successfully built cornice pyramid WebOb simplejson SQLAlchemy zope.component configparser mozsvc tokenserver alembic pymysql-sa umemcache SyncStorage wsgiproxy repoze.lru zope.interface konfig Mako python-editor MarkupSafe
 +
 +
Installing collected packages: WebOb, repoze.lru, zope.interface, zope.deprecation, venusian, translationstring, PasteDeploy, pyramid, simplejson, cornice, gunicorn, requests, SQLAlchemy, six, linecache2, traceback2, argparse, unittest2, zope.event, zope.component, configparser, konfig, mozsvc, MarkupSafe, Mako, python-editor, python-dateutil, alembic, boto, hawkauthlib, Paste, PyBrowserID, PyMySQL, pymysql-sa, testfixtures, tokenlib, umemcache, tokenserver, pyramid-hawkauth, wsgiproxy, waitress, beautifulsoup4, webtest, SyncStorage
  
 
then test it :
 
then test it :
Line 35: Line 44:
  
 
  [syncserver]
 
  [syncserver]
  public_url = http://localhost:5000/
+
  public_url = <nowiki>http://localhost:5000/</nowiki>
  
 
The default value of “public_url” will work for testing purposes on your local machine. For final deployment, change it to the external, publicly-visible URL of your server.
 
The default value of “public_url” will work for testing purposes on your local machine. For final deployment, change it to the external, publicly-visible URL of your server.
Line 48: Line 57:
 
  [syncserver]
 
  [syncserver]
 
  sqluri = pymysql://username:password@db.example.com/sync
 
  sqluri = pymysql://username:password@db.example.com/sync
 +
 +
then Generate your secret and paste it on the  secret line<syntaxhighlight lang="bash">
 +
secret =
 +
</syntaxhighlight>
  
 
=== better db support ===
 
=== better db support ===

Latest revision as of 05:11, 6 May 2018

Warning.png Warning:
This is a work in progress, you can contribute to improve this, just do not use it in production



Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


here the procedure to compile and install on a SME9 / CentOS 6 system

Sync server

according to http://moz-services-docs.readthedocs.io/en/latest/howtos/run-sync-1.5.html

prerequesite

yum install smeserver-extrarepositories-centos-sclo --enablerepo=smedev,smecontribs
signal-event yum-modify
yum install make git-core  gcc gcc-c++  phyton27-build scl-utils scl-utils-build python27-python-devel  python27-python-virtualenv python27-build  python27-mod_wsgi   --enablerepo=centos-sclo*

without building locally those might be required

yum install python27-python-sqlalchemy  scl-utils scl-utils-build  python27-python-virtualenv python27-build python27-mod_wsgi  --enablerepo=centos-sclo*

download and build

cd /opt
git clone https://github.com/mozilla-services/syncserver
cd syncserver 
scl enable python27 bash
make build

this will install via pip in the ./local dir all the required tools.

Successfully built cornice pyramid WebOb simplejson SQLAlchemy zope.component configparser mozsvc tokenserver alembic pymysql-sa umemcache SyncStorage wsgiproxy repoze.lru zope.interface konfig Mako python-editor MarkupSafe

Installing collected packages: WebOb, repoze.lru, zope.interface, zope.deprecation, venusian, translationstring, PasteDeploy, pyramid, simplejson, cornice, gunicorn, requests, SQLAlchemy, six, linecache2, traceback2, argparse, unittest2, zope.event, zope.component, configparser, konfig, mozsvc, MarkupSafe, Mako, python-editor, python-dateutil, alembic, boto, hawkauthlib, Paste, PyBrowserID, PyMySQL, pymysql-sa, testfixtures, tokenlib, umemcache, tokenserver, pyramid-hawkauth, wsgiproxy, waitress, beautifulsoup4, webtest, SyncStorage

then test it :

make test

configure and run

make serve

This should start a server on http://localhost:5000/. try elinks http://localhost:5000/ and should display "it works! "

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

There is one setting that you must specify before running the server: the client-visible URL for the service. Open ”./syncserver.ini” and locate the following lines:

[syncserver]
public_url = http://localhost:5000/

The default value of “public_url” will work for testing purposes on your local machine. For final deployment, change it to the external, publicly-visible URL of your server.

By default the server will use an in-memory database for storage, meaning that any sync data will be lost on server restart. You will almost certainly want to configure a more permanent database, which can be done with the “sqluri” setting:

[syncserver]
sqluri = sqlite:////path/to/database/file.db

This setting will accept any SQLAlchemy database URI; for example the following would connect to a mysql server:

[syncserver]
sqluri = pymysql://username:password@db.example.com/sync

then Generate your secret and paste it on the secret line

secret =

better db support

TO DO

starting service

TO DO

Running behind a Web Server

TO DO

auth server and its interface

according to http://moz-services-docs.readthedocs.io/en/latest/howtos/run-fxa.html#howto-run-fxa

this is if you want to handle yourself also the auth service, but you can let it to Mozilla and still use your local syncserver.


references and sources