This forum is now just an archive. Use the new Q&A website
It is currently Wed Apr 23, 2014 9:11 pm

All times are UTC + 2 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Installing OpenERP server and web client as autostart daemon
PostPosted: Tue Jul 07, 2009 6:49 am 
Offline

Joined: Wed Jul 01, 2009 9:14 pm
Posts: 8
Installing OpenERP server and web client as autostart daemons on Debian Lenny

Build a debian lenny server from the netinst ISO image. When the prompt appears to check which software to install, make sure all items are unchecked so you install a minimal system. Unless otherwise stated, perform all steps below as root.

Add the openerp user, which will be used to run all services.

Code:
addgroup openerp
adduser --ingroup openerp openerp


Install pre-requisite packages

Code:
apt-get install ssh unzip zip screen wget python python-psycopg2 python-reportlab python-egenix-mxdatetime python-xml python-tz python-pychart python-pydot python-lxml python-libxslt1 python-vobject postgresql python-setuptools


Download latest openerp-server python package (go to website and use latest link)

Code:
cd /home/openerp

wget http://www.openerp.com/download/stable/source/openerp-server-5.0.1-0.tar.gz


Un-tar and install openerp-server

Code:
tar -xzf openerp-server-5.0.1-0.tar.gz
cd /home/openerp/openerp-server-5.0.1-0
python setup.py install


Create openerp database role in postgres

Code:
su postgres
createuser --createdb --no-createrole --pwprompt openerp (**When prompted whether or not user is superuser, choose ‘no’**)
exit


Install turbogears and openerp web client

Code:
easy_install TurboGears==1.0.8
easy_install -U openerp-web


Now it’s time to create the daemons. First the web client:

Copy the openerp-web script in the python package to the init.d directory in debian and set permissions. This may be in a different directory if you installed a different version of openerp-server:

Code:
cp /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg/scripts/openerp-web /etc/init.d

cp /usr/lib/python2.5/site-packages/openerp_web-5.0.1_0-py2.5.egg/config/default.cfg /etc/openerp-web.cfg

chmod +x /etc/init.d/openerp-web


Edit the init.d script:

Code:
nano /etc/init.d/openerp-web


Change:
Code:
USER="terp

to

USER="openerp"


Set up logging for web client and set to start on bootup:

Code:
nano /etc/openerp-web.cfg


Change:
Code:
args="('server.log',)"

to

args="('/var/log/openerp-web.log',)"


Code:
touch /var/log/openerp-web.log
chown openerp /var/log/openerp-web.log
update-rc.d openerp-web defaults



Now let’s set up the openerp-server daemon.

Code:
nano /etc/init.d/openerp-server


Paste the following lines into the file and save:

Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenERP Server - the server
# Description: OpenERP is a complete ERP and CRM software
## END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=openerp-server
NAME=openerp-server
DAEMON=/usr/bin/openerp-server
# Specify the user name (Default: terp).
USER="openerp"
# Specifty an alternate config file (Default: ~/.openerp-serverrc)
CONFIGFILE="/etc/openerp-server.cfg"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon
DAEMON_OPTS="-c $CONFIGFILE"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}
# function that starts the daemon/service
#
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ; then
do_start() {
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
#
# Function that stops the daemon/service
do_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--chuid $USER --background --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
RETVAL=$?
sleep 5 # wait for few seconds
return $RETVAL
}
else
do_start() {
$DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
RETVAL=$?
sleep 5 # wait for few seconds
echo $! > $PIDFILE # create pidfile
return $RETVAL
}
do_stop() {
pid=`cat $PIDFILE`
kill -15 $pid
RETVAL=$?
sleep 2 # wait for few seconds
rm -f $PIDFILE # remove pidfile
return $RETVAL
}
do_restart() {
if [ -f $PIDFILE ]; then
do_stop
fi
do_start
return $?
}
fi
start_daemon() {
if [ -f $PIDFILE ]; then
echo "pidfile already exists: $PIDFILE"
exit 1
fi
echo -n "Starting $DESC: "
do_start
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
stop_daemon() {
checkpid
if [ $? -eq 1 ]; then
exit 0
fi
echo -n "Stopping $DESC: "
do_stop
if [ $? -eq 1 ]; then
echo "failed."
exit 1
fi
echo "done."
}
restart_daemon() {
echo -n "Reloading $DESC: "
do_restart
checkpid
if [ $? -eq 1 ]; then
rm -f $PIDFILE
echo "failed."
exit 1
fi
echo "done."
}
status_daemon() {
echo -n "Checking $DESC: "
checkpid
if [ $? -eq 1 ]; then
echo "stopped."
else
echo "running."
fi
}
case "$1" in
start) start_daemon ;;
stop) stop_daemon ;;
restart|force-reload) restart_daemon ;;
status) status_daemon ;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
# vim: sts=4 st=4 et


Change ownsership of init.d script and set to auto-start on boot:

Code:
chmod +x /etc/init.d/openerp-server
update-rc.d openerp-server defaults


Create server config file:

Code:
nano /etc/openerp-server.cfg


Paste following into server config file and save:

Code:
[options]
#without_demo = False
netport = 8070
secure = False
demo = {}
#syslog = true
cache_timeout = 100000
port = 8069
smtp_password = False
secure_pkey_file = server.pkey
netinterface =
#log_level = 20
admin_passwd = admin
smtp_port = 25
smtp_server = localhost
db_user = openerp
price_accuracy = 2
import_partial =
soap = False
#pidfile = true
db_maxconn = 64
reportgz = False
xmlrpc = True
#db_port = False
debug_mode = False
netrpc = True
secure_cert_file = server.cert
#interface =
#logfile = False
csv_internal_sep = ,
pg_path = None
translate_modules = ['all']
stop_after_init = False
root_path = /usr/lib/python2.5/site-packages/openerp-server
smtp_user = False
db_password = False
db_name = False
db_host = False
assert_exit_level = 30
email_from = False
addons_path = /usr/lib/python2.5/site-packages/openerp-server/addons
logfile = /var/log/openerp-server.log


Set up log file for openerp-server daemon:

Code:
touch /var/log/openerp-server.log
chown openerp /var/log/openerp-server.log


Start Daemons

Code:
/etc/init.d/openerp-server start
/etc/init.d/openerp-web start


Congratulations. You are now finished. Connect to http://<yourserverip>:8080 and have fun!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 13, 2009 7:55 pm 
Offline

Joined: Sun Feb 15, 2009 9:57 pm
Posts: 12
Location: Turkey
thank you so much. Why it is so difficult to automatically run openerp on linux than windows?
Best Regards,
Onur


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 20, 2009 4:32 pm 
Offline

Joined: Sat Jun 20, 2009 3:00 pm
Posts: 22
Thanks! That helps a lot.

I don't see why that info is not installed with the server itself instead of being user configured. But maybe that's my coddled windows experience talking? :)

_________________
Paul Drayton


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 22, 2009 2:19 pm 
Offline

Joined: Tue Mar 04, 2008 11:41 am
Posts: 319
Location: Athens, Greece
Please do not perform the procedure described above.

Although it is right, there are now Debian packages (both official and third-party builds), which will automatically install OpenERP on any Debian-compatible Linux distribution.

No hassle.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 22, 2009 2:28 pm 
Offline

Joined: Sat Jun 20, 2009 3:00 pm
Posts: 22
Thanks xrg.

When I did an apt-get install openerp-server, it seems my version was 5.0.0.3, whereas the latest version at openerp.com is 5.0.1.0.

Am I mistaken on that?

_________________
Paul Drayton


Top
 Profile  
 
 Post subject: debian packages
PostPosted: Sat Jul 25, 2009 10:03 pm 
Offline

Joined: Wed Jul 01, 2009 9:14 pm
Posts: 8
xrg, since you've brought it up, how about sharing some of these aforementioned no-hassle package repositories?

I looked for a long time and couldn't find one that keeps up with the latest stable code or even installs the web client or server so it auto-starts. It's possible that I missed it, but it's definitely not prominently documented anywhere in the OpenERP docs.

Since the official downloads available on openerp.com don't even keep up with the latest stable builds, I'm guessing third party maintained packages will be even further behind.

The whole reason why I came up with this process is because there was no other set of installation instructions that I could find that actually accomplished this simple goal.

I think that if you plan on using this in a production environment, it's foolish to install it from a debian package since you'll essentially be at the mercy of whatever third party is maintaining it. Therefore if you run into a bug that a later version of the stable code fixes, you'll have to wait until that third party decides it's time to package it up for you (and hope it's the right build). With other software applications (apache for instance) relying on packages is ok because the adoption rate is really high and they are updated often.

My recommendation is to learn how to install this software in the manner described above so you can properly support your installation with whatever build is appropriate for your environment.

My $0.02


Top
 Profile  
 
 Post subject: Re: debian packages
PostPosted: Sat Jul 25, 2009 11:05 pm 
Offline

Joined: Tue Mar 04, 2008 11:41 am
Posts: 319
Location: Athens, Greece
Quote:
xrg, since you've brought it up, how about sharing some of these aforementioned no-hassle package repositories?

See http://www.openobject.com/forum/topic12011.html
Quote:
I looked for a long time and couldn't find one that keeps up with the latest stable code or even installs the web client or server so it auto-starts.

True, we have not package the web-client. Reason is, the ez-install technology, which is extremely difficult to make it work (without allowing it to mess your system, that is).

Quote:
I think that if you plan on using this in a production environment, it's foolish to install it from a debian package since you'll essentially be at the mercy of whatever third party is maintaining it. Therefore ...

I disagree. On the contrary, in a production enviroment, you need to keep a very clear track of the files installed on the "server" machine. Moreover, it is desirable to have a testing machine, on which all changes will be tried first, before being packaged for production. In some industries, keeping such strict code control is a requirement.

Our proposed solution has been to integrate a VCS with the package build procedure, so that you can easily and immediately produce a package from any commit point on the repository. Thus, any developer working on OpenERP, can himself build the packages and keep his installations at the bleeding edge of the code progress. That is the spirit of open source: why be on the mercy of anybody, if you could just repeat and rebuild anything yourself?

http://git.hellug.gr/cgi-bin/gitweb.cgi ... ;a=summary

Note that during the whole procedure, we have tried to preserve and honor all previous work done by the OpenERP devs and the Debian packager.


My €0.02


Top
 Profile  
 
 Post subject: agree to disagree
PostPosted: Sun Jul 26, 2009 5:55 am 
Offline

Joined: Wed Jul 01, 2009 9:14 pm
Posts: 8
Probably a lot of what you said in your previous message is understandable and applicable to developers. I think a lot of people on this forum assume that the people installing OpenERP will be developers. I think that's a faulty assumption and ultimately harms OpenERP's adoption rate. I know I was going to spend about 2 more days of fooling around with it before finally giving up.

My post was simply a method I found through trial and error to give me a desired result. It works and it is valid. If you think there is a better way, please document and post step-by-step instructions so the rest of us can benefit from your knowledge.

I also find it interesting that the post you quoted above actually points to the above instruction set as a recommended way to get OpenERP up and running.

I plan on updating this procedure soon to show the community how to download the latest builds from launchpad with bzr and upgrade both daemons.

I know this all must seem rudimentary to you and others, but without these simple step-by-step instructions resulting in a successful installation, most of us would simply pass up a wonderful project and move on to a less capable open source CRM or ERP solution.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 16, 2009 4:12 pm 
Offline

Joined: Sat Jun 20, 2009 3:00 pm
Posts: 22
Gregs I agree with you - this is not rudimentary stuff for non-developers. Especially windoze guys like myself.

I have the new 5.0.2 on my ubuntu 8.4 box, and while I have got the server,web and client running in a terminal, how to get the openerp-server.cfg file created and the init.d script going has got me stumped.

Any suggestions?

_________________
Paul Drayton


Top
 Profile  
 
 Post subject: Re: agree to disagree
PostPosted: Sun Aug 16, 2009 4:20 pm 
Offline

Joined: Fri Apr 21, 2006 7:28 pm
Posts: 1349
Location: Cambridge, UK
gregs007 wrote:
... I think a lot of people on this forum assume that the people installing OpenERP will be developers. I think that's a faulty assumption and ultimately harms OpenERP's adoption rate. ...

That's why Tiny has announced its odoo On Demand offer ( http://www.openobject.com/forum/topic12473.html ) isn't it? There's no reason to install Open ERP for yourself unless you actually are a developer.

_________________
Regards, Geoff

Seath Solutions Ltd, Cambridge, UK


Top
 Profile  
 
 Post subject: Open Source
PostPosted: Mon Aug 17, 2009 3:43 pm 
Offline

Joined: Wed Jul 01, 2009 9:14 pm
Posts: 8
Quote:
...There's no reason to install Open ERP for yourself unless you actually are a developer...

And alas, my point is made. It's this type of faulty assumption that lowers the adoption rate of the product. I guess the future of open source resides only in the cloud. :?


Top
 Profile  
 
 Post subject: Re: Open Source
PostPosted: Mon Aug 17, 2009 3:54 pm 
Offline

Joined: Fri Apr 21, 2006 7:28 pm
Posts: 1349
Location: Cambridge, UK
gregs007 wrote:
... It's this type of faulty assumption ...

What assumption are you assuming? That an enterprise system admin should have no particular problem with installation (which I think is a reasonable assumption given the amount of documentation), or that a typical end user should be installing enterprise products without problem (which I think is not a reasonable assumption, because it expects knowledge that a typical end user might not have)?

_________________
Regards, Geoff

Seath Solutions Ltd, Cambridge, UK


Top
 Profile  
 
 Post subject: Me too, please help instead of having discussions...
PostPosted: Thu Aug 27, 2009 6:36 pm 
Offline

Joined: Thu May 21, 2009 2:04 pm
Posts: 13
Location: Belgium
pdrayton wrote:
Gregs I agree with you - this is not rudimentary stuff for non-developers. Especially windoze guys like myself.

I have the new 5.0.2 on my ubuntu 8.4 box, and while I have got the server,web and client running in a terminal, how to get the openerp-server.cfg file created and the init.d script going has got me stumped.

Any suggestions?


The error one gets with 502 (and 503)

mvanders@ant:~$ sudo /etc/init.d/openerp-server start
Starting openerp-server: start-stop-daemon: --start needs --exec or --startas
Try `start-stop-daemon --help' for more information.
/etc/init.d/openerp-server: line 37: --chuid: command not found
/etc/init.d/openerp-server: line 38: --exec: command not found
failed.

So where is the problem?

_________________
Marc Vanderstraeten
Founder of Pool Of Plone Experts, Dossier-On-Web


Top
 Profile  
 
 Post subject: rc file for OpenSuSE 11.1
PostPosted: Sat Sep 05, 2009 6:25 pm 
Offline

Joined: Sat Sep 05, 2009 6:07 pm
Posts: 16
Location: Naumburg/Germany
/etc/rc.d/openerp-server file for OpenSuSE 11.1:

Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: OpenERP Server - the server
# Description: OpenERP is a complete ERP and CRM software
### END INIT INFO

NAME=openerp-server
DAEMON=/usr/local/bin/openerp-server
# Specify the user name (Default: terp).
USER="openerp"
# Specifty an alternate config file (Default: ~/.openerp-serverrc)
CONFIGFILE="/etc/openerp-server.cfg"

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

PIDFILE=/var/run/$NAME.pid

test -x $DAEMON || {
   echo 1>&2 "$DAEMON not installed"
   if test "$1" == "stop" ; then exit 0 ; else exit 5 ; fi
}
test -f $CONFIGFILE || {
   echo 1>&2 "$CONFIGFILE not present"
   if test "$1" == "stop" ; then exit 0 ; else exit 5 ; fi
}

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

shopt -s nullglob
ret=true

case "$1" in
    start)

   if [ -e $pidfile ]; then
           $0 status &>/dev/null
      RETVAL=$?
      if [ $RETVAL = 1 ]; then
            echo "Warning: found stale pidfile (unclean shutdown?)"
      elif [ $RETVAL = 0 ]; then
            echo "$NAME is already running ($pidfile)"
            rc_failed $RETVAL
            rc_status -v1
            rc_exit
      fi
   fi

   echo -n "Starting $NAME "

   sudo -u $USER $DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
   RETVAL=$?
   sleep 5 # wait for few seconds
   echo $! > $PIDFILE # create pidfile
   rc_failed 0
   # Remember status and be verbose
   rc_status -v
   ;;
    stop)
   echo -n "Shutting down $NAME "

   if ! [ -f $pidfile ]; then
      echo -n "(not running)"
   else
      PID=$(<PIDFILE>/dev/null
      case $? in
          1)  echo -n "(not running)";;
          0)  # ok
          ;;
      esac
      rm -f $PIDFILE
   fi

   # Remember status and be verbose
   rc_status -v
   ;;
    try-restart)
   ## Stop the service and if this succeeds (i.e. the
   ## service was running before), start it again.
   ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
   $0 status >/dev/null &&  $0 restart

   # Remember status and be quiet
   rc_status
   ;;
    restart)
   ## Stop the service and regardless of whether it was
   ## running or not, start it again.
   $0 stop
   $0 start

   # Remember status and be quiet
   rc_status
   ;;
    force-reload)
   ## Signal the daemon to reload its config. Most daemons
   ## do this on signal 1 (SIGHUP).
   ## If it does not support it, restart.

   echo -n "Reload service $NAME"

   ## Otherwise:
   $0 stop  &&  $0 start
   rc_status
   ;;
    reload)
   ## Like force-reload, but if daemon does not support
   ## signalling, do nothing (!)

   rc_failed 3
   rc_status -v
   ;;
    status)
   echo -n "Checking for $NAME: "
   # Status has a slightly different for the status command:
   # 0 - service running
   # 1 - service dead, but /var/run/  pid  file exists
   # 2 - service dead, but /var/lock/ lock file exists
   # 3 - service not running

   if ! [ -f $PIDFILE ]; then
      # not running
      rc_failed 3
   elif [ -s $PIDFILE -a -d /proc/$(<$PIDFILE) ]; then
      # running
      :
   else
      # stale pid file
      rc_failed 1
      rm -f $pidfile
   fi
   rc_status -v
   ;;
    *)
   echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
   exit 1
   ;;
esac
rc_exit

If you did not installed from rpm, you should verify, that many folders should be writeable (or owned by) user openrp.
I made all files owned by him:
Code:
cd /usr/local/lib/python2.5/site-packages/openerp-server
chown -R openerp: *


Last edited by oehhar on Tue Sep 15, 2009 10:03 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 10, 2009 6:01 pm 
Offline

Joined: Thu Aug 20, 2009 9:47 pm
Posts: 148
I'm still getting:

mattlg@mattlg2:~> sudo /etc/init.d/openerp-server stop
Shutting down openerp-server /etc/init.d/openerp-server: command substitution: line 97: syntax error near unexpected token `newline'
/etc/init.d/openerp-server: command substitution: line 97: `<PIDFILE>'

Cheers

MattLG


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP