Date: Sat, 31 Mar 2012 06:54:49 GMT From: Franck PORCHER <franck.porcher@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/166534: OpenERP misconfiguration Message-ID: <201203310654.q2V6sneM094559@red.freebsd.org> Resent-Message-ID: <201203310700.q2V70TZR043145@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 166534 >Category: ports >Synopsis: OpenERP misconfiguration >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 31 07:00:28 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Franck PORCHER >Release: FreeBSD 9.0_RELEASE >Organization: Francky's -- Smart Technologies >Environment: FreeBSD cesar.franckys.com 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Tue Dec 27 14:14:29 PST 2011 root@build9x64.pcbsd.org:/u sr/obj/builds/amd64/pcbsd-build90/fbsd-source/9.0/sys/GENERIC amd64 >Description: OpenERP : The two following ports have stock misconfiguration issues that prevent the associated services from starting after the ports are installed. 1) finance/openerp-server (6.0.3) --------------------------------- * openerp-server will not start from scratch because of some postgresql-server requirements not being met, namely : - postgresql <openerp role> (user) not created - postgresql <openerp database> not created * Once that corrected, there still remains a few issues with openerp-server rc script (/usr/local/etc/rc.d/openerpd) bearing discrepencies with main openerp-server configuration file (/usr/local/etc/openerp-server.conf) regarding pid and logs. 2) finance/openerp-web (5.0.11) ------------------------------- * openerp-web (a web-server front-end proxy to openerp-server, allowing clients to connect thru a simple web-browser) will not start mainly because of a python library mismatch regarding py-cherrypy (needs to downgrade to cherrypy 3.1.2) and similar issues with pid and logs >How-To-Repeat: Install finance/openerp-server (6.0.3) and finance/openerp-web (5.0.11) from (stock) ports. Then (as root), try : # /usr/local/etc/rc.d/openerpd start # /usr/local/etc/rc.d/openerp-web start Check that these services did not start with : # ps -auxww | grep python >Fix: (See attached file) I may suggest that a www/py-cherrypy-321 port be temporarily added using CherryPy-3.1.2.tar.gz until the problem with openerp-web.py is solved. distinfo : SHA256 (CherryPy-3.1.2.tar.gz) = 0dfd65507b047d54c09849e7a4b8bdd3616fa8776a5dbff7697cbf6ea1559bf6 SIZE (CherryPy-3.1.2.tar.gz) = 319196 In the meantime, please see the attached file for some workarounds regarding both openerp-server and openerp-web. Not being a seasoned port maintainer, I will leave it up to the official maintainer to review and install these patches into the concerned mainstream ports. The proposed patches have been extensively tested. They are reliable and they work perfectly for me in this (standard) FreeBSD configuration. Please do not hesitate to contact me for more informations regarding this work. Cheers, Dr. Franck Porcher, Ph.D Patch attached with submission follows: OpenERP misconfiguration ######################### ENVIRONMENT ######################### FreeBSD cesar.franckys.com 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Tue Dec 27 14:14:29 PST 2011 root@build9x64.pcbsd.org:/usr/obj/builds/amd64/pcbsd-build90/fbsd-source/9.0/sys/GENERIC amd64 ######################### FULL DESCRIPTION ######################### The two following ports have stock misconfiguration issues that prevent the associated services from starting after the ports are installed. 1) finance/openerp-server (6.0.3) --------------------------------- * openerp-server will not start from scratch because of some postgresql-server requirements not being met, namely : - postgresql <openerp role> (user) not created - postgresql <openerp database> not created * Once that corrected, there still remains a few issues with openerp-server rc script (/usr/local/etc/rc.d/openerpd) bearing discrepencies with main openerp-server configuration file (/usr/local/etc/openerp-server.conf) regarding pid and logs. 2) finance/openerp-web (5.0.11) ------------------------------- * openerp-web (a web-server front-end proxy to openerp-server, allowing clients to connect thru a simple web-browser) will not start mainly because of a python library mismatch regarding py-cherrypy (needs to downgrade to cherrypy 3.1.2) and similar issues with pid and logs ######################### HOW TO REPEAT THE PROBLEM ######################### Install finance/openerp-server (6.0.3) and finance/openerp-web (5.0.11) from (stock) ports. Then (as root), try : # /usr/local/etc/rc.d/openerpd start # /usr/local/etc/rc.d/openerp-web start Check that these services did not start with : # ps -auxww | grep python ######################### PATCHES AND WORK-AROUND ######################### I suggest that a www/py-cherrypy-321 port be temporarily added using CherryPy-3.1.2.tar.gz until the problem with openerp-web.py is solved. distinfo : SHA256 (CherryPy-3.1.2.tar.gz) = 0dfd65507b047d54c09849e7a4b8bdd3616fa8776a5dbff7697cbf6ea1559bf6 SIZE (CherryPy-3.1.2.tar.gz) = 319196 In the meantime, please see the attached file for some workarounds regarding both openerp-server and openerp-web. Not being a seasoned port maintainer, I will leave it up to the official maintainer to review and install these patches into the concerned mainstream ports. The proposed patches have been extensively tested. They are reliable and they work perfectly in this configuration. Please do not hesitate to contact me for more informations regarding this work. Cheers, Dr. Franck Porcher, Ph.D - SECTION 1: Proposed patches for configuration files associated with finance/openerp-server - SECTION 2: finance/openerp-web post-install script - SECTION 3: Proposed patches for configuration files associated with finance/openerp-web - SECTION 4: Immediate work-around for fixing finance/openerp-web mis-install ============================== = SECTION 1 = = Proposed patches regarding = = files associated with = = finance/openerp-server = ============================== /usr/local/etc/openerp-server.conf ----------------------------------------------------------------------------- # Example configuration file for OpenERP-server # # This is an example configuration file, just copy it # to openerp-server.conf and edit it to suit your needs. # # Patch submitted by (c) Franck Porcher, Ph.D, to smooth some default values [options] # Basic daemon configuration options ################## root_path = /usr/local/lib/python2.7/site-packages/openerp-server/ addons_path = /usr/local/lib/python2.7/site-packages/openerp-server/addons # netinterface = # interface = port = 8069 netport = 8070 debug_mode = False stop_after_init = False soap = False xmlrpc = True netrpc = True secure = False cache_timeout = 100000 pidfile = /var/run/openerp/openerp-server.pid reportgz = False admin_passwd = admin login_message = False price_accuracy = 2 csv_internal_sep = , translate_modules = ['all'] # Logging options ##################################### syslog = True log_level = info logfile = /var/log/openerp/openerp-server.log assert_exit_level = warn # Database options #################################### db_name = openerp db_user = openerp db_password = openerp db_host = localhost db_maxconn = 64 pg_path = /usr/local/bin list_db = True # import_partial = # SMTP options ######################################## smtp_server = localhost smtp_port = 25 smtp_user = False smtp_password = False email_from = False # Use demo files? ##################################### # without_demo = True # demo = {} ----------------------------------------------------------------------------- /usr/local/etc/rc.d/openerpd ----------------------------------------------------------------------------- #!/bin/sh # # PROVIDE: openerpd # REQUIRE: postgresql LOGIN # # Add the following lines to /etc/rc.conf to enable openerp-server # # # openerpd_enable (bool): Set to "NO" by default, # Set it to "YES" to enable openerp-server # # openerpd_config (str): The path to the openerp-server configuration file # (defaults to /usr/local/etc/openerp-server.conf) # # openerpd_flags (str): Extra arguments to be used when invoking # the openerp-server daemon. # # Patch submitted by (c) Franck Porcher, Ph.D, to fix some issues regarding # pidfile, log files, and discrepencies with the main configuration file. # getval varname file [default_value] [separator_char] # - Discard comment lines (any text leading with blanks then #) # - Retain only the last value set _getval () { local varname local filename local default_value local separator varname="$1" filename="$2" default_value="$3" separator=${4-"="} local value value=$( grep -E "^\s*${varname}\s*${separator}" ${filename} \ | cut -d${separator} -f 2 \ | sed -E 's/^[ ]*//;s/[ ]*$//' \ |tail -n 1 \ ); echo ${value-"${default_value}"} } name=openerpd command=/usr/local/bin/openerp-server . /etc/rc.subr rcvar=openerpd_enable load_rc_config "${name}" openerpd_enable="${openerpd_enable-"NO"}" openerpd_config="${openerpd_config-"/usr/local/etc/openerp-server.conf"}" openerpd_user="${openerpd_user-"openerpd"}" openerpd_pidfile="${openerpd_pidfile:-"$(_getval pidfile "${openerpd_config}" "/var/run/openerp/openerp-server.pid")"}" openerpd_logdir="${openerpd_logdir:-"$(dirname $(_getval logfile "${openerpd_config}" "/var/log/openerp/openerp-server.log"))"}" openerpd_flags="${openerpd_flags:-"--config=${openerpd_config}"}" # /etc/rc.subr use $pidfile (not ${name}_pidfile) pidfile="${openerpd_pidfile}" required_files="${openerpd_config}" start_precmd="${name}_prestart" stop_cmd="${name}_stop" status_cmd="${name}_status" getval_cmd="${name}_getval" openerpd_prestart() { local d d="$(dirname "${openerpd_pidfile}")" if [ ! -d "${d}" ] then mkdir -p "${d}" fi chown "${openerpd_user}" "${d}" d="$(dirname "${openerpd_logdir}")" if [ ! -d "${d}" ] then mkdir -p "${d}" fi chown "${openerpd_user}" "${d}" } openerpd_stop() { # Try its best to stop the service if [ -f "${openerpd_pidfile}" ] then echo "Stopping ${name}." kill -15 "$(cat "${openerpd_pidfile}")" else # echo "Looking for (openerp-server.py ${openerpd_flags})" openerpd_pid=$(pgrep -f "openerp-server.py ${openerpd_flags}") if [ -n "${openerpd_pid}" ] then echo "Stopping ${name}." kill -15 "${openerpd_pid}" else echo "${name} not running? (pidfile not found)" fi fi } openerpd_status() { # Try its best to find the service's status if [ -f "${openerpd_pidfile}" ] then openerpd_pid="$(cat "${openerpd_pidfile}")" fi if [ -z "${openerpd_pid}" ] then openerpd_pid=$(pgrep -f "openerp-server.py ${openerpd_flags}") [ -n "${openerpd_pid}" ] && echo "${openerpd_pid}" > "${openerpd_pidfile}" fi if [ -n "${openerpd_pid}" ] then echo "${name} running with pid: $openerpd_pid" else echo "${name} not running? (pid not found)" fi } command_args=" >/dev/null 2>&1 &" load_rc_config $name run_rc_command "$1" ----------------------------------------------------------------------------- ============================== = SECTION 2 = = finance/openerp-server = = post-installation = ============================== Helper : getval ------------------------------------------------------------------------------ # getval varname file [default_value] [separator_char] # - Discard comment lines (any text leading with blanks then #) # - Retain only the last value set getval () { local varname local filename local default_value local separator varname="$1" filename="$2" default_value="$3" separator=${4-"="} local value value=$( grep -E "^\s*${varname}\s*${separator}" ${filename} \ | cut -d${separator} -f 2 \ | sed -E 's/^[ ]*//;s/[ ]*$//' \ |tail -n 1 \ ); echo ${value-"${default_value}"} } ------------------------------------------------------------------------------ Find in /etc/passwd uid associated with postgresql (default to pgsql) => <PGSQL> 1. As <PGSQL> user : ------------------------------------------------------------------------------ [root] # su - <PGSQL> [PGSQL] $ openerp_dbuser=$(getval db_user /usr/local/etc/openerp-server.conf) [PGSQL] $ openerp_dbname=$(getval db_name /usr/local/etc/openerp-server.conf) [PGSQL] $ createuser $openerp_dbuser [PGSQL] $ createdb --owner=${openerp_dbuser} --encoding=UTF-8 --locale=en_EN.UTF-8 ${openerp_dbname} "OpenERP initial database" ------------------------------------------------------------------------------ 2. At that stage, confirm that postgresql shows up as : ------------------------------------------------------------------------------ [PGSQL] $ psql -l Liste des bases de données Nom | Propriétaire | Encodage | Collationnement | Type caract. | Droits d'accès ----------------+----------------+----------+-----------------+--------------+----------------- openerp | openerp | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | postgres | pgsql | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | template0 | pgsql | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/pgsql + | | | | | pgsql=CTc/pgsql template1 | pgsql | UTF8 | fr_FR.UTF-8 | fr_FR.UTF-8 | =c/pgsql + | | | | | pgsql=CTc/pgsql (4 lignes) ------------------------------------------------------------------------------ ==> With these patches OpenERP server start as a dream ============================== = SECTION 3 = = Proposed patches regarding = = files associated with = = finance/openerp-web = ============================== /usr/local/etc/openerp-web.conf ----------------------------------------------------------------------------- # Example configuration file for OpenERP-web # # This is an example configuration file, just copy it # to openerp-web.conf and edit it to suit your needs. # Patch submitted by (c) Franck Porcher, Ph.D, to smooth some default values # OpenERP Web server [global] # the ip and port the web server will be listening on server.socket_host = "0.0.0.0" # 0.0.0.0 means all ip addresses server.socket_port = 8080 # Sets the number of threads the server uses server.thread_pool = 10 server.environment = "development" # Simple code profiling server.profile_on = False server.profile_dir = "profile" # Set to True if you are deploying your App behind a proxy # e.g. Apache using mod_proxy #tools.proxy.on = True # If your proxy does not add the X-Forwarded-Host header, set # the following to the *public* host url. #tools.proxy.base = 'http://mydomain.com' # logging log.access_file = "/var/log/openerp/openerp-web-access.log" log.error_file = "/var/log/openerp/openerp-web-error.log" # OpenERP Server information [openerp] host = 'localhost' port = '8070' protocol = 'socket' # Web client settings [openerp-web] # filter dblists based on url pattern? # NONE: No Filter # EXACT: Exact Hostname # UNDERSCORE: Hostname_ # BOTH: Exact Hostname or Hostname_ dblist.filter = 'NONE' # whether to show Databases button on Login screen or not dbbutton.visible = True # will be applied on company logo company.url = '' # options to limit data rows in M2M/O2M lists, will be overriden # with limit="5", min_rows="5" attributes in the tree view definitions child.listgrid.limit = 5 child.listgrid.min_rows = 5 ----------------------------------------------------------------------------- /usr/local/etc/rc.d/openerp-web ----------------------------------------------------------------------------- #!/bin/sh # PROVIDE: openerp-web # REQUIRE: LOGIN DAEMON openerp-server # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable openerp-web # # # openerpweb_enable (bool): Set to "NO" by default, # Set it to "YES" to enable # openerp-web # # openerpweb_config (str): The path to openerp-web configuration # file (defaults to /usr/local/etc/openerp-web.conf) # # openerpweb_flags (str): Extra Arguments to be used when invoking # the openerp-web daemon. # # Patch submitted by (c) Franck Porcher, Ph.D, to fix some issues regarding # pidfile, log files, and discrepencies with the main configuration file. # getval varname file [default_value] [separator_char] # - Discard comment lines (starting with blanks and # # - Retain only the last value set _getval () { local varname local filename local default_value local separator varname="$1" filename="$2" default_value="$3" separator=${4-"="} local value value=$( grep -E "^\s*${varname}\s*${separator}" ${filename} \ | cut -d${separator} -f 2 \ | sed -E 's/^[ ]*//;s/[ ]*$//' \ |tail -n 1 \ ); echo ${value-"${default_value}"} } name="openerpweb" command="/usr/local/bin/openerp-web" . /etc/rc.subr rcvar=openerpweb_enable load_rc_config ${name} command_interpreter="/bin/sh" openerpweb_enable=${openerpweb_enable-"NO"} openerpweb_config=${openerpweb_config:-"/usr/local/etc/openerp-web.conf"} openerpweb_user=${openerpweb_user:-"openerpd"} openerpweb_pidfile=${openerpweb_pidfile:-"/var/run/openerp/openerp-web.pid"} openerpweb_logfile="$(_getval log.access_file "${openerpweb_config}" "/var/log/openerp/openerp-web-access.log")" openerpweb_errlogfile="$(_getval log.error_file "${openerpweb_config}" "/var/log/openerp/openerp-web-error.log")" openerpweb_flags=${openerpweb_flags:-"--config=${openerpweb_config}"} pidfile="${openerpweb_pidfile}" required_files="${openerpweb_config}" start_precmd="${name}_prestart" stop_cmd="${name}_stop" status_cmd="${name}_status" getval_cmd="${name}_getval" openerpweb_prestart() { local d d="$(dirname "${openerpweb_logfile}")" if [ ! -d "${d}" ] then mkdir -p "${d}" fi chown "${openerpweb_user}" "${d}" d="$(dirname "${openerpweb_pidfile}")" if [ ! -d "${d}" ] then mkdir -p "${d}" fi chown "${openerpweb_user}" "${d}" } openerpweb_stop() { # Try its best to stop the service if [ -f "${openerpweb_pidfile}" ] then echo "Stopping ${name}." kill -15 $(cat "${openerpweb_pidfile}") else openerpweb_pid=$(pgrep -f "openerp-web.py ${openerpweb_flags}") if [ "${openerpweb_pid}" ] then echo "Stopping ${name}." kill -15 "${openerpweb_pid}" else echo "${name} not running? (pidfile not found)" fi fi } openerpweb_status() { # Try its best to discover the service's status if [ -f "${openerpweb_pidfile}" ] then openerpweb_pid=$(cat "${openerpweb_pidfile}") fi if [ -z "${openerpweb_pid}" ] then openerpweb_pid=$(pgrep -f "openerp-web.py ${openerpweb_flags}") [ -n "${openerpweb_pid}" ] && echo "${openerpweb_pid}" > "${openerpweb_pidfile}" fi if [ -n "${openerpweb_pid}" ] then echo "${name} running with pid: $openerpweb_pid" else echo "${name} not running? (pid not found)" fi } command_args=" >> ${openerpweb_logfile} 2> ${openerpweb_errlogfile} & " load_rc_config $name run_rc_command "$1" ----------------------------------------------------------------------------- /usr/local/bin/openerp-web ----------------------------------------------------------------------------- #!/bin/sh # # Wrapper to call the OpenERP web client # properly. # # Created by Francisco de Borja Lopez Rio <borja@pexego.es> # Mon Jan 11 18:15:54 CET 2010 # # Patched by (c) Franck Porcher, Ph.D, to fix some issues regarding # misconfiguration export PYTHON_EGG_CACHE="/tmp" cd /usr/local/openerp-web exec /usr/local/bin/python2.7 ./openerp-web.py $@ ----------------------------------------------------------------------------- ============================ == SECTION 4 == ============================ Quick and dirty way to fix the current port based installation in order to have openerp-web successfully start and run. As root: # Deinstall and reinstall CherryPy 3.1.2 cd /usr/ports/www/py-cherrypy make deinstall make # Change Makefile PORTVERSION in Makefile to read 3.1.2 # download CherryPy-3.1.2.tar.gz to /usr/ports/distfiles cat <<EOT >> distinfo SHA256 (CherryPy-3.1.2.tar.gz) = 0dfd65507b047d54c09849e7a4b8bdd3616fa8776a5dbff7697cbf6ea1559bf6 SIZE (CherryPy-3.1.2.tar.gz) = 319196 EOT make install (will fail) cd work/CherryPy-3.1.2 python setup.py -v install # >>> That's all for cherrypy <<< # Now fix openerp-web oprt install # Save (patched) files mv /usr/local/etc/openerp-web.conf \ /usr/local/etc/rc.d/openerp-web \ /usr/local/bin/openerp-web \ /usr/local/openerp-web/openerp-web.py \ /tmp cd /usr/ports/finance/openerp-web make deinstall # edit work/openerp-web-5.0.11/ so it reads : make # ... # install_requires=[ # "CherryPy == 3.1.2", # ... make install (it will fail) cd work/openerp-web-5.0.11 python setup.py -v install # Reinstall files cd /tmp mv openerp-web.conf /usr/local/etc mv openerp-web /usr/local/etc/rc.d mv openerp-web /usr/local/bin/openerp-web mkdir /usr/local/openerp-web mv openerp-web.py /usr/local/openerp-web # That's it! # openerp-server and openerp-web service # should now start as a dream # with pids in /var/run/openerp # and logs in /var/log/openerp. # rc.d/openerp-server status and rc.d/openerp-web status # will also now work. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203310654.q2V6sneM094559>