Changes

Jump to navigation Jump to search
install on jessie
Line 166: Line 166:     
You should now have a working Productopener instance running at http://yourdomain.com/. Enjoy!
 
You should now have a working Productopener instance running at http://yourdomain.com/. Enjoy!
 +
 +
= Installation on Debian Jessie with stock Apache and nginx =
 +
 +
<pre>
 +
Vous êtes sur le point d'installer un OS sur le serveur ks3095298.kimsufi.com. Choisissez le type d'installation que vous souhaitez utiliser :
 +
 +
-> Installer à partir d'un template OVH
 +
 +
Debian 8.1 stable (Jessie) (stable) - debian8
 +
 +
root@ks3095298:~# uname -a
 +
Linux ks3095298.kimsufi.com 3.14.32-xxxx-grs-ipv6-64 #5 SMP Wed Sep 9 17:24:34 CEST 2015 x86_64 GNU/Linux
 +
 +
perl -v
 +
 +
This is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-gnu-thread-multi
 +
 +
 +
apt-get update
 +
apt-get upgrade
 +
 +
apt-get install fail2ban
 +
apt-get install sudo
 +
 +
apt-get install mongodb
 +
 +
MongoDB shell version: 2.4.10
 +
 +
vi /etc/mongodb.conf
 +
- change dbpath
 +
- uncomment :
 +
#port = 27017
 +
#nohttpinterface = true
 +
 +
 +
apt-get install git
 +
 +
apt-get install apache2
 +
apt-get install libapache2-mod-perl2
 +
apt-get install modperl
 +
 +
adduser off
 +
 +
apt-get install imagemagick
 +
apt-get install memcached
 +
apt-get install tesseract-ocr tesseract-ocr-fra
 +
apt-get install exim4
 +
dpkg-reconfigure exim4-config
 +
apt-get install geoip-bin geoip-database
 +
apt-get install zlib1g-dev
 +
 +
apt-get install libwww-perl libimage-magick-perl libxml-encoding-perl libtext-unaccent-perl libmime-lite-perl libcache-memcached-fast-perl libjson-perl libclone-perl  libgraphviz-perl libmime-lite-perl libcrypt-passwdmd5-perl libencode-detect-perl libgraphics-color-perl libbarcode-zbar-perl libxml-feedpp-perl libmongodb-perl liburi-find-perl libxml-simple-perl
 +
 +
 +
cp -a /home/openfoodfacts-bitbucket/product-opener/cgi /home/off/cgi/
 +
 +
/home/off/cgi# rm Blogs
 +
root@ks3095298:/home/off/cgi# ln -s /home/off/cgi Blogs
 +
 +
ln -s SiteLang_off.pm SiteLang.pm
 +
 +
vi /home/off/startup.pl
 +
# Needs to be configured
 +
use lib "/home/off/cgi/";
 +
 +
 +
ln -s ../sites-available/001-off.conf  001-off.conf
 +
service apache2 restart
 +
 +
To see errors, missing perl modules etc.
 +
 +
/var/log/apache2# tail -f error.log
 +
 +
cpan
 +
install URI::Escape::XS
 +
install Encode::Punycode
 +
install GraphViz2
 +
install HTML::Defang
 +
install Algorithm::CheckDigits
 +
install Geo::IP
 +
install Image::OCR::Tesseract
 +
DateTime::Format::Mail
 +
DateTime::Format::CLDR
 +
DateTime::Locale
 +
 +
 +
 +
 +
Issues:
 +
   
 +
MongoDB does not start:
 +
   
 +
    service mongodb start
 +
root@ks3095298:/home/off/cgi# ps -ef | grep mongo
 +
root    21814 23471  0 23:56 pts/0    00:00:00 grep mongo
 +
 +
 +
in /var/log/syslog:
 +
   
 +
    Jan 11 00:05:05 ks3095298 systemd[1]: Starting An object/document-oriented database...
 +
Jan 11 00:05:05 ks3095298 systemd[1]: Started An object/document-oriented database.
 +
Jan 11 00:05:05 ks3095298 mongod[22404]: Mon Jan 11 00:05:05.434 terminate() called, printing stack (if implemented for platform):
 +
Jan 11 00:05:05 ks3095298 mongod[22404]: 0xa6d3c6 0x57e204 0x7212186b7bb6 0x7212186b7c01 0x7212186b7e19 0x7212192b666d 0xa6070d 0xa61a67 0xa5f8ca 0xa5f979 0x5a626c 0x5a65d2 0x5a6a93 0x5a6ab9 0x5a6e5c 0x56647b 0x721217dbab45 0x57e05c
 +
Jan 11 00:05:05 ks3095298 mongod[22404]: /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x26) [0xa6d3c6]
 +
 +
 +
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv EA312927
 +
 +
 +
Text::Unaccent was causing Apache to segfault, replaced the module with pure perl
 +
 +
remote_ip has been replaced in Apache 2.4, need to check if we do get the X-Forwarder-For ip directly now
 +
 +
 +
Loading products from /products in the mongodb database:
 +
   
 +
update_all_products_from_dir_in_mongodb.pl
 +
   
 +
   
 +
 +
Trying to use nginx for the reverse proxy:
 +
   
 +
apt-get install nginx  (need port 80 to be available, stop apache or change its port first)
 +
 +
 +
 +
root@ks3095298:/etc/nginx/sites-enabled# more /etc/nginx/sites-available/off
 +
##
 +
# You should look at the following URL's in order to grasp a solid understanding
 +
# of Nginx configuration files in order to fully unleash the power of Nginx.
 +
# http://wiki.nginx.org/Pitfalls
 +
# http://wiki.nginx.org/QuickStart
 +
# http://wiki.nginx.org/Configuration
 +
#
 +
# Generally, you will want to move this file somewhere, and start with a clean
 +
# file but keep this around for reference. Or just disable in sites-enabled.
 +
#
 +
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
 +
##
 +
 +
# Default server configuration
 +
#
 +
server {
 +
        listen 80 default_server;
 +
        listen [::]:80 default_server;
 +
 +
        server_name openfoodfacts.ovh *.openfoodfacts.ovh;
 +
 +
        # SSL configuration
 +
        #
 +
        # listen 443 ssl default_server;
 +
        # listen [::]:443 ssl default_server;
 +
        #
 +
        # Self signed certs generated by the ssl-cert package
 +
        # Don't use them in a production server!
 +
        #
 +
        # include snippets/snakeoil.conf;
 +
 +
        root /home/off/html;
 +
 +
        # Add index.php to the list if you are using PHP
 +
        index index.html index.htm index.nginx-debian.html;
 +
 +
        location ~ ^/(images|js|rss|data|files|resources|foundation)/ {
 +
                # First attempt to serve request as file, then
 +
                # as directory, then fall back to displaying a 404.
 +
                try_files $uri $uri/ =404;
 +
        }
 +
 +
        location = /robots.txt {
 +
                try_files $uri $uri/ =404;
 +
        }
 +
 +
        location / {
 +
                proxy_set_header Host $host;
 +
                proxy_set_header X-Real-IP $remote_addr;
 +
                proxy_pass http://127.0.0.1:8001/cgi/display.pl?;
 +
        }
 +
 +
        location /cgi/ {
 +
                proxy_set_header Host $host;
 +
                proxy_set_header X-Real-IP $remote_addr;
 +
                proxy_pass http://127.0.0.1:8001;
 +
        }
 +
 +
        # deny access to .htaccess files, if Apache's document root
 +
        # concurs with nginx's one
 +
        #
 +
        #location ~ /\.ht {
 +
        #      deny all;
 +
        #}
 +
}
 +
 +
 +
</pre>
    
= Old notes =
 
= Old notes =

Navigation menu