This question has been flagged
4 Replies
39780 Views

Hello,


I have Odoo9 and am getting this error when I try to click  "conversations" (top right hand corner) to send messages. When I refresh the page, the messagebox appears. When I type, the message will not appear until I refresh the page.


I am using nginx and workers =3, and I have read other similar discussions about how it might be something to do with the nginx ports but I'm unsure of what I have to change to fix this. Other discussions talked about missing libraries but I have installed those. Any help would be greatly appreciated.


Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 643, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 680, in dispatch

result = self._call_function(**self.params)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 316, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 118, in wrapper

return f(dbname, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 309, in checked_call

result = self.endpoint(*a, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 959, in __call__

return self.method(*args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 509, in response_wrap

response = f(*args, **kw)

File "/usr/lib/python2.7/dist-packages/openerp/addons/bus/controllers/main.py", line 34, in poll

raise Exception("bus.Bus unavailable")

Exception: bus.Bus unavailable


This is the relevant part of my nginx:

upstream openerp-im {

server 127.0.0.1:8072 weight=1 fail_timeout=0;

}

Avatar
Discard
Author

# You may add here your # server { # ... # } # statements for each of your virtual hosts to this file ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # http://wiki.nginx.org/Pitfalls # http://wiki.nginx.org/QuickStart # http://wiki.nginx.org/Configuration # # Generally, you will want to move this file somewhere, and start with a clean # file but keep this around for reference. Or just disable in sites-enabled. # # Please see /usr/share/doc/nginx-doc/examples/ for ## Based on: http://www.schenkels.nl/2013/01/reverse-ssl-proxy-using-nginx-with-openerp-v7/ ## OpenERP backend ## upstream openerp { server 127.0.0.1:8069; } upstream openerp-im { server 127.0.0.1:8072 weight=1 fail_timeout=0; } ## https site## server { listen 443 default; server_name mydomain.com; root /usr/share/nginx/html; index index.html index.htm; client_max_body_size 0m; # log files access_log /var/log/nginx/openerp.access.log; error_log /var/log/nginx/openerp.error.log; # ssl files ssl on; ssl_certificate /etc/ssl/nginx/server.crt; ssl_certificate_key /etc/ssl/nginx/server.key; keepalive_timeout 60; # limit ciphers ssl_ciphers HIGH:!ADH:!MD5; ssl_protocols SSLv3 TLSv1; ssl_prefer_server_ciphers on; # proxy buffers proxy_buffers 16 64k; proxy_buffer_size 128k; ## default location ## location / { proxy_pass http://openerp; # force timeouts if the backend dies proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_redirect off; # set headers proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; } # cache some static data in memory for 60mins location ~* /web/static/ { proxy_cache_valid 200 60m; proxy_buffering on; expires 864000; proxy_pass http://openerp; } } ## http redirects to https ## server { listen 80; server_name mydomain.com; # Strict Transport Security add_header Strict-Transport-Security max-age=2592000; rewrite ^/.*$ https://$host$request_uri? permanent; }

see my answer update for the fix

Author

This didnt work for me: I also recieve this message from nginx *7139 connect() failed (111: Connection refused) while connecting to upstream, client:

for that you need to specify workers and longpolling_port in the odoo config file to get it working. normally 3 or more workers should work

Author

I have both longpolling (8072) and workers (4) already set

Best Answer

You need to use the upstream openerp-im just to proxy the /longpolling/ urls and use another upstream to the / url. Put the same proxy headers in both locations in order to get it work. I read somewhere that 4 is the minimum number of workers to get it working but I don't see why in the code. If you still have issues with that just post your nginx config to get it fixed

Update based on your config:

upstream openerp {

server 127.0.0.1:8069;

}

upstream openerp-im {

server 127.0.0.1:8072 weight=1 fail_timeout=0;

}

server {

listen 443 default;

server_name mydomain.com;

root /usr/share/nginx/html;

index index.html index.htm;

client_max_body_size 0m;

# log files

access_log /var/log/nginx/openerp.access.log;

error_log /var/log/nginx/openerp.error.log;

# ssl files

ssl on;

ssl_certificate /etc/ssl/nginx/server.crt;

ssl_certificate_key /etc/ssl/nginx/server.key;

keepalive_timeout 60;

# limit ciphers

ssl_ciphers HIGH:!ADH:!MD5;

ssl_protocols SSLv3 TLSv1;

ssl_prefer_server_ciphers on;

# proxy buffers

proxy_buffers 16 64k;

proxy_buffer_size 128k;

## default location ##

location / {

proxy_pass http://openerp;

# force timeouts if the backend dies

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_redirect off;

# set headers

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

}

location /longpolling/ {

proxy_pass http://openerp-im;

# force timeouts if the backend dies

proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

proxy_redirect off;

# set headers

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto https;

}

# cache some static data in memory for 60mins

location ~* /web/static/ {

proxy_cache_valid 200 60m;

proxy_buffering on;

expires 864000;

proxy_pass http://openerp;

}

}

## http redirects to https ##

server {

listen 80;

server_name mydomain.com;

# Strict Transport Security

add_header Strict-Transport-Security max-age=2592000;

rewrite ^/.*$ https://$host$request_uri? permanent;

}

 See the added config in bold for the longpolling upstream


Avatar
Discard

Works to me. Thanks!

Best Answer

Hi,


For configuring Nginx with Odoo:  Configure Odoo With Nginx As a Reverse Proxy

Nginx configuration file:  https://github.com/odoomates/odoosamples/blob/main/odoo_nginx_conf


Thanks

Avatar
Discard
Best Answer

hi, 

For the APCHE2 you need to redirect the /longpolling as well as / url :


ProxyPass /longpolling http://<yourDomain.com>:8072/longpolling
ProxyPassReverse /longpolling http://<yourDomain.com>:8072/longpolling

ProxyPass / http://<yourDomain.com>:8069/
ProxyPassReverse / http://<yourDomain.com>:8069/

There is a detailed instruction on my github on : https://github.com/odoo-app-dev/odoo-apache2


Avatar
Discard
Author Best Answer

Here is my nginx config


# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for
## Based on: http://www.schenkels.nl/2013/01/reverse-ssl-proxy-using-nginx-with-openerp-v7/
## OpenERP backend ##
upstream openerp {
server 127.0.0.1:8069;
}
upstream openerp-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
## https site##
server {
listen 443 default;
server_name mydomain.com;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 0m;
# log files
access_log /var/log/nginx/openerp.access.log;
error_log /var/log/nginx/openerp.error.log;
# ssl files
ssl on;
ssl_certificate /etc/ssl/nginx/server.crt;
ssl_certificate_key /etc/ssl/nginx/server.key;
keepalive_timeout 60;
# limit ciphers
ssl_ciphers HIGH:!ADH:!MD5;
ssl_protocols SSLv3 TLSv1;
ssl_prefer_server_ciphers on;
# proxy buffers
proxy_buffers 16 64k;
proxy_buffer_size 128k;
## default location ##
location / {
proxy_pass http://openerp;
# force timeouts if the backend dies
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
# cache some static data in memory for 60mins
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://openerp;
}
}
## http redirects to https ##
server {
listen 80;
server_name mydomain.com;
# Strict Transport Security
add_header Strict-Transport-Security max-age=2592000;
rewrite ^/.*$ https://$host$request_uri? permanent;
}
Avatar
Discard

hello,

how about the apache2?