Weave: Unterschied zwischen den Versionen

Aus SchnallIchNet
Wechseln zu: Navigation, Suche
(test installation)
Zeile 137: Zeile 137:
  
 
  vi weave_user_constants.php
 
  vi weave_user_constants.php
 +
 +
 +
== bugs ==
 +
 +
some bugs...
  
  
Zeile 145: Zeile 150:
 
  locale -a
 
  locale -a
  
if you can not find en_US.UTF8 in that list you will have to edit the file sync-server/1.0/weave_user/mysql.php in line 84:
+
if you can not find en_US.UTF8 in that list you will have to edit the file /var/www/mydomain.de/weave/sync-server/1.0/weave_user/mysql.php in line 84:
  
 
  //if (setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8") == false)
 
  //if (setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8") == false)
Zeile 152: Zeile 157:
 
comment out the line and insert an utf-8 locale installed on your system. <br/>
 
comment out the line and insert an utf-8 locale installed on your system. <br/>
 
in my case this was 'de_DE.UTF-8'
 
in my case this was 'de_DE.UTF-8'
 +
 +
 +
=== path bug ===
 +
 +
there is a path problem in regservers index. <br/>
 +
so i edited /var/www/mydomain.de/weave/reg-server/1.0/index.php <br/>
 +
in my case the corresponding code starts @ line 49 <br/>
 +
AND <br/>
 +
/var/www/mydomain.de/weave/sync-server/1.1/index.php <br/>
 +
in my case the corresponding code starts @ line 49 <br/>
 +
 +
<pre>
 +
if (!empty($_SERVER['PATH_INFO']))
 +
        $path = $_SERVER['PATH_INFO'];
 +
    else if (!empty($_SERVER['ORIG_PATH_INFO']))
 +
        $path = $_SERVER['ORIG_PATH_INFO'];
 +
    else if (!empty($_SERVER['REQUEST_URI']))
 +
        $path = $_SERVER['REQUEST_URI'];
 +
    else
 +
        report_problem("No path found", 404);
 +
</pre>
 +
 +
i added these 2 lines:
 +
 +
else if (!empty($_SERVER['REQUEST_URI']))
 +
    $path = $_SERVER['REQUEST_URI'];
  
  
Zeile 160: Zeile 191:
 
1st to test is if registration works. <br/>
 
1st to test is if registration works. <br/>
 
be sure you have php-cli installed... <br/>
 
be sure you have php-cli installed... <br/>
walk to <DOC-ROOT>/reg-server/tests/ <br/><br/>
+
walk to /var/www/mydomain.de/weave/reg-server/tests/ <br/><br/>
  
 
edit test_1.0.php and edit the server-setting to meet you apache-config <br/>
 
edit test_1.0.php and edit the server-setting to meet you apache-config <br/>
Zeile 175: Zeile 206:
 
<br/>
 
<br/>
 
have fun! ;-)
 
have fun! ;-)
 +
 +
 +
== see also ==
 +
 +
# official docu for reg-server:  https://wiki.mozilla.org/Labs/Weave/User/1.0/Setup
 +
# official docu for sync-server: https://wiki.mozilla.org/Labs/Weave/Sync/1.0/Setup

Version vom 29. März 2011, 09:06 Uhr

howto install a weave-server for firefox's built-in sync functionallity

requirements

  1. apache2, configured with ssl and a valid certificate.
  2. php-5.1 with json, utf8 and pdo support
  3. mysql-5


install

get the source

mkdir /var/www/mydomain.de/weave
cd /var/www/mydomain.de/weave

wget http://hg.mozilla.org/services/sync-server/archive/tip.tar.gz
mv tip.tar.gz sync-server.tar.gz

wget http://hg.mozilla.org/services/reg-server/archive/tip.tar.gz
mv tip.tar.gz reg-server.tar.gz

tar -xvzf sync-server.tar.gz
tar -xvzf reg-server.tar.gz

mv sync-server-bc2f6caf8fc8 sync-server
mv reg-server-2a73b7376e2c/ reg-server


create the apache vhost

# weave server (firefox build-in sync)
<VirtualHost *:80>
    ServerName weave.mydomain.de
    # SSL only!!!
    Redirect / https://weave.mydomain.de
</VirtualHost>
<VirtualHost *:443>
    ServerName              weave.mydomain.de
    ServerAdmin             webmaster@mydomain.de
    DocumentRoot            /var/www/mydomain.de/weave

    Alias /1.1      /var/www/mydomain.de/weave/sync-server/1.1/index.php
    Alias /1.0      /var/www/mydomain.de/weave/sync-server/1.1/index.php
    Alias /user/1.0 /var/www/mydomain.de/weave/reg-server/1.0/index.php
    Alias /user/1   /var/www/mydomain.de/weave/reg-server/1.0/index.php
    Alias /misc/1.0/captcha_html    /var/www/mydomain.de/weave/reg-server/1.0/captcha.php
    Alias /misc/1/captcha_html      /var/www/mydomain.de/weave/reg-server/1.0/captcha.php
    Alias /weave-registration-static        /var/www/mydomain.de/weave/reg-server/1.0/static
    Alias /weave-password-reset             /var/www/mydomain.de/weave/reg-server/1.0/forgot_password.php

    DirectoryIndex index.php index.html index.htm
    ServerSignature Off

    <Directory "/var/www/mydomain.de/weave/">
        Options Indexes FollowSymLinks
        AllowOverride none
        Order allow,deny
        Allow from all
    </Directory>

    SSLEngine               On
    SSLCertificateFile      /etc/apache2/ssl/_asterisk_.mydomain.de.crt
    SSLCertificateKeyFile   /etc/apache2/ssl/_asterisk_.mydomain.de.key
</VirtualHost>

set up mysql

create database:

create database weave;


create tables:

CREATE TABLE `collections` (
  `userid` int(11) NOT NULL,
  `collectionid` smallint(6) NOT NULL,
  `name` varchar(32) NOT NULL,
  PRIMARY KEY  (`userid`,`collectionid`),
  KEY `nameindex` (`userid`,`name`)
) ENGINE=InnoDB;

CREATE TABLE `wbo` (
  `username` int(11) NOT NULL,
  `collection` smallint(6) NOT NULL default '0',
  `id` varbinary(64) NOT NULL default '',
  `parentid` varbinary(64) default NULL,
  `predecessorid` varbinary(64) default NULL,
  `sortindex` int(11) default NULL,
  `modified` bigint(20) default NULL,
  `payload` longtext,
  `payload_size` int(11) default NULL,
  `ttl` int(11) default '2100000000',
  PRIMARY KEY  (`username`,`collection`,`id`),
  KEY `modified` (`username`,`collection`,`modified`),
  KEY `ttl_idx` (`ttl`)
) ENGINE=InnoDB;

CREATE TABLE `users` (
  id int(11) NOT NULL PRIMARY KEY auto_increment,
  username varbinary(32) NOT NULL,
  password_hash varbinary(128) default NULL,
  email varbinary(64) default NULL,
  status tinyint(4) default '1',
  alert text,
  reset varchar(32),
  reset_expiration datetime
) ENGINE=InnoDB;

create user:

grant all privileges on weave.* to weave@localhost identified by 'mySecurePW';


configure sync-server for mysql

cd /var/www/mydomain.de/weave/sync-server/1.1/
cp -a default_constants.php.dist default_constants.php

now edit this file to meet your sql-db

vi default_constants.php

configure reg-server for mysql

cd ../../reg-server/1.0/
cp -a weave_user_constants.php.dist weave_user_constants.php

now edit this file to meet your sql-db:

vi weave_user_constants.php


bugs

some bugs...


locale bug

list your locale's installed on your system:

locale -a

if you can not find en_US.UTF8 in that list you will have to edit the file /var/www/mydomain.de/weave/sync-server/1.0/weave_user/mysql.php in line 84:

//if (setlocale(LC_CTYPE, "UTF8", "en_US.UTF-8") == false)
if (setlocale(LC_CTYPE, "UTF8", "de_DE.UTF-8") == false)

comment out the line and insert an utf-8 locale installed on your system.
in my case this was 'de_DE.UTF-8'


path bug

there is a path problem in regservers index.
so i edited /var/www/mydomain.de/weave/reg-server/1.0/index.php
in my case the corresponding code starts @ line 49
AND
/var/www/mydomain.de/weave/sync-server/1.1/index.php
in my case the corresponding code starts @ line 49

if (!empty($_SERVER['PATH_INFO']))
         $path = $_SERVER['PATH_INFO'];
     else if (!empty($_SERVER['ORIG_PATH_INFO']))
         $path = $_SERVER['ORIG_PATH_INFO'];
     else if (!empty($_SERVER['REQUEST_URI']))
         $path = $_SERVER['REQUEST_URI'];
     else
         report_problem("No path found", 404);

i added these 2 lines:

else if (!empty($_SERVER['REQUEST_URI']))
    $path = $_SERVER['REQUEST_URI'];


test installation

  TODO: test the server

1st to test is if registration works.
be sure you have php-cli installed...
walk to /var/www/mydomain.de/weave/reg-server/tests/

edit test_1.0.php and edit the server-setting to meet you apache-config
the default value is 'https://localhost' which didn't work for me:

$server = 'https://weave.mydomain.de';

now run:

php test_1.0.php

if the test runs without errors, configure your browser to sync
with your brand new weave-sync-server!

have fun! ;-)


see also

  1. official docu for reg-server: https://wiki.mozilla.org/Labs/Weave/User/1.0/Setup
  2. official docu for sync-server: https://wiki.mozilla.org/Labs/Weave/Sync/1.0/Setup