Services/Sync/Server/Archived/0.5/Setup/Storage: Difference between revisions

From MozillaWiki
< Services‎ | Sync‎ | Server‎ | Archived
Jump to navigation Jump to search
(Replaced content with 'This server is deprecated. Please use [https://wiki.mozilla.org/Labs/Weave/API the new servers]')
Line 1: Line 1:
[https://wiki.mozilla.org/Labs/Weave/User/1/Setup Setting up the User API]
This server is deprecated. Please use [https://wiki.mozilla.org/Labs/Weave/API the new servers]
 
[https://wiki.mozilla.org/Labs/Weave/0.5/Setup/Migration Migration from 0.3 server]
 
== Pre-Setup Considerations ==
 
It is strongly recommended that the Weave Server be set up under https, or behind a firewall with an https proxy in front of it. It uses standard http auth, which will send the password in the clear unless done over https.
 
The Weave Server requires PHP with PDO and JSON support installed. This should be the case if you are running PHP 5.1+. PDO will need drivers for whatever storage and authentications engines are used.
 
WebDav must not be enabled for this server - it intercepts some of the http packets and syncing will fail.
 
== Setting up the Server ==
 
1) You can get the latest server from http://hg.mozilla.org/labs/weaveserver (there you can download it in different formats). Once things are fully established, we'll declare certain builds as stable, but for now assume all releases are beta quality. Unzip it into your html tree.
 
2) Edit your apache conf files to add the following:
 
<pre>
Alias /0.5 <full path to weave directory>/server/0.5/index.php
</pre>
 
Don't forget to set up the weave directory in a virtual-host-directive (or similar), or else php will not work. (See sample virtual host config below)
 
3) Copy /server/0.5/default_constants.php.dist to /server/0.5/default_constants.php and edit it as described below. If you have mutiple hostnames, you can put override constant files into {HOST_NAME}_constants.php
 
== Setting up Weave Authentication ==
 
In weave_constants.php at the beginning (e.g. directly after the license-block)
 
<pre>
define('WEAVE_AUTH_ENGINE', '[sqlite|mysql|ldap|none]');
</pre>
 
so for example
 
<pre>
define('WEAVE_AUTH_ENGINE', 'mysql');
</pre>
 
For more information on the auth store, see the user setup
 
=== Sqlite ===
 
<pre>
define('WEAVE_SQLITE_AUTH_DIRECTORY', '<path to stores directory>');
</pre>
 
 
=== Mysql ===
 
<pre>
define('WEAVE_MYSQL_AUTH_HOST', '<db host>');
define('WEAVE_MYSQL_AUTH_DB', '<db name>');
define('WEAVE_MYSQL_AUTH_USER', '<db username>');
define('WEAVE_MYSQL_AUTH_PASS', '<db password>');
</pre>
 
(Note that you don't need to define the second set of constants if you are using the same db for reads and writes)
 
== Setting up Weave Storage ==
 
<pre>
define('WEAVE_STORAGE_ENGINE', '[sqlite|mysql|none]');
</pre>
 
=== Sqlite ===
 
Edit the following constant:
 
<pre>
define('WEAVE_SQLITE_STORE_DIRECTORY', '<path to stores directory>');
</pre>
 
Easiest way to create a user is to go through the admin server process below.
 
=== Mysql ===
 
Create the mysql database. Add the following table:
 
<pre>
CREATE TABLE `wbo` (
  `username` varbinary(32) NOT NULL default '',
  `collection` varbinary(64) NOT NULL default '',
  `id` varbinary(64) NOT NULL default '',
  `parentid` varbinary(64) default NULL,
  `predecessorid` varbinary(64) default NULL,
  `modified` decimal(12,2) default NULL,
  `sortindex` int(11) default NULL,
  `depth` tinyint(4) default NULL,
  `payload` longtext,
  `payload_size` int(11) default NULL,
  PRIMARY KEY  (`username`,`collection`,`id`),
  KEY `parentindex` (`username`,`collection`,`parentid`),
  KEY `modified` (`username`,`collection`,`modified`),
  KEY `weightindex` (`username`,`collection`,`sortindex`),
  KEY `predecessorindex` (`username`,`collection`,`predecessorid`),
  KEY `size_index` (`username`,`payload_size`)
) ENGINE=InnoDB
</pre>
 
 
Edit your constant file:
 
<pre>
define('WEAVE_MYSQL_STORE_READ_HOST', '<db host>');
define('WEAVE_MYSQL_STORE_READ_DB', '<db name>');
define('WEAVE_MYSQL_STORE_READ_USER', '<db username>');
define('WEAVE_MYSQL_STORE_READ_PASS', '<db password>');
 
define('WEAVE_MYSQL_STORE_WRITE_HOST', WEAVE_MYSQL_STORE_READ_HOST);
define('WEAVE_MYSQL_STORE_WRITE_DB', WEAVE_MYSQL_STORE_READ_DB);
define('WEAVE_MYSQL_STORE_WRITE_USER', WEAVE_MYSQL_STORE_READ_USER);
define('WEAVE_MYSQL_STORE_WRITE_PASS', WEAVE_MYSQL_STORE_READ_PASS);
</pre>
 
== Other Constants ==
 
<pre>
define('WEAVE_PAYLOAD_MAX_SIZE', '<bytes>');
</pre>
 
Caps the size (in bytes - watch out for large unicode characters!) of a payload.
 
<pre>
define('WEAVE_SHARE_DBH', '1');
</pre>
 
If both the storage engine and authentication engine are using the same database, setting this makes both engines use the same database handler rather than opening different ones. Note that SQLite cannot use the same db for authentication and storage.
 
== Sample virtual host config ==
Sample Virtual host config for a server having SSL enabled and requiring http authentication. For debian placed in /etc/apache2/sites-enabled/, weave server directory located at /var/www/weaveserver/server/.
<pre>
<VirtualHost weave.my.domain:443>
 
ServerName weave.my.domain
DocumentRoot /var/www/weaveserver/server/
 
ErrorLog /var/log/apache2/weaveserver-error.log
CustomLog /var/log/apache2/weaveserver-access.log combined
 
SSLENgine on
SSLCertificateKeyFile /path/to/server.cert.key
SSLCertificateFile /path/to/server.cert.crt
 
<Directory "/var/www/weaveserver/server/">
 
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
AuthType Basic
AuthName "Weave Server"
AuthUserFile /path/to/auth/file
require valid-user
 
</Directory>
 
Alias /0.5 /var/www/weaveserver/server/0.5/index.php
 
</VirtualHost>
</pre>
 
In your weave-clients only enter https://weave.my.domain as server location.
Some hints:
* the username/password of the http-authentication must be the same as the one for the weave-user, or else it won't work
* if you have a self-signed certificate for SSL (or it is not valid because of any other reason) you have to visit your server once manually and accept the certificate permanently
 
==Editing the Client==
In about:config, set extensions.weave.ServerUrl to https://servername/user

Revision as of 18:42, 29 January 2010

This server is deprecated. Please use the new servers