notice and save changes to graph name / stemma identifier (tla/stemmaweb#28)
[scpubgit/stemmatology.git] / analysis / idp_server / README.IDP.txt
CommitLineData
e3bf7a69 1This directory contains the necessary scripts and machinery for running
2the IDP graph calculation service. Installation is a little intricate as
3it includes several components:
4
5* The IDP system itself (available from
6 http://dtai.cs.kuleuven.be/krr/software/idp)
7* The *.idp and *.lua scripts in this directory
8* A Perl DBI-compatible database for the storage of calculation results
9* A Gearman server for dispatching calculation requests
10* The Perl script in this directory, which functions as a Gearman worker
11* The CGI script in this directory, which functions as a Gearman client
12
13INSTALLATION
14============
15
160. Decide on a location for the following:
17* The IDP system software (e.g. /usr/local/idp)
18* The graph calculation IDP scripts (e.g. $HOME/graphcalc or
19 /usr/local/idp/script)
20* The database for storage of calculation results
21
22Support software and packages
23-----------------------------
241. Compile and install IDP for your platform into your chosen directory.
25See http://dtai.cs.kuleuven.be/krr/software/idp for more information.
26
272. Install (or designate) a Gearman server. The relevant Ubuntu package is 'gearman-job-server'; installing it will set up a server on localhost.
28
293. Ensure that the following Perl (v5.12 or later) dependencies are
30installed:
31* Gearman::Client
32* Gearman::Worker
33* Graph
34* Graph::Reader::Dot
35* IPC::Run
36* JSON
37* Text::Tradition::Analysis
38* Text::Tradition::Directory
39* TryCatch
40
414. Install (or designate) a Supervisor daemon. The relevant Ubuntu
42package is 'supervisor'; installing it will start a daemon on localhost.
43
44Graph calculation service components
45------------------------------------
46
475. Create a file /etc/graphcalc.conf as in the example here, substituting appropriate
48values for your system:
49--- START CONF FILE ---
50DBTYPE = <database server type (e.g. mysql / Pg / SQLite / Sybase),
51 default mysql>
52DBHOST = <database server host name or IP, default 127.0.0.1>
53DBPORT = <database server port, default 3006>
54DBNAME = <database for storage of results, default 'idpresult'>
55DBUSER = <database username, default undef>
56DBPASS = <password for database username, default undef>
57GEARMAN_SERVER = <Gearman server host and port,
58 default 127.0.0.1:4730>
59IDPBINPATH = <location of 'idp' binary, default /usr/local/idp/bin>
60IDPSCRIPTPATH = <location of graph calculation scripts,
61 default /usr/local/idp/script>
62TMPDIR = <location for temporary files, default /var/tmp>
63---- END CONF FILE ----
64
65The DBTYPE should be set to a value for which a Perl DBD::* module
66exists. You may optionally specify a value for 'DSN' instead of listing
67the type, host, port, and name separately, but this will break the
68backup and restore scripts.
69
706. Copy the *.idp, *.lua, and *.pl scripts from this directory to the
71directory specified in IDPSCRIPTPATH.
72
737. Create a database for the storage of calculation results. On MySQL
74this can be done with the following sequence of statements, where
75'user', 'host', and 'password' are chosen appropriately:
76
77CREATE DATABASE idpresult;
78GRANT ALL PRIVILEGES ON idpresult.* TO "[user]"@"[host]"
79--> IDENTIFIED BY "[password]";
80FLUSH PRIVILEGES;
81
828. Copy the graphcalc.cgi script to the cgi-bin directory of your
83webserver, ensuring that it is executable and that the file permissions
84are set appropriately.
85
869. Start one or more instances of the gearman_worker.pl script. It is
87recommended that this be done through the Supervisor daemon. An example
88Supervisor configuration script is given here:
89
90--- START SUPERVISOR CONF ---
91[program:graphcalc_worker]
92command=/usr/local/idp/script/graphcalc_worker.pl
93process_name=%(program_name)s.%(process_num)s
94numprocs=4
95user=www-data
96---- END SUPERVISOR CONF ----
97
9810. Run the idpinit.pl script to initialize the database.
99
10011. Requests can now be sent via CGI to graphcalc - you're done!
101
102Maintenance scripts
103-------------------
104Two maintenance scripts, idpbackup.pl and idprestore.pl, are included
105with this distribution. Each of these scripts can be invoked with no
106arguments.
107
108At the moment the restore script assumes that the database is on a MySQL
109server; it does not know how to drop tables for any other database. The
110backup script will dump all calculation results to
111TMPDIR/idpresults.json; the restore script will wipe the database and
112load them from the temp file. If nothing unexpected happens, the restore
113script will also clean up the temp file.