Documentation‎ > ‎

Mothership

A "Mothership" is just another s3db deployment, where "Sattelite" deployments can register into.
There are two functions for a mothership: to deliver code and to fit as a deployment discovery service. Both functionalities may exist in the same mothership.

How to create a mothership to register

If you are looking into building a mothership only as deployment registry:

1. Create a project (you can download from here the turtle format document and import through S3DB's interface "Import from N3/RDF" feature)

The project should have a collection for the deployments with a set of rules:
PLEASE NOTE: If your rule_ids are different from these, you will need to update config.inc.php accordingly (see below)
Rules
Rule_id Subject Verb Object Notes
1285976 Deployment hasName name  
1285980 Deployment hasDescription description  
1285984 Deployment hasKeywords keywords  
1285972 Deployment hasURL url  
1286310 Deployment hasPublicKey publicKey  
1305897 Deployment belongsTo userName  
1305901 Deployment hasContact email


2. Create a Key for your Admin user (on the webS3DB interface, open the tab named "Keys" and create a new key)
You will need to add this information (both the project_id, the collection_id and the key) to your config.inc.php. This file can be accessed in S3DB's main directory (e.g. /var/www/s3db_mothership/config.inc.php)


Deployment mothership

$GLOBALS['deployment_project']['key'] = 'your Admin key here';
$GLOBALS['deployment_project']['project_id']='1285964';
$GLOBALS['deployment_project']['collection_id']='1285965';

(Note: Don't forget to replace the ids in this example with your project and collection_id)

3. You are done! 

Make sure your Mothership deployment is accepting registrations by using the s3rl.php function described here. Don't forget to replace the default mothership URL with your own mothership URL. You can try a mock url and publicKey for testing, S3DB will not care (e.g. url=http://localhost/mynewdeploymetn&publicKey=test&name=D12345)


How to create a mothership for code updates

To create a "MotherShip" deployment for code distribution, you will need to create:
- A project 
- A collection in that project 
- 2 rules, one where the file itself will be uploaded into, one where the path where the file should go to.


The Ids of there will need to be copied into your config.inc.php:
(NOTE: Use the following code as example. You will need to create a user, e.g. daemon, with a key, as well as a project, a collection and two rules.)

Mothership Reference

    $GLOBALS['update_project']['key']='your daemon key here';
    $GLOBALS['update_project']['project_id']='7';
    $GLOBALS['update_project']['collection_id']='8';
    $GLOBALS['update_project']['file']['rule_id']='19';
    $GLOBALS['update_project']['path']['rule_id']='15';
ATTENTION: This projects needs to be made available for the user "public" such that your registered deployments may have access to the source code.

Querying the mothership

The mothership or root of S3DB deployments can be used to resolve an S3DB deployment namespace within using the api function msredirect.php

PLEASE NOTE: msredirect.php will only work IF you have set up Apache to enable .htaccess override:

msredirect.php

URI: http://root.s3db.org/msredirect.php

Arguments:
name: name/title given to deployment at the time of registry)
redirect: 0 does not redirect; 1 redirects to discovered uri
func: apifunction that will be appended to the resolved DNS
args: arguments to be appended to the apifunction indicated in 'func'; these must be url-encoded 

Example:
http://root.s3db.org/msredirect.php?name=TCGA&func=URI&args=uid&equal;P126

ċ
mothership.n3
(5k)
Helena Deus,
Sep 15, 2010, 7:43 AM
Comments