Changes

Jump to navigation Jump to search
Line 1: Line 1: −
To display logos for labels, we need images in the following format:
+
Installation instructions for Product Opener (see [[Project:Product Opener]]).
   −
* Image format: PNG
+
== Before you start ==
* Height: 90 pixels
  −
* Width: any
  −
* Filename: [label-id].[width]x90.png
  −
** e.g. assured-food-standards.82x90.png
  −
** e.g. soil-association-organic.89x90.png
     −
Use [[Special:Upload]] to upload images, and then add a link to the images below.
+
Product Opener is not yet released as open source. The instructions below are for reference and for early testers of Product Opener. They are very likely to change as the code will be restructured, made more independent of proprietary code and specific Open Food Facts uses etc.
   −
[[File:Assured-food-standards.82x90.png]]
+
When it is released, Product Opener will have much easier to use install scripts and instructions.
   −
<hr>
+
== Install directory ==
   −
EQCS
+
Instructions below use /home/obf for the install directory, replace with your install dir.
   −
[[File:Logoeqcs.png]]
+
== Product Opener code ==
   −
Logo officiel de l'European Quality Control System for Juice and Nectars from Fruits and Vegetables. Apposé sur certains produits.
+
=== Configuration ===
   −
Institut certificateur Français depuis 1994 "Qualijus" : http://www.qualijus.org
+
==== startup.pl ====
   −
<hr>
+
This file is used to preload Perl module in Apache.
 +
It contains a path that needs to be updated:
   −
USDA Organic
+
<pre>
 +
# Needs to be configured
 +
use lib "/home/obf/cgi/";
 +
</pre>
   −
[[File:Usda-organic.90x90.png]]
+
==== Config.pm ====
   −
[http://www.ams.usda.gov/AMSv1.0/ams.fetchTemplateData.do?template=TemplateA&navID=OrgLabelingLinkNOPOrganicLabeling&rightNav1=OrgLabelingLinkNOPOrganicLabeling&topNav=&leftNav=NationalOrganicProgram&page=NOPOrganicLabeling&resultType=&acct=nopgeninfo usda.gov description]
+
==== Config2.pm ====
    +
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.
   −
<hr>
+
<pre>
 +
# server constants
 +
$domain = "openbeautyfacts.org";
   −
CCOF (California Certified Organic Farmers) Certified Organic
+
# server paths
 +
$www_root = "/home/obf/html";
 +
$data_root = "/home/obf";
   −
[[File:Ccof-certified-organic.90x90.png]]
+
$mongodb = "obf";
 +
</pre>
   −
[http://www.ccof.org/certification CCOF certification]
+
=== Required Perl modules ===
   −
<hr>
+
The following Perl modules need to be installed (some of them might be included with Perl).
   −
Biologique Canada / Canada Organic
+
To install a module, you can sometimes use packages.
   −
[[File:Biologique-canada-organic.90x90.png]]
+
e.g. on Debian / Ubuntu : apt-get install libdatetime-perl
   −
[http://www.inspection.gc.ca/aliments/produits-biologiques/etiquetage-et-renseignements-generaux/choix-reconnu/fra/1328082717777/1328082783032 info on inspection.gc.ca]
+
Or you can use cpan:
    +
cpan install DateTime
   −
<hr>
     −
Real California Milk
+
<pre>
 +
Cache::Memcached::Fast
 +
Crypt::PasswdMD5
 +
DateTime
 +
DateTime::Format::Mail
 +
Digest::MD5
 +
Digest::SHA1
 +
Encode::Punycode
 +
File::Copy
 +
File::Path
 +
Geo::IP
 +
Getopt::Long
 +
GraphViz2
 +
Hash::Util
 +
HTML::Defang
 +
HTML::Entities
 +
Image::Magick
 +
Image::OCR::Tesseract
 +
IPC::Open3
 +
JSON
 +
LWP::Authen::Digest
 +
</pre>
   −
[[File:Real-california-milk-90x90.png]]
+
== MongoDB database ==
   −
[http://www.realcaliforniamilk.com/about-us/ info on the California Milk Advisory Board website]
+
Install Mongodb.
    +
The mongodb database name is configured in cgi/Config.pm
   −
<hr>
+
The mongodb database is created when the first product is added.
   −
Real California Cheese
+
=== MongoDB indexes ===
   −
[[File:Real-california-cheese.90x90.png]]
+
See [[Product Opener mongodb indexes]]
   −
[http://www.realcaliforniamilk.com/about-us/ info on the California Milk Advisory Board website]
+
== Apache servers ==
    +
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.
   −
<hr>
+
If the trafic is low or moderate, you can use only one Apache mod_perl server that also serves images etc.
   −
Orthodox Union Kosher
+
In the example below, the Apache mod_perl server listens on port 19000.
   −
[[File:Orthodox-union-kosher.90x90.png]]
+
=== Light-weight reverse proxy for static files ===
   −
[https://oukosher.org/ info on the Orthodox Union Kosher website]
+
Compile:
    +
./configure --prefix=/home/xyz/proxy --enable-rewrite --enable-proxy --enable-proxy_http --disable-userdir --enable-headers --enable-expires --enable-mime --enable-so --with-included-apr
   −
<hr>
+
Add to httpd.conf:
   −
Organized Kashrut Kosher
+
<pre>
   −
[[File:Organized-kashrut-kosher.90x90.png]]
+
<VirtualHost *>
 +
DocumentRoot /home/obf/html
 +
ServerName world.openbeautyfacts.org
 +
ServerAlias *.openbeautyfacts.org
   −
[http://www.ok.org/ info on the OK Kosher Certification website]
+
ErrorLog /home/obf/logs/proxy_error_log
 +
CustomLog /home/obf/logs/proxy_access_log combined
 +
ServerAdmin stephane@openbeautyfacts.org
    +
<Directory "/home/obf/html">
 +
    Options -Indexes FollowSymLinks
 +
    Order allow,deny
 +
    Allow from all
 +
</Directory>
 +
RewriteEngine on
 +
RewriteCond  %{REQUEST_URI}  !/./
 +
RewriteRule ^(/cgi/.*)$ http://localhost:19000$1 [P,L]
 +
RewriteMap escape int:escape
 +
RewriteRule ^/favicon.ico$ /favicon.ico [L]
 +
RewriteCond  %{REQUEST_URI}  !^/images/
 +
RewriteCond  %{REQUEST_URI}  !^/js/
 +
RewriteCond  %{REQUEST_URI}  !^/rss/
 +
RewriteCond  %{REQUEST_URI}  !^/robots
 +
RewriteCond  %{REQUEST_URI}  !^/clicks/
 +
RewriteCond  %{REQUEST_URI}  !^/data/
 +
RewriteCond  %{REQUEST_URI}  !^/files/
 +
RewriteRule  ^(.*)$ http://localhost:19000/cgi/display.pl?${escape:$1} [P,L,QSA]
 +
</VirtualHost>
   −
<hr>
     −
generic Halal
+
<VirtualHost *>
 +
DocumentRoot /home/obf/html
 +
ServerName openbeautyfacts.org
 +
ErrorLog /home/obf/logs/proxy_error_log
 +
CustomLog /home/obf/logs/proxy_access_log combined
 +
DirectoryIndex index.html index.shtml
 +
<Directory "/home/obf/html">
 +
    Options -Indexes FollowSymLinks Includes
 +
    Order allow,deny
 +
    Allow from all
 +
</Directory>
 +
RewriteEngine on
 +
RewriteCond %{HTTP_HOST} ^openbeautyfacts\.org
 +
RewriteRule ^/products$ /products.shtml [L]
   −
[[File:Halal.90x90.jpg]]
+
</VirtualHost>
   −
should be refined into each certifying entity logo (but there are so many that a generic default halal logo could be useful)
+
</pre>
 +
 
 +
=== 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)
 +
** do not use the 2.4 branch as mod_perl is not yet compatible with it
 +
* extract the source
 +
* ./configure --with-mpm=prefork --prefix=/home/obf/apache --enable-rewrite --enable-proxy --enable-proxy_http --enable-deflate --disable-userdir --enable-headers
 +
* make
 +
* make install
 +
 
 +
* download the latest version of mod_perl from http://perl.apache.org/
 +
* extract the source
 +
* perl Makefile.PL MP_APXS=/home/obf/apache/bin/apxs
 +
* make
 +
* make install
 +
 
 +
==== Configuration ====
 +
 
 +
In /home/obf/apache/conf/httpd.conf:
 +
 
 +
Change the port:
 +
 
 +
Listen 19000
 +
 
 +
Add at the end:
 +
 
 +
<pre>
 +
PerlWarn Off
 +
PerlRequire /home/obf/cgi/startup.pl
 +
 
 +
 
 +
<Location /cgi>
 +
SetHandler perl-script
 +
PerlResponseHandler ModPerl::Registry
 +
PerlOptions +ParseHeaders
 +
Options +ExecCGI
 +
Order allow,deny
 +
Allow from all
 +
</Location>
 +
 
 +
 
 +
<VirtualHost *>
 +
DocumentRoot /home/obf/html
 +
ServerName world.openbeautyfacts.org
 +
ErrorLog /home/obf/logs/error_log
 +
CustomLog /home/obf/logs/access_log combined
 +
ScriptAlias /cgi/ "/home/obf/cgi/"
 +
</VirtualHost>
 +
 
 +
PerlPostReadRequestHandler My::ProxyRemoteAddr
 +
</pre>
 +
 
 +
 
 +
== Installation issues ==
 +
 
 +
Depending on your environment (in particular different versions of Linux, Apache, MongoDB, Perl, Perl modules etc.), you may encounter some issues when installing or running Product Opener.
 +
 
 +
[[Product Opener installation issues]] lists those issues and steps to resolve them.

Navigation menu