Skip to content

Sample FAqT deployment

timrdf edited this page May 11, 2012 · 73 revisions

What's first

What we'll cover

We'll deploy the FAqT evaluation services in the github repository from a public web server using twistd. Once deployed, they can be listed at the SADI registry and contribute to future [evaluation epochs](FAqT Brick).

Let's get to it

When [developing an example](SADI Semantic Web Services framework) FAqT Service in python, we deployed it temporarily by invoking the script from the command line, which put it on localhost on port 9090. Although this is really convenient for development, it is not suitable for long-term public deployment. This page describes how to make a finished SADI service implementation available on the web for others to use.

As an example, we'll show how we deployed services/sadi/contextual-inverse-functional/contextual-inverse-functional.rpy on one of TWC's machines, http://sparql.tw.rpi.edu.

Step 1: First, we'll get DataFAQs' source code, putting it in /opt:

cd /opt
sudo git clone git://github.com/timrdf/DataFAQs.git

Piggy-back on an existing twisted configuration

Twisted provides an "application container" (in J2EE speak) functionality for a directory of python scripts.

LOBD uses this Twisted configuration to provide an "application container" for the SADI services in LOBD:

from twisted.application import internet, service
from twisted.web import static, server, script

root = static.File("/twc-lobd/twc-lobd-read-only/twc-lobd/services")
root.ignoreExt(".rpy")
root.processors = {'.rpy': script.ResourceScript}
application = service.Application('web')
sc = service.IServiceCollection(application)
site = server.Site(root)
i = internet.TCPServer(8080, site)
i.setServiceParent(sc)

Step 2: The above configuration is used to start Twisted like this:

cd /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf
sudo kill -9 `sudo cat twistd.pid`
export X_CKAN_API_Key=
twistd -y /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/lobd.tac

which exposes the following local script onto the web at the following URL:

/twc-lobd/twc-lobd-read-only/twc-lobd/services/sadi/services/frbr/frbrget.rpy is available on the web at
                           http://sparql.tw.rpi.edu/services/frbr/frbrget

Step 3: Until we can setup on our own, we'll save some time and deploy within that by linking our directory of services into the one Twisted is already looking for:

sudo ln -s /opt/DataFAQs/services/sadi/ /twc-lobd/twc-lobd-read-only/twc-lobd/services/sadi/services/datafaqs

This will expose the service available on the web at:

               /opt/DataFAQs/services/sadi/contextual-inverse-functional/contextual-inverse-functional.rpy
http://sparql.tw.rpi.edu/services/datafaqs/contextual-inverse-functional/contextual-inverse-functional

Step 4: Use it! We can use the same curl commands as when we were [developing the SADI service](SADI Semantic Web Services framework):

curl -LO https://raw.github.com/timrdf/DataFAQs/master/services/sadi/contextual-inverse-functional/sample-inputs/myPa.ttl
curl -H "Content-Type: text/turtle" -d @myPa.ttl http://sparql.tw.rpi.edu/services/datafaqs/contextual-inverse-functional/contextual-inverse-functional

Step 5: Restart twisted

sudo kill -9 `sudo cat /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/twistd.pid`
cd /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/
sudo twistd -y /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/lobd.tac

Deployed services

SADI service registry

Once deployed, services can be registered at http://sadiframework.org/registry/register/. Paste the URI of your deployed service into the text box and press the ... and click here to register it button. The registry dereferences the service URI to get its RDF description, dereferences its input and output class URIs, and stores the descriptions into http://biordf.net/sparql's graph http://sadiframework.org/registry/. After registering your service, it will be listed at http://sadiframework.org/registry/services. to get the list yourself, use a query such as:

# query http://biordf.net/sparql endpoint
SELECT DISTINCT ?service
FROM <http://sadiframework.org/registry/>
WHERE {
   ?service a <http://www.mygrid.org.uk/mygrid-moby-service#serviceDescription>
}

What's next

Clone this wiki locally