Labs/Weave/Sync/1.0/Setup: Difference between revisions

Replaced content with "This is deprecated in favor of http://docs.services.mozilla.com/howtos/run-sync.html"
(Replaced content with "This is deprecated in favor of http://docs.services.mozilla.com/howtos/run-sync.html")
 
Line 1: Line 1:
'''It is strongly recommended that you use the [[http://tobyelliott.wordpress.com/2009/09/11/weave-minimal-server Weave Minimal Server]] rather than a full install.'''
This is deprecated in favor of http://docs.services.mozilla.com/howtos/run-sync.html
 
 
[https://wiki.mozilla.org/Labs/Weave/User/1.0/Setup Setting up the User API]
 
 
== 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/services/sync-server/
 
2) Edit your apache conf files to add the following:
 
<pre>
Alias /1.0 <full path to weave directory>/server-sync/1.0/index.php
</pre>
 
3) Copy 1.0/default_constants.php.dist to 1.0/default_constants.php and edit it as described below. If you have multiple hostnames, you can put override constant files into {HOST_NAME}_constants.php
 
== Setting up Weave Authentication ==
 
In default_constants.php at the beginning (e.g. directly after the license-block)
 
<pre>
define('WEAVE_AUTH_ENGINE', '[mysql|none]');
</pre>
 
so for example
 
<pre>
define('WEAVE_AUTH_ENGINE', 'mysql');
</pre>
 
For more information on the auth store, see the [[Labs/Weave/User/1.0/Setup|user setup]]
 
=== 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>
 
== Setting up Weave Storage ==
 
<pre>
define('WEAVE_STORAGE_ENGINE', 'mysql');
</pre>
 
=== Mysql ===
 
Create the mysql database. Add the following tables:
 
<pre>
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 `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.
 
 
== Sample virtual host config ==
Sample Virtual host config for a server having SSL. For debian placed in /etc/apache2/sites-enabled/, weave server directory located at /var/www/weaveserver-sync.
<pre>
<VirtualHost weave.my.domain:443>
 
ServerName weave.my.domain
DocumentRoot /var/www/weaveserver-sync/
 
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-sync/">
 
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
 
Alias /1.0 /var/www/weaveserver-sync/1.0/index.php
 
</VirtualHost>
</pre>
 
In your weave-clients only enter weave.my.domain as server location.
Some hints:
* 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==
Select "Use a custom server" from the sync menu and point it to the root of the API
canmove, Confirmed users
1,173

edits