自前のFirefoxSyncServer-その2

自前のFirefoxSyncServerの記事を2012年10月8日に書いた.
その後新しいサーバーに置きかえていた(2015年3月)のだが,その記録を書いていなかったので今頃(2016年4月)ここに記す.

Firefox 29 から FirefoxSyncはFirefoxアカウントを使用するようになったので,新しいサーバーに置きかえた
** 参考サイト https://docs.services.mozilla.com/howtos/run-sync-1.5.html
このサイト(英語)をしっかり読めばいいみたいです.

■作業記録(2015.1.17) on Debian GNU/Linux

  • Python 2.7 インストール済み
  • vertualenv, python-virtualenv インストール済み
  • ビルドするのに必要なもの: python-devel, make, git
  • サーバーのファイルは,/usr/local/syncsever に置くものとする
  • gitを操作してインストールする

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

できたsyncserver を /usr/local に移動

$ cd /usr/local/syncsever
$ make build
$ cd /usr/local
$ sudo chown -R www-data:www-data syncserver

□ 設定ファイル:syncserver.ini を編集する

  • (webサーバー):5000 にアクセスするような設定
  • データーファイルは,webサーバーの/usr/local/syncserver/db/syncserver.db

#public_url = http://localhost:5000/
public_url = http://(webサーバー):5000/

#sqluri = sqlite:////tmp/syncserver.db
sqluri = sqlite:////usr/local/syncserver/db/syncserver.db

□テスト1:手動でsyncサーバーを動かしてみる
$ cd /usr/local/syncserver
$ ./local/bin/pserve syncserver.ini

□テスト1(クライアント側)

  • firefoxのURI で, about:config と入力
  • services.sync.tokenServerURI を選択
    • 初期値:https://token.services.mozilla.com/1.0/sync/1.5 を変更
    • http://(webサーバー):5000/ に変更する
  • firefoxでfirefoxsyncを設定する.メールアドレスとパスワードを入力する.
  • /usr/local/syncserver/db/ 以下にデーターができていることを確認

■作業記録(2015.3.5,3.7) on Debian GNU/Linux
□ WSGIの設定
* 設定ファイル(apache側の設定)を書く
** 参考サイト https://docs.services.mozilla.com/howtos/run-sync-1.5.html にある設定ファイルを利用する./etc/apache2/sites-enabled/ffsync.conf等として設定.

* VirtualHost の項目の中(参考)

ServerName (クライアントからアクセスするsyncサーバーのURL)
DocumentRoot /usr/local/syncserver/

WSGIProcessGroup sync
WSGIDaemonProcess sync user=www-data group=www-data processes=2 threads=25 \
python-path=/usr/local/syncserver/local/lib/python2.7/site-packages/
WSGIPassAuthorization On
WSGIScriptAlias /ffsync /usr/local/syncserver/syncserver.wsgi

CustomLog /var/log/apache2/syncserver-access.log combined
ErrorLog /var/log/apache2/syncserver-error.log

  • python-pathの行を追加
  • python-path=/usr/local/syncserver/local/lib/python2.7/site-packages/

  • Directory は syncサーバーをインストールした場所
  • ServerName は クライアントからアクセスするsyncサーバーのURL
  • DocumentRoot は syncサーバーをインストールした場所
  • WSGIScriptAlias は syncserver.wsgi のある場所を記載

□ syncserver.ini を編集
$ head -c 20 /dev/urandom | sha1sum
で出てきた文字列をsyncserver.iniに書く
[syncserver]
...other settings...
secret = (こ こ に 文 字 列 を記 入)

□クライアント側の設定

  • Firefoxでservices.sync.tokenServerURI の値を変更する
  • 初期値:https://token.services.mozilla.com/1.0/sync/1.5 を変更する
  • http://(webサーバー)/ffsync/token/1.0/sync/1.5 に変更する

□クライアント側の設定(Android)

  • firefox44より前の方法
    • アドオンfxa-custom-server-addon をインストールして,
      Custom Firefox Account で,保存するサイトの上記のように設定する
  • firefox44以降
    • android用アドオン fxa-custom-server-addon が無くなった
    • about:config identity.sync.tokenserver.uri を編集する
    • 初期値:https://token.services.mozilla.com/1.0/sync/1.5 を変更
    • http://(webサーバー)/ffsync/token/1.0/sync/1.5 に変更する

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA