QueryApp: enhance documentation of local installation via local::lib
[omc-tools.git] / README.md
1 QueryApp
2 ========
3
4 A web app to answer OpenSSL queries, primarely to serve anything that
5 uses the OpenSSL::Query modules.
6
7 This includes an OpenSSL::Query implementation that looks directly at
8 the databases, OpenSSL::Query::DB.
9
10 This also includes a query.psgi that is used to serve the data, and a
11 couple of dispatchers for CGI and FCGI.  These are designed to be used
12 directly in the checkout, but will work if copied elsewhere as well,
13 as long as the OpenSSL::Query::DB module is installed.
14
15 REST API
16 --------
17
18 RESTAPI.txt documents the details of the REST API provided by QueryApp.
19
20 Requirements
21 ------------
22
23 OpenSSL::Query requires the following modules to build:
24
25 - Module::Install               (debian package libmodule-install-perl)
26
27 OpenSSL::Query requires these extra modules to run:
28
29 - YAML::XS                      (debian package libyaml-libyaml-perl)
30 - Moo                           (debian package libmoo-perl)
31 - Dancer2                       (debian package libdancer2-perl)
32 - Plack                         (debian package libplack-perl)
33 - URI::Encode                   (debian package liburi-encode-perl)
34 - Clone                         (debian package libclone-perl)
35 - OpenSSL::Query                (from ../OpenSSL-Query)
36
37 Any other module OpenSSL::Query depends on should be part of core
38 perl.
39
40 Installation
41 ------------
42
43     $ perl Makefile.PL
44     $ make
45     $ make install
46
47 Local installation
48 ------------
49
50 For a local installation, you might want to consider using local::lib
51 (debian package liblocal-lib-perl).  In that case, running Makefile.PL
52 is slightly different:
53
54     $ perl -Mlocal::lib Makefile.PL
55
56 Other than that, follow the instructions in "Installation" above.
57
58 The local installation method works best if the `PERL5LIB` environment variable
59 (among others) is set correctly in the shell profile. A comprehensive guide how
60 to do it correctly can be found in the manual page (`perldoc local::lib`,
61 or online at [local::lib](https://metacpan.org/pod/local::lib)).
62
63 Essentially, it boils down to adding the following line to your shell profile
64 (e.g. `.bash_profile`, `.bashrc` for bash):
65
66     eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
67
68 The inner perl command will print roughly the following output, which then gets
69 evaluated by the shell to update the environment accordingly.
70
71     PATH="/home/<user>/perl5/bin${PATH:+:${PATH}}"; export PATH;
72     PERL5LIB="/home/<user>/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
73     PERL_LOCAL_LIB_ROOT="/home/<user>/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
74     PERL_MB_OPT="--install_base \"/home/<user>/perl5\""; export PERL_MB_OPT;
75     PERL_MM_OPT="INSTALL_BASE=/home/<user>/perl5"; export PERL_MM_OPT;
76
77 Testing
78 -------
79
80 Testing is done like this:
81
82     $ make test