Difference between pages "User:Javichu/Temp 9" and "Product Opener/Installation"

From Open Food Facts wiki
< User:Javichu(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
<div style="color:red; font-size:xx-large; text-align:center">
+
Installation instructions for Product Opener (see [[Project:Product Opener]]).
'''''Merging & updating: Vegetables and their products'''''
 
</div>
 
  
= FR - EN - ES =
+
== Before you start ==
<pre>
 
en:Vegetables
 
es:Hortalizas
 
fr:Légumes
 
</pre>
 
 
 
== Pickled vegetables ==
 
<pre>
 
< en:Pickled vegetables
 
en:Pickled beets
 
es:Remolacha encurtida
 
 
 
< en:Pickled vegetables
 
en:Pickled caper berries
 
es:Alcaparrones encurtidos
 
 
 
< en:Pickled vegetables
 
en:Pickled capers
 
es:Alcaparras encurtidas
 
 
 
< en:Pickled vegetables
 
en:Pickled carrots
 
es:Zanahorias encurtidas
 
 
 
< en:Pickled vegetables
 
en:Pickled cucumbers
 
es:Pepinillos encurtidos
 
 
 
< en:Pickled vegetables
 
en:Pickled eggplants
 
es:Berenjenas encurtidas
 
 
 
< en:Pickled vegetables
 
en:Pickled garlic
 
es:Ajos encurtidos
 
</pre>
 
 
 
<pre>
 
< en:Pickled vegetables
 
en:Pickled onions
 
es:Cebollas encurtidas, Cebollitas encurtidas
 
 
 
< en:Pickled vegetables
 
en:Pickled peppers
 
es:Pimientos encurtidos
 
 
 
< en:Pickled peppers
 
en:Pickled guindilla peppers, Pickled guindilla chillis
 
es:Guindillas encurtidas
 
</pre>
 
 
 
= FR - EN =
 
== Fresh vegetables ==
 
<pre>
 
en:Tomatoes
 
fr:Tomates
 
 
 
< en:Tomatoes
 
fr:Tomate olivette, Tomates olivettes
 
 
 
< en:Tomatoes
 
fr:Tomates cerise
 
 
 
< en:Tomatoes
 
fr:Tomates pelées
 
 
 
< en:Tomatoes
 
fr:Tomates séchées
 
</pre>
 
 
 
<pre>
 
< en:Vegetables
 
en:Fresh vegetables
 
fr:Légumes frais
 
 
 
< en:Fresh vegetables
 
en:Potatoes
 
fr:Pommes de terre, patates, Solanum tuberosum
 
 
 
< en:Potatoes
 
fr:Pommes de terre Agata
 
 
 
< en:Potatoes
 
fr:Pommes de terre Béa
 
 
 
< fr:Pommes de terre Béa
 
fr:Béa du Roussillon, pomme de terre primeur du Roussillon
 
 
 
< en:Potatoes
 
fr:Pommes de terre catégorie 1, Pommes de terre Cat. 1
 
 
 
< en:Potatoes
 
fr:Pommes de terre Charlotte
 
 
 
< en:Potatoes
 
< fr:Pommes de terre de l'île de Ré
 
fr:Pommes de terre primeurs, Pommes de terre de primeur
 
 
 
< en:Potatoes
 
fr:Pommes de terre labellisées
 
 
 
< en:Fresh vegetables
 
fr:Salades, Salade
 
</pre>
 
 
 
<pre>
 
< fr:Légumes AOC
 
< fr:Pommes de terre de l'île de Ré
 
< fr:Pommes de terre labellisées
 
fr:Pommes de terre AOC
 
</pre>
 
 
 
<pre>
 
< en:Vegetables
 
en:Vegetable rods
 
fr:Légumes tiges
 
 
 
< en:Vegetable rods
 
< en:Vegetables
 
en:Asparagus
 
fr:Asperges, asperge
 
 
 
< en:Asparagus
 
< en:Fresh vegetables
 
fr:Asperges fraîches
 
 
 
< en:Asparagus
 
en:German Asparagus
 
fr:Asperges allemandes
 
 
 
< en:Asparagus
 
fr:Asperges autrichiennes
 
 
 
< en:Asparagus
 
fr:Asperges blanches
 
 
 
< en:Asparagus
 
en:Spanish Asparagus
 
fr:Asperges espagnoles
 
 
 
< en:Asparagus
 
en:French Asparagus
 
fr:Asperges françaises
 
 
 
< en:Asparagus
 
en:Italian Asparagus
 
fr:asperges italiennes
 
 
 
< en:Asparagus
 
fr:Asperges miniatures
 
 
 
< en:Asparagus
 
fr:Asperges pelées à la main
 
 
 
< en:Asparagus
 
en:Wild asparagus
 
fr:Asperges sauvages
 
 
 
< en:Asparagus
 
en:Green Asparagus
 
fr:Asperges vertes
 
 
 
< en:Asparagus
 
en:Purple Asparagus
 
fr:Asperges violettes
 
 
 
< en:Vegetable rods
 
fr:Artichauts, artichaut
 
 
 
< en:Vegetable rods
 
fr:Blettes, bettes
 
 
 
< fr:Blettes
 
fr:poirées
 
 
 
< en:Vegetable rods
 
fr:Cardons
 
 
 
< en:Vegetable rods
 
fr:céleris
 
 
 
< en:Vegetable rods
 
fr:Coeurs de palmier, choux palmistes, chou palmiste
 
 
 
< en:Vegetable rods
 
fr:fenouils
 
 
 
< en:Vegetable rods
 
fr:Poireaux, Poireau
 
 
 
< en:Vegetable rods
 
< fr:Pousses
 
fr:Pousses de bambou, Pousse de bambou
 
 
 
< en:Vegetable rods
 
fr:rhubarbes
 
</pre>
 
  
<pre>
+
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.
< en:Vegetables
 
fr:Oignons
 
</pre>
 
  
== Canned Vegetables ==
+
When it is released, Product Opener will have much easier to use install scripts and instructions.
<pre>
 
< en:Asparagus
 
< fr:Légumes en conserve
 
fr:Asperges en conserve
 
</pre>
 
  
<pre>
+
== Install directory ==
< en:Tomatoes
 
< fr:Légumes en conserve
 
fr:Tomates en conserve, conserves de tomate
 
</pre>
 
  
<pre>
+
Instructions below use /home/obf for the install directory, replace with your install dir.
< en:Canned foods
 
< en:Vegetables
 
en:Canned Vegetables
 
fr:Légumes en conserve
 
  
< fr:Légumes en conserve
+
== Product Opener code ==
en:Canned Artichokes
 
fr:Artichauts en conserve
 
  
< fr:Légumes en conserve
+
=== Configuration ===
en:Canned Carrots
 
fr:Carottes en conserve
 
  
< fr:Légumes en conserve
+
==== startup.pl ====
fr:Céleri en conserve
 
  
< fr:Légumes en conserve
+
This file is used to preload Perl module in Apache.
fr:Choux en conserve
+
It contains a path that needs to be updated:
 
 
< fr:Légumes en conserve
 
fr:Flageolets en conserve
 
 
 
< fr:Légumes en conserve
 
fr:Salsifis en conserve
 
</pre>
 
 
 
<pre>
 
fr:Choux de conserve
 
 
 
< fr:Choux de conserve
 
fr:Choux de Bruxelles en conserve
 
</pre>
 
 
 
== Légumes surgelés ==
 
<pre>
 
< en:Frozen foods
 
< en:Vegetables
 
fr:Légumes surgelés
 
</pre>
 
 
 
== Other ==
 
<pre>
 
< en:Vegetables
 
fr:Cornichons
 
 
 
< fr:Cornichons
 
fr:Cornichons au vinaigre
 
 
 
< fr:Cornichons
 
fr:Cornichons extra-fins
 
 
 
< fr:Cornichons
 
fr:Cornichons malossol
 
 
 
< en:Vegetables
 
fr:Légumes bio, Légumes biologiques
 
 
 
< en:Vegetables
 
fr:Légumes-feuilles, Légume-feuille
 
</pre>
 
 
 
<pre>
 
fr:Légumes labelisés
 
</pre>
 
 
 
<pre>
 
< fr:Purées
 
fr:Purées de pommes de terre
 
</pre>
 
  
 
<pre>
 
<pre>
fr:Pommes de terre de l'île de Ré, Pomme de terre de l'île de Ré
+
# Needs to be configured
 +
use lib "/home/obf/cgi/";
 
</pre>
 
</pre>
  
= ES =
+
==== Config.pm ====
== Hortalizas ==
 
<pre>
 
< es:Vegetales frescos
 
es:Hortalizas frescas
 
 
 
< es:Hortalizas frescas
 
es:Alcachofas
 
 
 
< es:Hortalizas frescas
 
es:Apios
 
 
 
< es:Hortalizas frescas
 
es:Berenjenas
 
 
 
< es:Hortalizas frescas
 
es:Brócolis
 
 
 
< es:Hortalizas frescas
 
es:Calabacines
 
 
 
< es:Hortalizas frescas
 
es:Coles Chinas
 
 
 
< es:Hortalizas frescas
 
es:Coles de Bruselas
 
 
 
< es:Hortalizas frescas
 
es:Coliflores
 
 
 
< es:Hortalizas frescas
 
es:Endibias
 
 
 
< es:Hortalizas frescas
 
es:Escarolas
 
 
 
< es:Hortalizas frescas
 
es:Espárragos
 
 
 
< es:Hortalizas frescas
 
es:Espinacas
 
 
 
< es:Hortalizas frescas
 
es:Lechugas
 
 
 
< es:Hortalizas frescas
 
es:Patatas
 
 
 
< es:Hortalizas frescas
 
es:Pepinos
 
 
 
< es:Hortalizas frescas
 
es:Pimientos
 
 
 
< es:Hortalizas frescas
 
es:Puerros
 
  
< es:Hortalizas frescas
+
==== Config2.pm ====
es:Repollos
 
  
< es:Hortalizas frescas
+
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.
es:Tomates
 
 
 
< es:Hortalizas frescas
 
es:Zanahorias
 
</pre>
 
  
== Hortalizas en conserva ==
 
 
<pre>
 
<pre>
< es:Vegetales en conserva
+
# server constants
es:Hortalizas en conserva
+
$domain = "openbeautyfacts.org";
 
 
< es:Hortalizas en conserva
 
es:Acelgas en conserva
 
  
< es:Hortalizas en conserva
+
# server paths
es:Alcachofas en conserva
+
$www_root = "/home/obf/html";
 +
$data_root = "/home/obf";
  
< es:Hortalizas en conserva
+
$mongodb = "obf";
es:Coles de Bruselas en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Coliflores en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Espárragos blancos en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Espárragos verdes en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Espinacas en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Patatas en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Pimientos en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Puerros en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Remolacha en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Tomates en conserva
 
 
 
< es:Hortalizas en conserva
 
es:Zanahorias en conserva
 
 
</pre>
 
</pre>
  
== Hortalizas congeladas ==
+
== MongoDB database ==
<pre>
 
< es:Vegetales congelados o ultracongelados
 
es:Hortalizas congeladas
 
 
 
< es:Hortalizas congeladas
 
es:Acelgas congeladas
 
 
 
< es:Acelgas congeladas
 
es:Acelgas congeladas en hojas
 
 
 
< es:Acelgas congeladas
 
es:Acelgas congeladas troceadas
 
 
 
< es:Hortalizas congeladas
 
es:Ajos congelados troceados
 
 
 
< es:Hortalizas congeladas
 
es:Ajos tiernos congelados
 
 
 
< es:Hortalizas congeladas
 
es:Alcachofas congeladas
 
 
 
< es:Hortalizas congeladas
 
es:Brócolis congelados
 
 
 
< es:Hortalizas congeladas
 
es:Cardos congelados
 
 
 
< es:Hortalizas congeladas
 
es:Cebollas congeladas troceadas
 
 
 
< es:Hortalizas congeladas
 
es:Coles de Bruselas congeladas
 
 
 
< es:Hortalizas congeladas
 
es:Coliflores congeladas
 
 
 
< es:Hortalizas congeladas
 
es:Espárragos blancos congelados
 
 
 
< es:Hortalizas congeladas
 
es:Espárragos verdes congelados
 
 
 
< es:Hortalizas congeladas
 
es:Espinacas congeladas
 
  
< es:Espinacas congeladas
+
== Apache servers ==
es:Espinacas congeladas en hojas
 
  
< es:Espinacas congeladas
+
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.
es:Espinacas congeladas troceadas
 
  
< es:Hortalizas congeladas
+
If the trafic is low or moderate, you can use only one Apache mod_perl server that also serves images etc.
es:Menestras y mezclas de vegetales congelados
 
  
< es:Hortalizas congeladas
+
In the example below, the Apache mod_perl server listens on port 19000.
es:Patatas congeladas
 
  
< es:Hortalizas congeladas
+
=== Light-weight reverse proxy for static files ===
es:Zanahorias congeladas
 
</pre>
 
  
== Brotes frescos ==
+
Add to httpd.conf:
<pre>
 
< es:Brotes frescos
 
es:Brotes de ajo frescos
 
</pre>
 
  
 
<pre>
 
<pre>
< es:Brotes frescos
 
es:Brotes de cebolla frescos
 
 
< es:Brotes frescos
 
es:Brotes de col china frescos
 
  
< es:Brotes frescos
+
<VirtualHost *>
es:Brotes de col lombarda frescos
+
DocumentRoot /home/obf/html
 +
ServerName world.openbeautyfacts.org
 +
ServerAlias *.openbeautyfacts.org
  
< es:Brotes frescos
+
ErrorLog /home/obf/logs/proxy_error_log
es:Brotes de espárrago frescos
+
CustomLog /home/obf/logs/proxy_access_log combined
</pre>
+
ServerAdmin stephane@openbeautyfacts.org
  
<pre>
+
<Directory "/home/obf/html">
< es:Brotes frescos
+
    Options -Indexes FollowSymLinks
es:Brotes de puerros frescos
+
    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>
  
< es:Brotes frescos
 
es:Brotes de rabanitos frescos
 
  
< es:Brotes frescos
+
<VirtualHost *>
es:Brotes de remolacha frescos
+
DocumentRoot /home/obf/html
</pre>
+
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]
  
<pre>
+
</VirtualHost>
< es:Brotes frescos
 
es:Brotes de zanahoria frescos
 
</pre>
 
  
== Brotes en conserva ==
 
<pre>
 
< es:Brotes en conserva
 
es:Brotes de ajo en conserva
 
 
</pre>
 
</pre>
  
== Semillas para germinar ==
+
=== modperl Apache server for dynamic pages ===
<pre>
 
< es:Semillas para germinar
 
es:Semillas de berro
 
  
< es:Semillas para germinar
+
* download the latest version of the source of the Apache httpd server from the 2.2 branch (2.2.29 when writing this)
es:Semillas de brócoli
+
** 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
  
< es:Semillas para germinar
+
* download the latest version of mod_perl from http://perl.apache.org/
es:Semillas de col lombarda
+
* extract the source
</pre>
+
* perl Makefile.PL MP_APXS=/home/obf/apache/bin/apxs
 +
* make
 +
* make install
  
<pre>
+
==== Configuration ====
< es:Semillas para germinar
 
es:Semillas de puerro
 
  
< es:Semillas para germinar
+
In /home/obf/apache/conf/httpd.conf:
es:Semillas de rabanito
 
</pre>
 
  
= Common =
+
Change the port:
== Top category ==
 
<pre>
 
< en:Plant-based foods
 
en:Vegetables and their products
 
es:Verduras y hortalizas y sus productos, Verduras y hortalizas y derivados
 
fr:
 
</pre>
 
  
== Classification by vegetables raw parts and primary derivaties ==
+
Listen 19000
<pre>
 
< en:Vegetables and their products
 
< en:Frozen plant-based foods
 
en:Frozen vegetables
 
es:Verduras y hortalizas congeladas, Hortalizas congeladas, Verduras congeladas
 
fr:Légumes surgelés
 
</pre>
 
  
Temporalmente, por ahora:
+
Add at the end:
<pre>
 
< en:Frozen foods
 
< en:Vegetables
 
en:Frozen vegetables
 
es:Verduras y hortalizas congeladas, Hortalizas congeladas, Verduras congeladas
 
fr:Légumes surgelés
 
</pre>
 
  
== Frozen vegetables ==
 
 
<pre>
 
<pre>
< en:Frozen vegetables
+
PerlWarn Off
en:Frozen artichokes
+
PerlRequire /home/obf/cgi/startup.pl
es:Alcachofas congeladas
 
fr:Artichauts surgelés
 
 
 
< en:Frozen artichokes
 
en:Frozen artichoke hearts
 
es:Corazones de alcachofas congelados
 
fr:Coeurs d'artichauts surgelés
 
 
 
< en:Frozen artichokes
 
en:Frozen baby artichokes
 
es:Alcachofas baby congeladas
 
fr:Artichauts baby surgelés
 
 
 
< en:Frozen artichokes
 
en:Frozen chopped artichokes
 
es:Alcachofas troceadas congeladas
 
fr:Artichauts hachés surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen asparagus
 
es:Espárragos congelados
 
fr:Asperges surgelés
 
 
 
< en:Frozen asparagus
 
en:Frozen green asparagus
 
es:Espárragos verdes congelados
 
fr:Asperges vertes surgelés
 
 
 
< en:Frozen green asparagus
 
en:Frozen chopped green asparagus
 
es:Espárragos verdes troceados congelados
 
 
 
< en:Frozen green asparagus
 
en:Frozen whole green asparagus
 
es:Espárragos verdes enteros congelados
 
 
 
< en:Frozen asparagus
 
en:Frozen white asparagus
 
es:Espárragos blancos congelados
 
fr:Asperges blanches surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen broccoli florets
 
es:Brócoli en floretes congelado, Brócolis congelados, Brócoli congelado
 
fr:Brocolis en fleurettes surgelés, Brocolis surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen Brussels sprouts
 
es:Coles de Bruselas congeladas
 
fr:Choux de Bruxelles surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen carrots
 
es:Zanahorias congeladas
 
fr:Carottes surgelés
 
 
 
< en:Frozen carrots
 
en:Frozen baby carrots
 
es:Zanahorias baby congeladas
 
fr:Baby carottes surgelés
 
 
 
< en:Frozen carrots
 
en:Frozen chopped carrots
 
es:Zanahorias troceadas congeladas, Zanahorias en rodajas congeladas
 
fr:Carottes en rondelles surgelées
 
 
 
< en:Frozen vegetables
 
en:Frozen cauliflower florets
 
es:Coliflores en floretes congeladas, Coliflores congeladas
 
fr:Choux-fleurs en fleurettes surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen chards
 
es:Acelgas congeladas
 
fr:Bettes surgelés
 
 
 
< en:Frozen chards
 
en:Frozen chard leaves
 
es:Acelgas en hojas congeladas
 
 
 
< en:Frozen chards
 
en:Frozen chopped chards
 
es:Acelgas troceadas congeladas
 
 
 
< en:Frozen vegetables
 
en:Frozen chopped cardoon, Frozen chopped artichoke thistle
 
es:Cardos troceados congelados
 
fr:Cardes hachés surgelés, Cardons hachés surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen chopped garlic
 
es:Ajos troceados congelados
 
fr:Ail haché surgelé
 
 
 
< en:Frozen vegetables
 
en:Frozen chopped onions
 
es:Cebollas troceadas congeladas
 
fr:Oignons hachés surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen green garlic
 
es:Ajos tiernos congelados, Brotes de ajo congelados
 
fr:Aillets surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen potatoes
 
es:Patatas congeladas
 
fr:Pommes de terre surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen red cabbage
 
es:Lombardas congeladas, Lombarda congelada, Col lombarda congelada
 
fr:Chous rouges surgelés
 
 
 
< en:Frozen vegetables
 
en:Frozen romanesco, Frozen romanesco broccoli, Frozen romanesque cauliflower
 
es:Romanesco congelado, Romanescu congelado
 
fr:Chou romanesco surgelé
 
 
 
< en:Frozen vegetables
 
en:Frozen spinachs
 
es:Espinacas congeladas
 
fr:Épinards surgelés
 
 
 
< en:Frozen spinachs
 
en:Frozen chopped spinachs
 
es:Espinacas troceadas congeladas
 
 
 
< en:Frozen spinachs
 
en:Frozen spinach leaves
 
es:Espinacas en hojas congeladas
 
  
< en:Frozen vegetables
 
en:Frozen vegetable mixes
 
es:Mezclas de verduras y hortalizas congeladas
 
fr:Mélanges de légumes surgelés
 
  
< en:Frozen vegetable mixes
+
<Location /cgi>
en:Frozen pistos
+
SetHandler perl-script
es:Pistos congelados
+
PerlResponseHandler ModPerl::Registry
fr:Pistos surgelés
+
PerlOptions +ParseHeaders
 +
Options +ExecCGI
 +
Order allow,deny
 +
Allow from all
 +
</Location>
  
< en:Frozen vegetable mixes
 
en:Frozen sauteed vegetables
 
es:Salteados de verduras congeladas
 
fr:Légumes sautés surgelés
 
  
< en:Frozen vegetable mixes
+
<VirtualHost *>
en:Frozen vegetable stews
+
DocumentRoot /home/obf/html
es:Menestras de verduras congeladas
+
ServerName world.openbeautyfacts.org
fr:Ragoûts de légumes surgelés
+
ErrorLog /home/obf/logs/error_log
 +
CustomLog /home/obf/logs/access_log combined
 +
ScriptAlias /cgi/ "/home/obf/cgi/"
 +
</VirtualHost>
  
< en:Frozen vegetables
+
PerlPostReadRequestHandler My::ProxyRemoteAddr
en:Frozen zucchini
 
es:Calabacines congelados
 
fr:Courgettes surgelés
 
 
</pre>
 
</pre>

Revision as of 13:44, 4 September 2014

Installation instructions for Product Opener (see Project:Product Opener).

Before you start

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.

When it is released, Product Opener will have much easier to use install scripts and instructions.

Install directory

Instructions below use /home/obf for the install directory, replace with your install dir.

Product Opener code

Configuration

startup.pl

This file is used to preload Perl module in Apache. It contains a path that needs to be updated:

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

Config.pm

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.

# server constants
$domain = "openbeautyfacts.org";

# server paths
$www_root = "/home/obf/html";
$data_root = "/home/obf";

$mongodb = "obf";

MongoDB database

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.

If the trafic 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.

Light-weight reverse proxy for static files

Add to httpd.conf:


<VirtualHost *>
DocumentRoot /home/obf/html
ServerName world.openbeautyfacts.org
ServerAlias *.openbeautyfacts.org

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>


<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]

</VirtualHost>

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:

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