This question has been flagged
2 Replies
7104 Views

In order to use OAuth I understand one must go to single database mode.

There seem to be only two ways to do it. The third way I was expecting seem to be broken:

  1. As indicated in General Settings -- "The public portal is accessible only if you are in a single database mode. You can launch the OpenERP Server with the option --db-filter=DATABASENAME to do so. "
  2. Specifying the database target in the URL -- http://subdomain.mydomain.com:8069/?db=DATABASENAME
  3. Specifying the database target in openerp-server.conf with dbfilter = DATABASENAME

I've tried dbfilter =, db_filter = and db-filter = in my openerp-server.conf, but none seem to work.

My circumstances:

  • I'm running on Ubuntu 12.04 LTS
  • My server start command is sudo service openerp-server start
  • my script contains :

     # Specify an alternate config file (Default: /etc/openerp-server.conf).
     CONFIGFILE="/etc/openerp-server.conf"
     # Additional options that are passed to the Daemon.
     DAEMON_OPTS="-c $CONFIGFILE"
     #
     case "${1}" in
         start)
            echo -n "Starting ${DESC}: "
            start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
                    --chuid ${USER} --background --make-pidfile \
                    --exec ${DAEMON} -- ${DAEMON_OPTS}
    

I've tried altering the start command to this . . .

        start-stop-daemon --start --db-filter=DATABASENAME --quiet

. . . but that just gets me this . . .

    Starting openerp-server: start-stop-daemon: unrecognized option '--db-filter=DATABASENAME'

Evidently the start-stop-daemon expects something different.

Can anyone tell me the right way to do this?

Where can I find the script for the start-stop-daemon?

Avatar
Discard

Well at least [openerp-server --help | grep filter] prints [--db-filter=REGEXP Filter listed database]. So there should be an option called --db-filter.

Author

Yes. That is the 1st method that I mention. It works as long as you run openerp as an application rather than a service.

Great question, Martin. If you're using the Ubuntu packages and editing the init script (Lorenzo's answer) then package upgrades most likely overwrite your change in DAEMON_OPTS. How Do you deal with that?

Also, did you find a way to do this in the configuration file, please? That would be preferred over editing the init script due to the overwriting issue.

Author

I did not go that far with it. Probably the thing to do is make a patch file from the original vs the altered script and keep it around for your upgrades. I suppose I should have done that and submitted it to the bug police. (So much to do, huh)

Best Answer

Try adding '--db-filter=DATABASENAME' to DAEMON_OPTS instead. As you are doing now you are passing it to start-stop-daemon, NOT openerp-server.

In the init script change the line DAEMON_OPTS="-c $CONFIGFILE" to DAEMON_OPTS="-c $CONFIGFILE --db-filter=DATABASENAME"

Avatar
Discard

Not the right place, sorry.

Author

In other words use this ´DAEMON_OPTS="-c $CONFIGFILE --db-filter=DATABASENAME"´ instead of this ´DAEMON_OPTS="-c $CONFIGFILE"´? That fixed it! Great call, thanks!

Best Answer

I use this script and it works for me (not enough karma to place the link)

 #!/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/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
Avatar
Discard
Author

It seems you are new to this kind of forum. You should read the question more carefully, and you will see that you have not answered it at all. More experienced members will actually take karma points away from responses that do not offer a real answer to the original question.