Jump to content

Product Opener/Installation: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 22: Line 22:
It contains a path that needs to be updated:
It contains a path that needs to be updated:


<pre>
# Needs to be configured
# Needs to be configured
use lib "/home/obf/cgi/";
use lib "/home/obf/cgi/";
</pre>


==== Config.pm ====
==== Config.pm ====
Line 33: Line 31:
Contains info about the domain, database and path. This is separated from Config.pm so that it is easy to create test instance that share the same configuration in Config.pm but are on other domains.
Contains info about the domain, database and path. This is separated from Config.pm so that it is easy to create test instance that share the same configuration in Config.pm but are on other domains.


<pre>
# server constants
# server constants
$domain = "openbeautyfacts.org";
$domain = "openbeautyfacts.org";
# server paths
$www_root = "/home/obf/html";
$data_root = "/home/obf";
$mongodb = "obf";


# server paths
$www_root = "/home/obf/html";
$data_root = "/home/obf";
$mongodb = "obf";
</pre>
=== Libraries ===
=== Libraries ===
Either 'brew install' or 'apt-get install' as appropriate:
Either <code>brew install</code> or <code>apt-get install</code> these dependencies as appropriate:
<pre>
zbar imagemagick graphviz tesseract
zbar imagemagick graphviz tesseract
</pre>
=== Required Perl modules ===
=== Required Perl modules ===
The following Perl modules need to be installed (some of them might be included with Perl).
The following Perl modules need to be installed (some of them might be included with Perl).
To install a module, you can sometimes use packages.
e.g. on Debian / Ubuntu :Β  apt-get install libdatetime-perl
Or you can use cpan: <code>cpan install DateTime</code>
Or cpanm: <code>perl cpanm --installdeps .</code>


<pre>
<pre>
Line 82: Line 68:
LWP::Authen::Digest
LWP::Authen::Digest
</pre>
</pre>
To install a module, you can sometimes use packages.
e.g. on Debian / Ubuntu :Β  <code>apt-get install libdatetime-perl</code>
Or you can use ''cpan'': <code>cpan install DateTime</code>
Or ''cpanm'': <code>perl cpanm --installdeps .</code>


== MongoDB database ==
== MongoDB database ==
Product Opener requires [https://www.mongodb.com/ MongoDB] to run.


Install Mongodb.
* Install MongoDB.


The mongodb database name is configured in cgi/Config.pm
* The MongoDB database name is configured in PROJECTROOT/cgi/Config.pm


The mongodb database is created when the first product is added.
* The MongoDB database is created when the first product is added.


=== MongoDB indexes ===
=== MongoDB indexes ===
Line 99: Line 94:
In production we use a light weight Apache web server for static files (e.g. images) that does reverse proxying to a modperl Apache server that dynamically generates the HTML pages.
In production we use a light weight Apache web server for static files (e.g. images) that does reverse proxying to a modperl Apache server that dynamically generates the HTML pages.


If the trafic is low or moderate, you can use only one Apache mod_perl server that also serves images etc.
If the traffic is low or moderate, you can use only one Apache mod_perl server that also serves images etc.


In the example below, the Apache mod_perl server listens on port 19000.
In the example below, the Apache mod_perl server listens on port 19000.
Line 165: Line 160:
=== modperl Apache server for dynamic pages ===
=== modperl Apache server for dynamic pages ===


* download the latest version of the source of the Apache httpd server from the 2.2 branch (2.2.29 when writing this)
# Download the latest version of the source of the Apache httpd server from the 2.2 branch (2.2.29 when writing this)
** do not use the 2.4 branch as mod_perl is not yet compatible with it
#* Do not use the 2.4 branch as mod_perl is not yet compatible with it
* extract the source
# Extract the source
* ./configure --with-mpm=prefork --prefix=/home/obf/apache --enable-rewrite --enable-proxy --enable-proxy_http --enable-deflate --disable-userdir --enable-headers
# <code>./configure --with-mpm=prefork --prefix=/home/obf/apache --enable-rewrite --enable-proxy --enable-proxy_http --enable-deflate --disable-userdir --enable-headers</code>
* make
# <code>make</code>
* make install
# <code>make install</code>
Β 
# Download the latest version of mod_perl from http://perl.apache.org/
* download the latest version of mod_perl from http://perl.apache.org/
# Extract the source
* extract the source
# <code>perl Makefile.PL MP_APXS=/home/obf/apache/bin/apxs</code>
* perl Makefile.PL MP_APXS=/home/obf/apache/bin/apxs
# <code>make</code>
* make
# <code>make install</code>
* make install


==== Configuration ====
==== Configuration ====
Line 184: Line 178:
Change the port:
Change the port:


Listen 19000
<code>Listen 19000</code>


Add at the end:
Add at the end:
72

edits