Services/Sync/Server/Archived/0.3/Setup: Difference between revisions

From MozillaWiki
< Services‎ | Sync‎ | Server‎ | Archived
Jump to navigation Jump to search
 
(56 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Pre-Setup Considerations ==
= 0.3 Setup =


It is strongly recommended that the Weave Server be set up under https, especially if you are planning to use Apache basic authorization for access control.
<b>This client and server have been deprecated</b>


The Weave server doesn't handle authentication, which can be done through any method you choose. Nor does it require authentication (unless the USER_MATCH variables are set, in whch case the server requires HTTP_AUTH_USER to be passed through).  
Here you'll find instructions on how to set up a 0.3 client and server for testing and/or development.


The Weave Server requires PHP with PDO and JSON support installed. This should be the case if you are running PHP 5.1+.
== Server Setup ==


== Setting up the Weave Server (Sqlite backend) ==
To use Weave you will need a compatible (version 0.3 or higher) server.  You may use https://services.mozilla.com/ if you have an account there, or you may set up your own.  See the [[Labs/Weave/0.3/Setup/Server|Server Setup]] page for instructions on how to do that.


1) Unzip the weave_server.zip directory into the location you plan to serve the files from.
== Client Setup ==


2) Create your directory for the stores. Make sure that the folder is writeable by the apache user, and add it to open_basedir in your php.ini file.
The latest released XPI is available [https://people.mozilla.com/~cbeard/weave/dist/latest-weave.xpi here].  For those who wish to be on the bleeding edge, however, using mercurial (hg) is the best method. hg is also the easiest way to develop patches for Weave. To use the latest hg version:


3) Edit your apache conf files to add the following:
# Install [http://www.selenic.com/mercurial/wiki/ mercurial]
# Run <tt>hg clone https://hg.mozilla.org/labs/weave/</tt> to download the latest version to the 'weave' directory.
# <tt>cd weave</tt> and then <tt>make xpi</tt>, that will create an xpi file that you can then drag-and-drop to Firefox to install.


<pre>
That's it!  To stay up-to-date, you'll want to regularly run <tt>hg pull -u</tt> from inside the <tt>weave</tt> directory, and if any updates were downloaded then <tt>make xpi</tt> and install again.
Alias /weave/0.3 <full path to weave directory>/index.php
SetEnv WEAVE_STORAGE_TYPE sqlite
SetEnv WEAVE_SQLITE_DIRECTORY <path to stores directory>
</pre>


There is an alternate method of setting it up that doesn't require you to make an xpi and drag-and-drop to Firefox.  Instead, you can set things up so that Firefox uses the <tt>weave</tt> directory directly.  To do that:


== Setting up the Weave Server (Mysql backend) ==
# Run <tt>make build</tt> -- this is necessary to create an appropriate <tt>chrome.manifest</tt> file. You will need to re-run <tt>make build</tt> if you ever run <tt>make xpi</tt> (but otherwise there is no need to re-run it).
 
# Locate your Firefox profile directory.  This varies depending on platform, but in general:
1) Unzip the weave_server.zip directory into the location you plan to serve the files from.
#* On OS X it is in <tt>~/Library/Application\ Support/Firefox/Profiles/</tt>
 
#* On Linux it is in <tt>~/.mozilla/</tt>
2) Create the mysql database. Add the following table:
#* On Windows it is in the <tt>AppData</tt> directory.
 
# Go to the <tt>extensions</tt> directory inside your profile, and:
<pre>
#* On OS X and Linux, a symlink is the easiest way: <tt>ln -s /path/to/weave '{340c2bbc-ce74-4362-90b5-7c26312808ef}'</tt>
create table wbo
#* On Windows, create a text file called <tt>{340c2bbc-ce74-4362-90b5-7c26312808ef}</tt> and inside place on a single line the path to the weave checkout (<tt>C:\whatever</tt>).
(
# Restart Firefox
username varchar(32),
collection varchar(64),
id varchar(64),
parentid varchar(64),
modified float,
encoding varchar(16),
payload text,
primary key(username, collection, id),
index parentindex(username, collection, parentid),
index modified(username, collection, modified)
) type=InnoDB;
</pre>
 
3) Edit your apache conf files to add the following:
 
<pre>
Alias /weave/0.3 <full path to weave directory>/index.php
SetEnv WEAVE_STORAGE_TYPE mysql
SetEnv WEAVE_MYSQL_HOST <db host>
SetEnv WEAVE_MYSQL_DB <db name>
SetEnv WEAVE_MYSQL_USER <db username>
SetEnv WEAVE_MYSQL_PASS <db password>
</pre>
 
== Optional Apache Parameters ==
 
<pre>
SetEnv WEAVE_USER_MATCH_READ 1
</pre>
 
Requires the http-authenticated user to match the name of the user in the path in order to read from the store (recommended)
 
<pre>
SetEnv WEAVE_USER_MATCH_WRITE 1
</pre>
 
Requires the http-authenticated user to match the name of the user in the path in order to write to the store (recommended)
 
== Testing the Weave Server ==
 
The load_data.pl script will run a series of tests against your server, creating, modifying, selecting from and deleting a collection. Make sure to change the three parameters at the top before running it. Also, the script requires the libwww-perl module.
 
== Creating Accounts ==
If WEAVE_AUTO_CREATE_USER is set, then a user account will be created on the first request. If not, the following code snippet (which can be run outside of the apache environment) will allow you to create an account:
 
<pre>
<?php
 
require_once 'weave_storage.inc';
$db = new WeaveStorage($USERNAME,1);
$db->set_path($WEAVE_DB_DIRECTORY);
$db->create_user_path();
$db->initialize();
 
?>
</pre>

Latest revision as of 03:07, 12 July 2010

0.3 Setup

This client and server have been deprecated

Here you'll find instructions on how to set up a 0.3 client and server for testing and/or development.

Server Setup

To use Weave you will need a compatible (version 0.3 or higher) server. You may use https://services.mozilla.com/ if you have an account there, or you may set up your own. See the Server Setup page for instructions on how to do that.

Client Setup

The latest released XPI is available here. For those who wish to be on the bleeding edge, however, using mercurial (hg) is the best method. hg is also the easiest way to develop patches for Weave. To use the latest hg version:

  1. Install mercurial
  2. Run hg clone https://hg.mozilla.org/labs/weave/ to download the latest version to the 'weave' directory.
  3. cd weave and then make xpi, that will create an xpi file that you can then drag-and-drop to Firefox to install.

That's it! To stay up-to-date, you'll want to regularly run hg pull -u from inside the weave directory, and if any updates were downloaded then make xpi and install again.

There is an alternate method of setting it up that doesn't require you to make an xpi and drag-and-drop to Firefox. Instead, you can set things up so that Firefox uses the weave directory directly. To do that:

  1. Run make build -- this is necessary to create an appropriate chrome.manifest file. You will need to re-run make build if you ever run make xpi (but otherwise there is no need to re-run it).
  2. Locate your Firefox profile directory. This varies depending on platform, but in general:
    • On OS X it is in ~/Library/Application\ Support/Firefox/Profiles/
    • On Linux it is in ~/.mozilla/
    • On Windows it is in the AppData directory.
  3. Go to the extensions directory inside your profile, and:
    • On OS X and Linux, a symlink is the easiest way: ln -s /path/to/weave '{340c2bbc-ce74-4362-90b5-7c26312808ef}'
    • On Windows, create a text file called {340c2bbc-ce74-4362-90b5-7c26312808ef} and inside place on a single line the path to the weave checkout (C:\whatever).
  4. Restart Firefox