Installazione di OpenERP su server Debian: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=OpenERP 7 e Debian 6=
La versione 7 è una Long Term release
Creiamo un utente linux che ha il nome: openerp:
sudo adduser --system --home=/home/openerp --group openerp
* Impostare la shell
sudo usermod --shell /bin/bash openerp
* Installare Postgres ed il tool di gestione:
sudo apt-get install postgresql phppgadmin
* Abilitare il login dell'utente postgres in phppgadmin
sudoedit /etc/phppgadmin/config.inc.php
$conf['extra_login_security'] = false;
* Creare l'utenza database openerp, e ricordarsi la password (per comodità impostarla uguale all'utenza Linux):
sudo -i -u postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
exit
* Configurare l'accesso al DB:
sudoedit /etc/postgresql/8.4/main/pg_hba.conf
...
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local  all        openerp                          md5
...
* Restart di postgres:
sudo invoke-rc.d postgresql restart
* Installare le dipendenze python:
<pre>
sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
python-webdav python-werkzeug python-xlwt python-yaml python-zsi
sudo apt-get install python-dateutil python-feedparser python-gdata \
python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-reportlab \
python-simplejson python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-zsi
</pre>
* Reinstallazione con ultima versione di Werkzeug:
sudo apt-get install python-pip
sudo apt-get remove python-werkzeug
sudo pip install werkzeug
* Idem per python-gdata
sudo apt-get remove python-gdata
sudo pip install gdata --upgrade
* Scarico OpenERP server, web, addons e personalizzazioni in Italiano (attenzione, sembra che utilizzare bzr con export https_proxy="https://proxy.example.com:3128" non funzioni !!!):
<pre>
sudo -i -u openerp
mkdir lp
cd lp
bzr branch lp:openobject-server/7.0 openerp
bzr branch lp:openerp-web/7.0 web
bzr branch lp:openobject-addons/7.0 addons
bzr branch lp:openobject-italia/7.0 openobject-italia
</pre>
* Creiamo i links per gli addons:
<pre>
cd ~/lp/openerp/openerp/addons
ln -s ~/lp/addons/* .
ln -s ~/lp/web/addons/* .
ln -s ~/lp/openobject-italia/* .
</pre>
* Copiare il file di configurazione:
sudo cp /home/openerp/lp/openerp/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
* Editarlo
sudoedit /etc/openerp-server.conf
dn_password = mypassword  # quella messa alla creazione dell'utente in PG
* Avviare manualmente openerp la prima volta:
cd ~/lp/openerp/
./openerp-server -c /etc/openerp-server.conf
* Il server sarà accessibile all'url http://servername.example.com:8069
* Attendere qualche minuto per il caricamento della pagina, perchè verrà creato il Database inziale, e la homepage è abbastanza pesante.
* Se la pagina non si carica, o da un errore tipo
TypeError: localStorage is null
* In firefox impostare il about:config (*[http://forum.openerp.com/forum/topic33772.html OpenERP • View topic - web-client error only on firefox] )
dom.storage.enabled;true
* Verificare se si riesce a creare un database dall'interfaccia web. La password è
admin
* Se si riceve un errore del tipo:
ERROR postgres openerp.netsvc: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT:  Use the same encoding as in the template database, or use template0 as template.
* Modificare il template del database:
  sudoedit /etc/openerp-server.conf
db_template = template0
* Ricreare il database da inerfaccia web
* Fermare il server
CTRL-C
==Avvio automatico==
* Impostare il logging su file:
sudoedit /etc/openerp-server.conf
logfile = /var/log/openerp/openerp-server.log
* Creare la directory per i log
sudo mkdir -p /var/log/openerp/
sudo chown openerp: /var/log/openerp/
* Il logging è ora SOLO su logfile
* Creare il file di initd:
sudoedit /etc/init.d/openerp-server
<pre>
#!/bin/sh
### BEGIN INIT INFO
# Provides:            openerp-server
# Required-Start:      $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:        $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:        0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
DAEMON=/home/openerp/lp/openerp/openerp-server
NAME=openerp-server
DESC=openerp-server
# Specify the user name (Default: openerp).
USER=openerp
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}
case "${1}" in
        start)
                echo -n "Starting ${DESC}: "
                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}
                echo "${NAME}."
                ;;
        stop)
                echo -n "Stopping ${DESC}: "
                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
                echo "${NAME}."
                ;;
        restart|force-reload)
                echo -n "Restarting ${DESC}: "
                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
     
                sleep 1
                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}
                echo "${NAME}."
                ;;
        *)
                N=/etc/init.d/${NAME}
                echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
                exit 1
                ;;
esac
exit 0
</pre>
* Sistemare le permission:
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
* Impostare l'avvio automatico:
sudo update-rc.d openerp-server defaults
* Avviare il processo:
sudo invoke-rc.d openerp-server start
* Verificare i log
sudo tail -f /var/log/openerp/openerp-server.log
==Configurazione accesso tramite virtualhost==
Per accedere ad un url senza sepcificare la porta, ma usando un virtualhost dal nome openerp.example.com si usa mod_proxy di apache.
* Attivare i moduli necessari:
sudo a2enmod proxy proxy_connect proxy_http headers ssl
* Creare il file di configurazione:
sudoedit /etc/apache2/sites-available/openerp
<pre>
<VirtualHost *:80>
        Servername openerp.example.com
        ServerAlias openerp
        AddDefaultCharset off
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
</VirtualHost>
</pre>
* Abilitare il virtualhost
sudo a2ensite openerp
* Riavviare apache:
sudo invoke-rc.d apache2 restart
* Impostare la modalità con proxy in openerp:
sudoedit /etc/openerp-server.conf
proxy_mode = True
* Riavviare openerp:
sudo invoke-rc.d openerp-server restart
* L'istanza sarà ora disponibile su http://openerp.example.com
==Riferimenti==
*[http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/ The Open Sourcerer » How to install OpenERP 7.0 on Ubuntu 12.04 LTS]
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/openerp (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:openerp]
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/servizio (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:servizio]
*[http://tipstricks.itmatrix.eu/?p=497 IT Tips and Tricks » Installing openERP on Debian Lenny 64 Bit]
**[http://sql-info.de/postgresql/notes/installing-phppgadmin.html Installing phpPgAdmin]
=OpenERP 6.1 e Debian 6=
=OpenERP 6.1 e Debian 6=
La versione 6.1 è stata notevolmente migliorata inglobando, in un certo senso, il web-client, reso velocissimo dalla nuova riscrittura.  
La versione 6.1 è stata notevolmente migliorata inglobando, in un certo senso, il web-client, reso velocissimo dalla nuova riscrittura.  
Line 206: Line 487:
* Avviare il processo:
* Avviare il processo:
  sudo invoke-rc.d openerp-server start
  sudo invoke-rc.d openerp-server start
==Configurazione accesso tramite virtualhost==
Per accedere ad un url senza sepcificare la porta, ma usando un virtualhost dal nome openerp.example.com si usa mod_proxy di apache.
* Attivare i moduli necessari:
sudo a2enmod proxy proxy_connect proxy_http headers ssl
* Creare il file di configurazione:
sudoedit /etc/apache2/sites-available/openerp
<pre>
<VirtualHost *:80>
        Servername openerp.example.com
        ServerAlias openerp
        AddDefaultCharset off
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
</VirtualHost>
</pre>
* Abilitare il virtualhost
sudo a2ensite openerp
* Riavviare apache:
sudo invoke-rc.d apache2 restart
* Impostare la modalità con proxy in openerp:
sudoedit /etc/openerp-server.conf
proxy_mode = True
* Riavviare openerp:
sudo invoke-rc.d openerp-server restart
* L'istanza sarà ora disponibile su http://openerp.example.com


==Riferimenti==
==Riferimenti==
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/openerp (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:openerp]
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/openerp (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:openerp]
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/servizio (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:servizio]
*[http://wiki.openerp-italia.org/doku.php/area_tecnica/installazione/v6.1_ubuntu_12.04/servizio (Openerp-Italia WIKI) area_tecnica:installazione:v6.1_ubuntu_12.04:servizio]
*[http://tipstricks.itmatrix.eu/?p=497 IT Tips and Tricks » Installing openERP on Debian Lenny 64 Bit]

Latest revision as of 11:43, 8 January 2013

OpenERP 7 e Debian 6

La versione 7 è una Long Term release

Creiamo un utente linux che ha il nome: openerp:

sudo adduser --system --home=/home/openerp --group openerp
  • Impostare la shell
sudo usermod --shell /bin/bash openerp
  • Installare Postgres ed il tool di gestione:
sudo apt-get install postgresql phppgadmin
  • Abilitare il login dell'utente postgres in phppgadmin
sudoedit /etc/phppgadmin/config.inc.php 
$conf['extra_login_security'] = false;

  • Creare l'utenza database openerp, e ricordarsi la password (per comodità impostarla uguale all'utenza Linux):
sudo -i -u postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
exit
  • Configurare l'accesso al DB:
sudoedit /etc/postgresql/8.4/main/pg_hba.conf
...
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         openerp                           md5
...
  • Restart di postgres:
sudo invoke-rc.d postgresql restart
  • Installare le dipendenze python:
sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata \
python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \
python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \
python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \
python-webdav python-werkzeug python-xlwt python-yaml python-zsi
sudo apt-get install python-dateutil python-feedparser python-gdata \
python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-reportlab \
python-simplejson python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-zsi
  • Reinstallazione con ultima versione di Werkzeug:
sudo apt-get install python-pip
sudo apt-get remove python-werkzeug
sudo pip install werkzeug 
  • Idem per python-gdata
sudo apt-get remove python-gdata
sudo pip install gdata --upgrade


  • Scarico OpenERP server, web, addons e personalizzazioni in Italiano (attenzione, sembra che utilizzare bzr con export https_proxy="https://proxy.example.com:3128" non funzioni !!!):
sudo -i -u openerp
mkdir lp
cd lp
bzr branch lp:openobject-server/7.0 openerp
bzr branch lp:openerp-web/7.0 web
bzr branch lp:openobject-addons/7.0 addons
bzr branch lp:openobject-italia/7.0 openobject-italia
  • Creiamo i links per gli addons:
cd ~/lp/openerp/openerp/addons
ln -s ~/lp/addons/* .
ln -s ~/lp/web/addons/* .
ln -s ~/lp/openobject-italia/* .
  • Copiare il file di configurazione:
sudo cp /home/openerp/lp/openerp/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
  • Editarlo
sudoedit /etc/openerp-server.conf
dn_password = mypassword  # quella messa alla creazione dell'utente in PG
  • Avviare manualmente openerp la prima volta:
cd ~/lp/openerp/
./openerp-server -c /etc/openerp-server.conf


  • Il server sarà accessibile all'url http://servername.example.com:8069
  • Attendere qualche minuto per il caricamento della pagina, perchè verrà creato il Database inziale, e la homepage è abbastanza pesante.
  • Se la pagina non si carica, o da un errore tipo
TypeError: localStorage is null
dom.storage.enabled;true 
  • Verificare se si riesce a creare un database dall'interfaccia web. La password è
admin
  • Se si riceve un errore del tipo:
ERROR postgres openerp.netsvc: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

HINT: Use the same encoding as in the template database, or use template0 as template.

  • Modificare il template del database:
 sudoedit /etc/openerp-server.conf
db_template = template0
  • Ricreare il database da inerfaccia web
  • Fermare il server
CTRL-C

Avvio automatico

  • Impostare il logging su file:
sudoedit /etc/openerp-server.conf
logfile = /var/log/openerp/openerp-server.log
  • Creare la directory per i log
sudo mkdir -p /var/log/openerp/
sudo chown openerp: /var/log/openerp/
  • Il logging è ora SOLO su logfile
  • Creare il file di initd:
sudoedit /etc/init.d/openerp-server
#!/bin/sh

### BEGIN INIT INFO
# Provides:             openerp-server
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO

PATH=/bin:/sbin:/usr/bin
DAEMON=/home/openerp/lp/openerp/openerp-server
NAME=openerp-server
DESC=openerp-server

# Specify the user name (Default: openerp).
USER=openerp

# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"

[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}

case "${1}" in
        start)
                echo -n "Starting ${DESC}: "

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

        stop)
                echo -n "Stopping ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo

                echo "${NAME}."
                ;;

        restart|force-reload)
                echo -n "Restarting ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
      
                sleep 1

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

        *)
                N=/etc/init.d/${NAME}
                echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
                exit 1
                ;;
esac

exit 0
  • Sistemare le permission:
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
  • Impostare l'avvio automatico:
sudo update-rc.d openerp-server defaults 
  • Avviare il processo:
sudo invoke-rc.d openerp-server start
  • Verificare i log
sudo tail -f /var/log/openerp/openerp-server.log 


Configurazione accesso tramite virtualhost

Per accedere ad un url senza sepcificare la porta, ma usando un virtualhost dal nome openerp.example.com si usa mod_proxy di apache.

  • Attivare i moduli necessari:
sudo a2enmod proxy proxy_connect proxy_http headers ssl
  • Creare il file di configurazione:
sudoedit /etc/apache2/sites-available/openerp
<VirtualHost *:80>
        Servername openerp.example.com
        ServerAlias openerp
        AddDefaultCharset off
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
</VirtualHost>
  • Abilitare il virtualhost
sudo a2ensite openerp
  • Riavviare apache:
sudo invoke-rc.d apache2 restart
  • Impostare la modalità con proxy in openerp:
sudoedit /etc/openerp-server.conf 
proxy_mode = True
  • Riavviare openerp:
sudo invoke-rc.d openerp-server restart

Riferimenti


OpenERP 6.1 e Debian 6

La versione 6.1 è stata notevolmente migliorata inglobando, in un certo senso, il web-client, reso velocissimo dalla nuova riscrittura.

Nulla da invidiare alle prestazioni dell'ormai vetusto GTK client.

Trattandosi di una installazione “developer” partiamo già con un utente linux che ha il nome: openerp:

sudo adduser --system --home=/home/openerp --group openerp
  • Installare Postgres ed il tool di gestione:
sudo apt-get install postgresql phppgadmin
  • Creare l'utenza database openerp, e ricordarsi la password (per comodità impostarla uguale all'utenza Linux):
sudo -i -u postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
exit
  • Configurare l'accesso al DB:
sudoedit /etc/postgresql/8.4/main/pg_hba.conf
...
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   all         openerp                           md5
...
  • Restart di postgres:
sudo invoke-rc.d postgresql restart
  • Installare le dipendenze python:
sudo apt-get install python-dateutil python-feedparser python-gdata \
python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-reportlab \
python-simplejson python-tz python-vatnumber python-vobject python-webdav \
python-werkzeug python-xlwt python-yaml python-zsi
  • Reinstallazione con ultima versione di Werkzeug:
sudo apt-get install python-pip
sudo apt-get remove python-werkzeug
sudo pip install werkzeug 
  • Scarico OpenERP server, web, addons e personalizzazioni in Italiano (attenzione, sembra che utilizzare bzr con export https_proxy="https://proxy.example.com:3128" non funzioni !!!):
sudo -i -u openerp
mkdir lp
cd lp
bzr branch lp:openobject-server/6.1 openerp
bzr branch lp:openerp-web/6.1 web
bzr branch lp:openobject-addons/6.1 addons
bzr branch lp:openobject-italia 
  • Creiamo i links per gli addons:
cd ~/lp/openerp/openerp/addons
ln -s ~/lp/addons/* .
ln -s ~/lp/web/addons/* 
ln -s ~/lp/openobject-italia/* .
  • Creare il file di configurazione minimale:
cd ~/lp/openerp/
./openerp-server -s
  • Terminare il processo con
CTRL-C
  • Modificare i parametri:
sudoedit ~/.openerp_serverrc
db_host = localhost
dn_password = mypassword  # quella messa alla creazione dell'utente in PG
db_user = openerp
  • Avviare il servizio manualmente senza il parametro -s (modalità developer ovvero console)
cd ~/lp/openerp/
./openerp-server
  • Per fermarlo, premere
CTRL-C

Se vedete la nuova sfavillante maschera di login tutto sembra essere andato per il verso giusto, andate però nella gestione database per creare la vostra prima azienda.

E' stato eliminato il wizard per caricare i moduli standard però vi accorgerete quanto si caricano velocemente dalla gestione moduli in area amministrazione.

Avvio automatico

  • Dopo aver fermato il processo openerp, spostare il file di configurazione:
sudo mv /home/openerp/.openerp_serverrc /etc/openerp-server.conf
sudo chown openerp:openerp /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf
  • Abilitare il logging:
sudoedit /etc/openerp-server.conf
logfile = /var/log/openerp/openerp-server-log
  • Creare il file di initd:
sudoedit /etc/init.d/openerp-server
#!/bin/sh

### BEGIN INIT INFO
# Provides:             openerp-server
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.
### END INIT INFO

PATH=/bin:/sbin:/usr/bin
DAEMON=/home/openerp/lp/openerp/openerp-server
NAME=openerp-server
DESC=openerp-server

# Specify the user name (Default: openerp).
USER=openerp

# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS="-c $CONFIGFILE"

[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}

case "${1}" in
        start)
                echo -n "Starting ${DESC}: "

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

        stop)
                echo -n "Stopping ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo

                echo "${NAME}."
                ;;

        restart|force-reload)
                echo -n "Restarting ${DESC}: "

                start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \
                        --oknodo
      
                sleep 1

                start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                        --chuid ${USER} --background --make-pidfile \
                        --exec ${DAEMON} -- ${DAEMON_OPTS}

                echo "${NAME}."
                ;;

        *)
                N=/etc/init.d/${NAME}
                echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
                exit 1
                ;;
esac

exit 0
  • Sistemare le permission:
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
  • Impostare l'avvio automatico:
sudo update-rc.d openerp-server defaults 
  • Creare la logdir:
sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp
  • Avviare il processo:
sudo invoke-rc.d openerp-server start

Configurazione accesso tramite virtualhost

Per accedere ad un url senza sepcificare la porta, ma usando un virtualhost dal nome openerp.example.com si usa mod_proxy di apache.

  • Attivare i moduli necessari:
sudo a2enmod proxy proxy_connect proxy_http headers ssl
  • Creare il file di configurazione:
sudoedit /etc/apache2/sites-available/openerp
<VirtualHost *:80>
        Servername openerp.example.com
        ServerAlias openerp
        AddDefaultCharset off
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:8069/
        ProxyPassReverse / http://127.0.0.1:8069/
</VirtualHost>
  • Abilitare il virtualhost
sudo a2ensite openerp
  • Riavviare apache:
sudo invoke-rc.d apache2 restart
  • Impostare la modalità con proxy in openerp:
sudoedit /etc/openerp-server.conf 
proxy_mode = True
  • Riavviare openerp:
sudo invoke-rc.d openerp-server restart

Riferimenti