Odoo Help

Welcome!

This community 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.

2

Correct setup for 'single database mode' in Linux server?

By
Martin
on 4/9/13, 9:00 PM 3,006 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?

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

Lorenzo Cabrini
on 4/9/13, 9:07 PM

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

Martin
on 4/9/13, 9:12 PM

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?

Shahar Or
on 5/9/13, 11:58 AM

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.

Shahar Or
on 5/9/13, 11:59 AM

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)

Martin
on 5/9/13, 12:12 PM
Shahar Or
on 5/9/13, 12:13 PM
3
Lorenzo Cabrini
On 4/9/13, 9:15 PM

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"

Not the right place, sorry.

Go4OpenERP, Jan Pompe
on 4/9/13, 9:55 PM

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!

Martin
on 4/9/13, 9:57 PM
0
Jan Pompe
On 4/9/13, 10:02 PM

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

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.

Martin
on 4/10/13, 12:19 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 4/9/13, 9:00 PM
Seen: 3006 times
Last updated: 3/16/15, 8:10 AM