Difference between pages "User:Javichu/Temp 20" 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: Plant-based spreads'''''
 
</div>
 
  
= FR- EN =
+
== Before you start ==
  
<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:Sweet spreads
+
 
fr:Pâtes à tartiner, Pâte à tartiner
+
When it is released, Product Opener will have much easier to use install scripts and instructions.
  
< fr:Pâtes à tartiner
+
== Install directory ==
fr:Beurres de cacahuètes, beurres d’arachide
 
  
< fr:Pâtes à tartiner
+
Instructions below use /home/obf for the install directory, replace with your install dir.
fr:Pâtes à tartiner au caramel, Pâte à tartiner au caramel, Caramels à tartiner, Caramel à tartiner
 
  
< fr:Pâtes à tartiner
+
== Product Opener code ==
fr:Pâtes à tartiner au chocolat, pâtes à tartiner au cacao
 
  
< fr:Pâtes à tartiner
+
=== Configuration ===
fr:Pâtes à tartiner aux amandes
 
  
< fr:Pâtes à tartiner
+
==== startup.pl ====
fr:Pâtes à tartiner aux noisettes, pâte à tartiner aux noisettes
 
  
< fr:Pâtes à tartiner au chocolat
+
This file is used to preload Perl module in Apache.
< fr:Pâtes à tartiner aux noisettes
+
It contains a path that needs to be updated:
fr:Pâtes à tartiner aux noisettes et au cacao, pâtes à tartiner aux noisettes et au chocolat
 
</pre>
 
  
 
<pre>
 
<pre>
< en:Salted spreads
+
# Needs to be configured
fr:Tapenade
+
use lib "/home/obf/cgi/";
 +
</pre>
  
< fr:Tapenade
+
==== Config.pm ====
fr:Tapenades noires, Tapenade noire, Tapenade aux olives noires
 
  
< fr:Tapenade
+
==== Config2.pm ====
fr:Tapenades vertes, Tapenade verte, Tapenade aux olives vertes
 
  
< en:Spreads
+
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.
fr:Condiments à tartiner, Condiment à tartiner
 
</pre>
 
  
= ES =
 
 
<pre>
 
<pre>
< en:Vegetable spreads
+
# server constants
es:Baba ganush
+
$domain = "openbeautyfacts.org";
  
< en:Vegetable spreads
+
# server paths
es:Cremas de algarroba
+
$www_root = "/home/obf/html";
 +
$data_root = "/home/obf";
  
< en:Vegetable spreads
+
$mongodb = "obf";
es:Cremas de algarroba y frutos secos
+
</pre>
 
 
< en:Vegetable spreads
 
es:Cremas de cacao
 
 
 
< en:Vegetable spreads
 
es:Cremas de cacao y frutos secos
 
 
 
< en:Vegetable spreads
 
es:Cremas de frutos secos
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de almendra
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de anacardos
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de avellana
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de cacahuete
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de castañas
 
 
 
< es:Cremas de frutos secos
 
es:Cremas de nueces
 
  
< en:Vegetable spreads
+
== MongoDB database ==
es:Cremas de sésamo
 
  
< en:Vegetable spreads
+
== Apache servers ==
es:Hummus
 
  
< en:Vegetable spreads
+
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:Patés vegetales
 
  
< es:Patés vegetales
+
If the trafic is low or moderate, you can use only one Apache mod_perl server that also serves images etc.
es:Patés vegetales de aceitunas
 
  
< en:Vegetable spreads
+
In the example below, the Apache mod_perl server listens on port 19000.
es:Tahines
 
</pre>
 
  
= Common =
+
=== Light-weight reverse proxy for static files ===
See:
 
* [[wikipedia:Spread (food)]]
 
* [[wikipedia:Nut butter]], [[wikipedia:es:Manteca de frutos secos]]
 
* [[wikipedia:Dip (food)]]
 
* [[wikipedia:Confiture]], [[wikipedia:fr:Confiture]], [[wikipedia:es:Mermelada]]
 
* [[wikipedia:Fruit preserves]]
 
  
== Plant-based butters ==
+
Add to httpd.conf:
=== Nut butters ===
 
<pre>
 
< en:Plant-based butters
 
en:Nut butters
 
es:Mantecas de frutos secos, Cremas de frutos secos, Mantecas de frutos de cáscara, Cremas de frutos de cáscara
 
fr:Pâtes à tartiner aux fruits à coques
 
</pre>
 
  
 
<pre>
 
<pre>
< en:Nut butters
 
en:Almond butters
 
es:Cremas de almendra
 
fr:Pâtes à tartiner aux amandes
 
  
< en:Nut butters
+
<VirtualHost *>
en:Cashew butters
+
DocumentRoot /home/obf/html
es:Cremas de anacardos
+
ServerName world.openbeautyfacts.org
fr:Pâtes à tartiner aux noix de cajou
+
ServerAlias *.openbeautyfacts.org
  
< en:Nut butters
+
ErrorLog /home/obf/logs/proxy_error_log
en:Chestnut butters
+
CustomLog /home/obf/logs/proxy_access_log combined
es:Cremas de castañas
+
ServerAdmin stephane@openbeautyfacts.org
fr:Pâtes à tartiner aux châtaignes
 
  
< en:Nut butters
+
<Directory "/home/obf/html">
en:Hazelnut butters
+
    Options -Indexes FollowSymLinks
es:Cremas de avellanas, Cremas de avellana
+
    Order allow,deny
fr:Pâtes à tartiner aux noisettes, pâte à tartiner aux noisettes
+
    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>
  
< en:Nut butters
 
en:Macadamia nut butters
 
es:Cremas de nueces de macadamia
 
fr:Pâtes à tartiner aux noix de macadamia
 
  
< en:Nut butters
+
<VirtualHost *>
en:Pecan butters
+
DocumentRoot /home/obf/html
es:Cremas de nueces de nueces pecanas
+
ServerName openbeautyfacts.org
fr:Pâtes à tartiner aux noix pécanes
+
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]
  
< en:Nut butters
+
</VirtualHost>
en:Pistachio butters
 
es:Cremas de pistachos
 
fr:Pâtes à tartiner aux pistaches
 
  
< en:Nut butters
 
en:Walnut butters
 
es:Cremas de nueces
 
fr:Pâtes à tartiner aux noix
 
 
</pre>
 
</pre>
  
=== Other plant-based butters ===
+
=== modperl Apache server for dynamic pages ===
<pre>
 
< en:Plant-based butters
 
en:Peanut butters
 
es:Mantecas de cacahuetes, Mantequillas de cacahuetes, Cremas de cacahuetes, Cremas de cacahuete
 
fr:Beurres de cacahuètes, beurres d’arachide
 
 
 
< en:Plant-based butters
 
en:Pumpkin seed butters
 
es:
 
fr:
 
 
 
< en:Plant-based butters
 
en:Sesame seed butters, Tahinis, Tahini
 
es:Cremas de sésamo, Tahines
 
fr:
 
 
 
< en:Plant-based butters
 
en:Soybean butters, Soynut butters
 
es:
 
fr:
 
  
< en:Plant-based butters
+
* download the latest version of the source of the Apache httpd server from the 2.2 branch (2.2.29 when writing this)
en:Sunflower seed butters
+
** do not use the 2.4 branch as mod_perl is not yet compatible with it
es:
+
* extract the source
fr:
+
* ./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
  
< en:Plant-based butters
+
==== Configuration ====
en:
 
es:Cremas de cacao
 
fr:
 
  
< en:Plant-based butters
+
In /home/obf/apache/conf/httpd.conf:
en:
 
es:Cremas de algarroba
 
fr:
 
  
......................................................
+
Change the port:
  
< en:Plant-based butters
+
Listen 19000
en:
 
es:Cremas de cacao y frutos secos
 
fr:
 
  
< en:Plant-based butters
+
Add at the end:
en:
 
es:Cremas de algarroba y frutos secos
 
fr:
 
</pre>
 
  
== Plant-based pâtés ==
 
 
<pre>
 
<pre>
< en:Plant-based pâtés
+
PerlWarn Off
en:
+
PerlRequire /home/obf/cgi/startup.pl
es:Patés vegetales a base de aceitunas, Patés vegetales de aceitunas
 
fr:
 
  
< en:Plant-based pâtés
 
en:
 
es:Patés vegetales a base de tofu
 
fr:
 
  
< en:Plant-based pâtés
+
<Location /cgi>
en:
+
SetHandler perl-script
es:Patés vegetales a base de setas
+
PerlResponseHandler ModPerl::Registry
fr:
+
PerlOptions +ParseHeaders
 +
Options +ExecCGI
 +
Order allow,deny
 +
Allow from all
 +
</Location>
  
< en:Plant-based pâtés
 
en:
 
es:Patés vegetales a base de pimientos
 
fr:
 
  
< en:Plant-based pâtés
+
<VirtualHost *>
en:
+
DocumentRoot /home/obf/html
es:Patés vegetales a base de tomates secos
+
ServerName world.openbeautyfacts.org
fr:
+
ErrorLog /home/obf/logs/error_log
 
+
CustomLog /home/obf/logs/access_log combined
< en:Plant-based pâtés
+
ScriptAlias /cgi/ "/home/obf/cgi/"
en:
+
</VirtualHost>
es:Patés vegetales a base de espárragos
 
fr:
 
 
 
< en:Plant-based pâtés
 
en:
 
es:Patés vegetales a base de alcachofas
 
fr:
 
 
 
< en:Plant-based pâtés
 
en:
 
es:Patés vegetales a base de soja
 
fr:
 
 
 
< en:Plant-based pâtés
 
en:
 
es:Patés vegetales a base de levadura
 
fr:
 
</pre>
 
 
 
== Plant-based prepared foods spreads==
 
<pre>
 
< en:Plant-based spreads
 
< en:Salted spreads
 
< en:Plant-based prepared foods
 
< en:Dips
 
en:Hummus, Houmous
 
es:Hummus, Houmous
 
fr:Houmous, Hommos, Hoummous, Houmos, oumos, Hummus
 
  
< en:Plant-based spreads
+
PerlPostReadRequestHandler My::ProxyRemoteAddr
< en:Salted spreads
 
< en:Plant-based prepared foods
 
< en:Dips
 
en:Baba ghanoush, Baba ganush, Baba ghannouj, Baba ghannoug, Mutabbal
 
es:Baba ganush, Baba Ganuch, Baba ghanoush, Baba ganush, Baba ghannouj, Baba ghannoug, Mutabbal
 
fr:Baba ganousch, Baba Ghanouge, Moutabal
 
 
</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