-
Notifications
You must be signed in to change notification settings - Fork 15
Getting Started
TimeGate is a WSGI application server that allows simple implementation of Memento capabilities for web resources having accessible revisions. It manages all the content negotiation logic, from request processing, best memento query and selection to HTTP response.
To make web resources that is accessible on a web server fully Memento compliant, two things need to be done.
- TimeGate is generic: a custom handler must be plugged in to match the specific web server.
- The Memento framework uses specific HTTP headers: they must be added to the resource's web server responses.
The first thing to do is to understand how the program is structured.
The code can be obtained here. Download a zip or tar.gz archive into a directory of your choice.
Decompress the zip files using:
$ unzip timegate-<version>.zipDecompress tar.gz files using:
$ tar xvzf timegate-<version>.tar.gzInstall the dependencies using:
$ echo 'uWSGI>=2.0.3 ConfigParser>=3.3.0r2 python-dateutil>=2.1 requests>=2.2.1 werkzeug>=0.9.6 lxml>=3.4.1' | xargs pip installThen try starting the TimeGate server with one of the handler that is already provided. To run it, first navigate to the directory:
$ cd timegate-<version>Then, there are two possibilities:
- Either execute
uwsgi --http :9999 --wsgi-file core/application.py --masterto deploy the TimeGate onlocalhost:9999. Add the option--pidfile /path/to/file.pidto store the process ID in a file. - Or edit the uWSGI launch configuration in
conf/timegate.iniand then executeuwsgi conf/timegate.ini
To stop the server:
- Simply use
CTRL+Cif it is running in foreground. - Or execute
uwsgi --stop /path/to/file.pidif you have stored the PID to run it in the background. - If by mistake the PID is not stored but the TimeGate is still running, list all uwsgi processes using
ps ux | grep uwsgi, identify the TimeGate process from theCOMMANDcolumn and kill it usingkill -INT <PID>.
Once the server is successfully running with an example handler that was provided, edit it or create a new one that returns the list of all URI-Ms given a URI-R of an Original Resource you wish to make Memento compliant.
The Memento protocol mainly works with HTTP headers. Now add the required headers to your web server's HTTP responses.
Finally, enter the TimeGate's HOST location in the config.ini file. Also edit the other parameters' default values to your preferences.
That's it. The basic Memento functionalities are here and your web server is now Memento compliant. See the wiki page for advanced features.