mementoweb / timegate

A Memento TimeGate
Other
40 stars 15 forks source link

Documentation Updates #13

Open ibnesayeed opened 8 years ago

ibnesayeed commented 8 years ago

Lately, there were some big changes such as #5 and #11. I think we should consider updating the documentation in the README and well as in the Wiki to better reflect the current state and simplified installation and run instructions, both from pip (when released) and from the checked out code.

jirikuncar commented 8 years ago

Shall we move the Wiki to docs? IMHO it's easier to keep the documentation up-to-date when it's part of the source code.

tiborsimko commented 8 years ago

Shall we move the Wiki to docs?

I had actually started something in this direction. Can issue a PR to illustrate this.

ibnesayeed commented 8 years ago

Somewhere there should be a step by step guide for downloading, installing, running, and making the first change. Perhaps the Getting Started would be a good place to put such instructions (current getting started document is obsolete). Please note that these are just illustrative steps that might not be accurate or complete.


The instructions might look something like this:

Install the TimeGate (and uWSGI) globally:

$ pip install -e "git+https://github.com/mementoweb/timegate.git#egg=TimeGate[uwsgi]"

Alternatively, clone the repository in the current working directory, change the working directory and install dependencies:

$ git clone git@github.com:mementoweb/timegate.git
$ cd timegate
$ pip install -e .[uwsgi]

Run an example instance of TimeGate proxy:

$ uwsgi --http :9999 -s /tmp/mysock.sock --module timegate.application --callable application

This will run the TimeGate proxy service on port 9999 with a built-in example simple example handler. To make sure every thing is setup correctly, fetch an example TimeMap from this instance, run the following command in a separate terminal and watch :

$ curl -i http://localhost:9999/simple/timemap/json/http://www.example.com/resourceA

This should return the following response:

HTTP/1.1 200 OK
Headers: Values

{"actual": "json response"}

To verify that the Datetime negotiation works well, make a TimeGate request with custom Accept-Datetime header:

$ curl -i -H "Accept-Datetime: Sun, 17 Oct 2010 21:42:31 GMT" http://localhost:9999/simple/timegate/http://www.example.com/resourceA

It should return:

HTTP/1.1 302 Found
Headers: Values
Link: <links>
Location: http://www.example.com/resourceA_v2

If everything worked as described so far then your environment is configured properly. Open the timegate/conf/config.ini file in a text editor (assuming that the repository was cloned in the installation step) and make the following changes:

handler_class = timegate.examples.webcite:WebCiteHandler
is_vcs = false

Now, stop the service and start again for the changes to take effect. Then run the following command to verify that the WebCite Timegate proxy is running properly:

$ curl -i http://localhost:9999/webcite/timemap/link/http://www.example.com/

The response should look like this:

A truncated response in Link format

Please read the detailed documentation to learn about other configuration options and to implement your custom proxy.