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

< Services‎ | Sync‎ | Server‎ | Archived
 
(50 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, or behind a firewall with an https proxy in front of it, 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>


== Setting up the Weave Server (Mysql backend) ==
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:


1) Unzip the weave_server.zip directory into the location you plan to serve the files from.
# 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:
2) Create the mysql database. Add the following table:
#* On OS X it is in <tt>~/Library/Application\ Support/Firefox/Profiles/</tt>
 
#* On Linux it is in <tt>~/.mozilla/</tt>
<pre>
#* On Windows it is in the <tt>AppData</tt> directory.
create table wbo
# Go to the <tt>extensions</tt> directory inside your profile, and:
(
#* On OS X and Linux, a symlink is the easiest way: <tt>ln -s /path/to/weave '{340c2bbc-ce74-4362-90b5-7c26312808ef}'</tt>
username varchar(32),
#* 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>).
  collection varchar(64),
# Restart Firefox
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)
) engine=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)
 
<pre>
SetEnv 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.
 
== 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.

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