We like to setup Odoo 9, 10 and 11 on the same server. Odoo 9 and 10 are running only on Python 2 while Odoo 11 is running only on Python 3. How can both Versions been setup using virualenv on an Ubuntu 17.10 server where Python 3.6 is the default Python version.
Can anybody of that community point us to a tutorial or can let us know a step by step guide? We searched already on Google but weren't able to find a solution. We like to test out Odoo 11CE while still being able to run Odoo 9 CE and 10 CE on the same server as they still provide much more modules and themes for customers.
We read here http://joebergantine.com/articles/installing-python-2-and-python-3-alongside-each-ot/ that it is possible to get both on one server running but we struggle to get that done with Odoo 9, 10 and 11.
We installed a virtualenv for Python 2 and one for Python 3
We call Odoo 9 and Odoo 10 accordingly in etc/intit.d on Ubuntu 17.10 i.e. with
etc/init.d/odoo9-server
#!/bin/sh
### BEGIN INIT INFO
# Provides: odoo9-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 Business Applications
# Description: ODOO Business Applications
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
VIRTENV=/home/odoo9/odoo-9.0
NAME=odoo9-server
DESC=ODOO9-SERVER
# Specify the daemon path for Odoo server.
DAEMON=/home/odoo9/o-src/server/openerp-server
# Specify the Odoo Configuration file path.
CONFIGFILE="/etc/odoo/odoo9-server.conf
# Specify the user name (Default: odoo).
USER=odoo9
# 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 --startas /bin/bash -- -c "${VIRTENV} ${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 --startas /bin/bash -- -c "${VIRTENV} ${DAEMON} ${DAEMON_OPTS}"
echo "${NAME}."
;; *)
N=/etc/init.d/$NAME echo "Usage: $NAME {start|stop|restart|force-reload}" >&2 exit 1
;;
esac
exit 0
Odoo11 we call with:
etc/init.d/odoo11-server
#!/bin/sh
### BEGIN INIT INFO
# Provides: odoo11-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-Name: Odoo start/stop script for Ubuntu
# Description: Using this script, we can start/stop/restart
# or check status of odoo server.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
VIRTENV=/home/odoo11/odoo-11.0
NAME=odoo11
DESC=ODOO11-SERVER
# Specify the daemon path for Odoo server.
DAEMON=/home/odoo11/o-src/server/odoo-bin
# Specify the Odoo Configuration file path.
CONFIGFILE="/etc/odoo/odoo11-server.conf"
# Specify the user name (Default: odoo).
USER=odoo11
# pidfile PIDFILE=/var/run/$NAME.pid # pidfile
# Additional options that are passed to the Daemon.
DAEMON_ARGS="-c $CONFIGFILE"
display() {
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NORMAL=$(tput sgr0)
col=$(tput cols)
case "$#" in
1)
if [ $1 -eq 0 ] ; then
printf '%s%*s%s' "$GREEN" $col "[ OK ] " "$NORMAL"
else
printf '%s%*s%s' "$RED" $col "[FAIL] " "$NORMAL"
fi
;;
2)
if [ $1 -eq 0 ] ; then
echo "$GREEN* $2$NORMAL"
else
echo "$RED* $2$NORMAL"
fi
;;
*)
echo "Invalid arguments"
exit 1
;;
esac
}
if ! [ -x $DAEMON ] ; then
echo "Error in ODOO Daemon file: $DAEMON"
echo "Possible error(s):"
display 1 "Daemon File doesn't exists."
display 1 "Daemon File is not set to executable."
exit 0;
fi if ! [ -r $CONFIGFILE ] ; then
echo "Error in ODOO Config file: $CONFIGFILE"
echo "Possible error(s):"
display 1 "Config File doesn't exists."
display 1 "Config File is not set to readable."
exit 0;
fi if ! [ -w $PIDFILE ] ; then
touch $PIDFILE || echo "Permission issue: $PIDFILE" && exit 1
chown $USER: $PIDFILE fi
# Function that starts the daemon/service do_start() {
echo $1
check_status
procs=$?
if [ $procs -eq 0 ] ; then
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
--chuid ${USER} --background --make-pidfile \
--exec ${DAEMON} -- ${DAEMON_ARGS}
return $?
else
detailed_info "${DESC} is already Running !!!" $procs
exit 1
fi
}
# Function that stops the daemon/service do_stop() {
echo $1
check_status
if [ $? -ne 0 ] ; then
start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
return $?
else
display 0 "${DESC} is already Stopped. You may try: $0 force-restart"
exit 1
fi
}
get_pids(){
pids=$(ps -Ao pid,cmd | grep $DAEMON | grep -v grep | awk '{print $1}')
return $pids
}
# Function that checks the status of daemon/service check_status() {
echo $1
# start-stop-daemon --status --pidfile ${PIDFILE}
status=$(ps -Ao pid,cmd | grep $DAEMON | grep -v grep | awk '{print $1}' | wc -l)
return $status
}
# Function that forcely-stops all running daemon/service force_stop() {
echo $1
pids=$(ps -Ao pid,cmd | grep $DAEMON | grep -v grep | awk '{print $1}')
if [ ! -z "$pids" ] ; then
kill -9 $pids
fi
return $?
}
detailed_info() {
procs=$2
if [ $procs -eq 1 ] ; then
display 0 "$1"
echo "FINE, ${procs} ${DESC} is Running."
echo "Details :"
pid=`cat $PIDFILE`
echo "Start Time : $(ps -p $pid -wo lstart=)"
echo "Total UpTime: $(ps -p $pid -wo etime=)"
echo "Process ID : ${pid}"
echo ""
else
display 1 "WARNING !!!"
display 1 "${procs} ${DESC}s are Running !!!"
pids=$(ps -Ao pid,cmd | grep $DAEMON | grep -v grep | awk '{print $1}')
echo "Details :"
echo -n "Process IDs : "
echo $pids
# echo $pids | tr ' ' ,
echo "In order to fix, Hit command: $0 force-restart"
echo ""
fi
}
case "$1" in
start)
do_start "Starting ${DESC} "
display $?
;;
stop)
do_stop "Stopping ${DESC} "
display $?
;;
status)
check_status "Current Status of ${DESC}:"
procs=$?
if [ $procs -eq 1 ] ; then
detailed_info "RUNNING" $procs
elif [ $procs -eq 0 ] ; then
display 1 "STOPPED"
else
detailed_info "" $procs
fi
;;
restart|reload)
do_stop "Stopping ${DESC} "
display $?
sleep 1
do_start "Starting ${DESC} "
display $?
;;
force-restart)
force_stop "Forcely Restarting ${DESC} "
sleep 1
do_start "Starting ${DESC} "
display $?
;;
force-stop)
force_stop "Forcely Stopping all running ${DESC} "
display $?
;;
cs)
ps -Ao pid,cmd | grep $DAEMON | grep -v grep | awk '{print $1}' | wc -l
;;
*)
display 1 "Usage: $0 {start|stop|restart/reload|status|force-restart|force-stop}"
exit 1
;;
esac
exit 0
The configuration files for both versions are more or less the same besides their specific paths for i.e. Odoo 9 (odoo9 - 9700) and Odoo 10 (odoo10 - 9800) and Odoo 11 (odoo11 - 9900) accordingly (each on its own ports)
[options]
# Addons Path addons_path=/home/odoo9/o-src/server/addons
# This is the password that allows database operations:
admin_passwd = OURPASSWORD
auto_reload = False
csv_internal_sep = ,
# Data Directory data_dir=/home/odoo9/o-data/.local/share/Odoo
#dbfilter = .* ;will show database selector if there are more than one database i.e. #dbfilter=odoo9.tld
#dbfilter = ^%d$ ;select database automatically by first subdomain (www is ignored). E.g. http://my.portal.example.com and http://www.my.portal.example.com will show database "my"
dbfilter = ^%h$ ;select database automatically by domain. E.g. http://portal.example.com will show "portal.example.com" database
# Database configuration
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_template = template1
db_user = odoo9
debug_mode = False demo = {}
email_from = False
#import_partial = /opt/odoo/.local/share/User/import/odoo.import.temp ;needed for long-running data imports import_partial = /home/odoo9/o-data/.local/share/User/import/odoo.import.temp
# Workers and timeouts workers = 3 limit_memory_hard = 25000000000 limit_memory_soft = 24000000000 limit_request = 8192 limit_time_cpu = 10800 limit_time_real = 14400 list_db = True
# uncomment below to activate debug logs - deactivate and set to warning later log_db_level = warning log_handler = ['["[\':DEBUG\']"]']
log_level = debug
# should be set in run command (i.e. via --logfile)
logfile = /var/log/odoo/odoo9-server.log
logrotate = True
# Ports and more login_message = False longpolling_port = 9701 max_cron_threads = 3 netrpc = False netrpc_interface =
netrpc_port = 9703
osv_memory_age_limit = 12.0
osv_memory_count_limit = False
pg_path = None
pidfile = False
# Is it behind a HTTP reverse proxy?
proxy_mode = False
reportgz = False
#secure_cert_file = /etc/nginx/XXXX.crt
#secure_pkey_file = /etc/nginx/XXXX.key
server_wide_modules = None
smtp_password = GiveMeYourPassBaby ;False
smtp_port = 465 ;25
smtp_server = stmp.example.com ;localhost
smtp_ssl = True ;False
smtp_user = mail@example.com ;False
static_http_document_root = None
static_http_enable = False
static_http_url_prefix = None
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
timezone = False translate_modules = ['all']
unaccent = False without_demo = False
xmlrpc = True xmlrpc_interface =
xmlrpc_port = 9700
xmlrpcs = True xmlrpcs_interface =
xmlrpcs_port = 9702
All ODOO versions use each an Apache Proxy
<VirtualHost *:80>
SuexecUserGroup "#1002" "#1002"
ServerAdmin webmaster@odoo9.tld
ServerName odoo9.tld
ServerAlias www.odoo9.tld
DocumentRoot /home/odoo9/domains/odoo9.tld/public_html
ErrorLog /var/log/virtualmin/odoo9.tld_error_log
LogLevel warn
CustomLog /var/log/virtualmin/odoo9.tld_access_log combined
ScriptAlias /cgi-bin/ /home/odoo9/domains/odoo9.tld/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5 index.php7
<Directory /home/odoo9/domains/odoo9.tld/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
order allow,deny
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted AddType application/x-httpd-php .php AddHandler fcgid-script .php7 AddHandler fcgid-script .php AddHandler fcgid-script .php7.0 FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php7 FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php7.0
</Directory>
<Directory /home/odoo9/domains/odoo9.tld/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^odoo9.tld
RewriteRule ^/(.*)$ http://odoo9.tld/$1 [R=301,NE,L]
# Redirect 301 to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,NE,L]
</IfModule>
RemoveHandler .php7 RemoveHandler .php RemoveHandler .php7.0 FcgidMaxRequestLen 1073741824
<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>
IPCCommTimeout 241
</VirtualHost>
<VirtualHost 123.123.123.123:443>
SuexecUserGroup "#1002" "#1002"
ServerAdmin webmaster@odoo9.tld
ServerName odoo9.tld
ServerAlias www.odoo9.tld
DocumentRoot /home/odoo9/domains/odoo9.tld/public_html
ErrorLog /var/log/virtualmin/odoo9.tld_error_log
LogLevel warn
CustomLog /var/log/virtualmin/odoo9.tld_access_log combined
ScriptAlias /cgi-bin/ /home/odoo9/domains/odoo9.tld/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5 index.php7
<Directory /home/odoo9/domains/odoo9.tld/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted AddType application/x-httpd-php .php AddHandler fcgid-script .php7 AddHandler fcgid-script .php AddHandler fcgid-script .php7.0 FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php7 FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php FCGIWrapper /home/odoo9/domains/odoo9.tld/fcgi-bin/php7.0.fcgi .php7.0
</Directory>
<Directory /home/odoo9/domains/odoo9.tld/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM SSLCertificateFile /home/odoo9/domains/odoo9.tld/etc/ssl/odoo9_tld.crt SSLCertificateKeyFile /home/odoo9/domains/odoo9.tld/ssl.key
RequestHeader set X-Forwarded-Proto "https"
<IfModule mod_rewrite.c>
RewriteEngine On
# Permanent redirect (301 HTTP) if no canonical domain name
RewriteCond %{HTTP_HOST} !^odoo9.tld
RewriteRule ^/(.*)$ https://odoo9.tld/$1 [R=301,NE,L]
#RewriteRule ^/(.*)$ http://odoo9.tld/$1 [R=301,NE,L]
</IfModule>
RemoveHandler .php7 RemoveHandler .php RemoveHandler .php7.0 FcgidMaxRequestLen 1073741824
<Location "/" >
Order deny,allow
Deny from all
Allow from all
</Location>
<Location "/web/database" >
Order deny,allow
Deny from all
Allow from 123.123.123.123 192.168.1.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>
<Location "/website/info" >
Order deny,allow
Deny from all
Allow from 123.123.123.123 192.168.1.0/24 127.0.0.0/255.0.0.0 ::1/128
</Location>
SSLCACertificateFile /home/odoo9/domains/odoo9.tld/ssl.ca
# Comment to disable proxy
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /.well-known !
ProxyPass /longpolling/ http://localhost:9701/longpolling/ retry=0
ProxyPassReverse /longpolling/ http://localhost:9701/longpolling/ retry=0
ProxyPass / http://localhost:9700/ retry=0
ProxyPassReverse / http://localhost:9700/ retry=0 IPCCommTimeout 241
</VirtualHost>
The Odoo 10 and 11 Proxies are accordingly with their paths, domains, and ports.
When we start the Odoo servers they don't start - Postgres 9.6 is running.
# /etc/init.d/odoo9-server start
Starting odoo9-server: odoo9-server
The var/log/odoo/odoo9.log file is empty and accordingly both other log files for ODOO 10 and 11.
We would appreciate learning more about what might be wrong in our setups and how to get Odoo 11 and Odoo 9, 10 running on the same server in virtual environments.
Kind regards OTech