-
Notifications
You must be signed in to change notification settings - Fork 4
Installation
Giulio edited this page Jan 3, 2023
·
6 revisions
sudo bash
mkdir /opt/perl5
sudo chown user:group -R /opt/perl5/
export PERLBREW_ROOT=/opt/perl5
curl -kL http://install.perlbrew.pl | bash
sudo vi ~/.bash_profile
#add 'source /opt/perl5/etc/bashrc'
#add export MOJO_MAX_MESSAGE_SIZE=1073741824
#add export MOJO_INACTIVITY_TIMEOUT=300
#add export MOJO_HEARTBEAT_TIMEOUT=300
# ev set the MOJO_TMPDIR variable
perlbrew install perl-5.16.0
perlbrew switch perl-5.16.0
# chown again
sudo chown user:group -R /opt/perl5/
Optional, but makes installing Perl modules easy.
curl -L cpanmin.us | perl - App::cpanminus
curl get.mojolicio.us | sh
cpanm Mango # (if you want the latest version, see downgrade/manual install instructions below)
cpanm MooX::Types::MooseLike::Numeric
cpanm MooX::Types::MooseLike
cpanm Mojolicious::Plugin::Database
cpanm Mojolicious::Plugin::Session
cpanm Mojolicious::Plugin::CHI
cpanm Mojolicious::Plugin::I18N
cpanm Mojolicious::Plugin::Authentication
cpanm Net::LDAPS
cpanm IO::Socket::SSL
cpanm IO::Scalar
cpanm Sereal
cpanm Crypt::CBC
cpanm Crypt::Rijndael
cpanm Crypt::URandom
cpanm Math::Random::ISAAC::XS
cpanm MIME::Base64
cpanm Switch
cpanm SOAP::Lite
cpanm Log::Log4perl
cpanm LWP::UserAgent::Determined
cpanm File::MimeInfo::Magic
cpanm XML::Writer
# before attempting XML::LibXML!
cpanm XML::SAX
# needed to install the headers needed by XML::LibXML install
cpanm Alien::LibXML
sudo ln -s /usr/lib64/libxml2.so.2 /usr/lib64/libxml2.so
# will possibly fail
cpanm XML::LibXML
# or wherever the Alien::LibXML was extracted
cd /home/hudakr4/.cpanm/work/1424958029.9603/XML-LibXML-2.0118
/opt/perl5/perls/perl-5.16.0/bin/perl Makefile.PL LIBS='-L/usr/lib64' INC='-I/usr/include -I/opt/perl5/perls/perl-5.16.0/lib/site_perl/5.16.0/auto/share/dist/Alien-LibXML/include/libxml2' DEBUG=1 2>&1
make
cpanm XML::LibXML
cpanm XML::XPath
sudo yum install expat-devel
cpanm XML::Parser
cpanm XML::Parser::PerlSAX
sudo yum remove expat-devel
sudo yum install mysql-devel
cpanm DBD::mysql
sudo yum remove mysql-devel
Downgrade the Mango version if needed (Mango supports always only the latest MongoDB version)
wget -N http://cpan.metacpan.org/authors/id/S/SR/SRI/Mango-0.24.tar.gz
gzip -d Mango-0.24.tar.gz
tar xvf Mango-0.24.tar
cd Mango-0.24
perl Makefile.PL
make
make test
make install
Some API methods might expect a particular state of the Fedora installation (jar file version, policies, etc).
Phaidradb update
UPDATE metadata SET sequence = 6 WHERE xmlname = 'infoeurepoversion' AND mid_parent = 10;
UPDATE metadata SET sequence = 7 WHERE xmlname = 'metadataqualitycheck' AND mid_parent = 10;
ALTER TABLE taxon ADD INDEX (upstream_identifier);
Install and configure git
yum install git
git config --global user.name "YourUserName"
git config --global user.email "yourEmail"
# optionally add your git key to .ssh
# eval "$(ssh-agent -s)"
# ssh-add ~/.ssh/id_rsa (the id_rsa.pub must be configured on your github account, see https://help.github.com/articles/generating-ssh-keys/#step-4-add-your-ssh-key-to-your-account)
# check: ssh -T [email protected]
Get API
git clone [email protected]:phaidra/phaidra-api.git api/
Configure API (see PhaidraAPI.json as an example) and create a symbolic link to the config
cd api
vi /etc/phaidra/PhaidraAPI.json
ln -s /etc/phaidra/PhaidraAPI.json PhaidraAPI.json
Init MongoDB
use myapimongodb
db.addUser( { user: "phaidraapiuser", pwd: "pass", roles: ["readWrite"] });
db.session.ensureIndex( { "expires": 1 }, { expireAfterSeconds: 0 } );
Prepare log dir
mkdir /var/log/phaidra/
Install the directory class (responsible for getting the user's username etc)
cd lib/phaidra_directory/Phaidra/Directory
vi JSON.pm (or whatever is configured as directory class in PhaidraAPI.json)
Configure Apache Vhost
<VirtualHost 127.0.0.1:443>
ServerName example.com
DocumentRoot /var/www/api
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.+)
RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
# important, otherwise apache will sent 502 proxy error back when API works longer
ProxyTimeout 1200
RequestHeader set X-Forwarded-Proto "https"
# api
ProxyPassReverse /api/ http://localhost:3001/
ProxyPassReverse /api/ https://localhost:3001/
ProxyPass /api/ http://localhost:3001/ keepalive=On
<Location />
order deny,allow
allow from 10.0
</Location>
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/httpd/conf/ssl.crt/example.com.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/example.com.key
SSLCertificateChainFile /etc/httpd/conf/ssl.crt/terena.crt
ErrorLog /var/log/httpd/example.com.log
CustomLog /var/log/httpd/example.com.log combined
</VirtualHost>
Run hypnotoad...
/usr/local/bin/hypnotoad phaidra-api.cgi
...or morbo, eventually using screen and with watched directories
screen MOJO_REVERSE_PROXY=1 /usr/local/bin/morbo -l 'http://*:3001' -w PhaidraAPI -w PhaidraAPI.json -w PhaidraAPI.pm -w templates -w public -w lib phaidra-api.cgi