Odoo Help

3

How to run V7.0 in multi-threaded mode?

By
Ahmet Altinisik
on 2/14/13, 3:54 PM 8,832 views

I have seen many blog entries and technical notes about gunicorn and possibilities since 6.1. However I have been unable to make a production grade installation for openerp using nginx and gunicorn.

How do we run OpenERP V7.0 in multi-threaded mode ?

As pointed out by Andreas, possible duplicate of What's the right way to start cron worker jobs? [EDIT: link fixed]

Daniel Reis
on 2/15/13, 4:58 AM

Daniel, my question is a related question not duplicate.

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/15/13, 7:57 PM
2
Andreas Brueckl
On 2/15/13, 4:19 AM

As stated here: https://accounts.openerp.com/forum/Help-1/question/1061/

the preferred way to run openerp is to use "openerp-server.py --workers xx" instead of using gunicorn.

Does anybody know if there are big differences between 7.0 built-in multiprocessor-mode or gunicorn?

I think there is maybe we should ask another question about this

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/15/13, 4:58 AM

Thanks for your suggestion. I have created a new question!

Andreas Brueckl
on 2/15/13, 5:04 AM

Thanks for point us to right direction.

agb80
on 2/15/13, 11:45 AM

Since it is not the recommended way to use gunicorn (from @Oliver's answer) for multiprocessor mode I am accepting your answer.

Altınkaya Elektronik Cihaz Kutuları imalat Ticaret ltd sti, Ahmet Altinisik
on 2/22/13, 1:08 PM
1
Ahmet Altinisik
On 2/19/13, 6:44 PM

OpenERP V7.0 installation on ubuntu 12.04

just after a clean installation of ubuntu 12.04 LTS

commands are complete so you can copy paste these commands below to and complete the process as a newbie.

Update apt source list

sudo apt-get update

Download and install updates

sudo apt-get upgrade

install required packages for openerp

sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
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-imaging

install some other packages that we will probably need in future

sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko postgresql

install gdata client (since ubuntu package is old we download and install from source)

wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz 
tar zxvf gdata-2.0.17.tar.gz 
cd gdata-2.0.17/
sudo python setup.py install

create a new openerp system user for openerp and other related processes

sudo adduser openerp --home /opt/openerp

Create database user for openerp

sudo -u postgres createuser -s openerp

move to the install directory

mkdir /opt/openerp/v7
cd /opt/openerp/v7

run the bazaar to download the latest revision from launchpad
(this will take long if an error occurs just rerun command)

bzr branch lp:openerp-web/7.0 web

(this will take longer if an error occurs just rerun command)

bzr branch lp:openobject-server/7.0 server

(this will take much more longer if an error occurs just rerun last command)

bzr branch lp:openobject-addons/7.0 addons

Exit from openerp user shell

exit

Copy OpenERP configuration file to /etc

sudo cp /opt/openerp/v7/server/install/openerp-server.conf /etc/openerp-server.conf

Edit the configuration file

sudo nano /etc/openerp-server.conf

Write your database operation password and remove the semicolon of that line. Also add the addons_path to the end of file, my file looks like below.

[options]
; This is the password that allows database operations:
admin_passwd = PASSWORD
db_host = False
db_port = False
db_user = openerp
db_password = False
addons_path = /opt/openerp/v7/addons,/opt/openerp/v7/web/addons
;Log settings
logfile = /var/log/openerp/openerp-server.log
log_level = error

Change the file permissions and file ownership to the openerp user.

sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf

Run the server

sudo su openerp
cd /opt/openerp/v7/server/
./openerp-server -c /etc/openerp-server.conf &

test your installation from http://yourserverIP:8069

Starting Server Up Automatically

After playing with init script in source I decided to use Open Sourcerer's init script since it is clean and nice. You can download the original from: http://www.theopensourcerer.com/wp-content/uploads/2012/12/openerp-server

We just need to change the location of the daemon. below is the init script you can copy paste this to the file.

#!/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=/opt/openerp/v7/server/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

You can download this edited copy with the following URL.

sudo wget http://www.altinisik.net/openerp/openerp-server -O /etc/init.d/openerp-server

Make the init script executable.

sudo chmod +x /etc/init.d/openerp-server

Add openerp-server to system startup

sudo update-rc.d openerp-server defaults

Create log directory for openerp

sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp

Copy Logrotate file from source to /etc/logrotate.d folder

sudo cp /opt/openerp/v7/server/install/openerp-server.logrotate /etc/logrotate.d/openerp-server
sudo chmod 755 /etc/logrotate.d/openerp-server

Restart the server to check if init script works

sudo shutdown -r now

Please give your feedback about instructions above

1
agb80
On 2/14/13, 5:56 PM

After being looking for a while, I found this documentation for 6.1: https:// gist.github.com/ovnicraft/4384681

Is in spanish (my primary language) if google translation dosn't help you let me know for translate it for you.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 2/14/13, 3:54 PM
Seen: 8832 times
Last updated: 3/16/15, 8:10 AM