Skip to Content
Menu
This question has been flagged
9 Replies
22853 Views

Hello everyone,

I'm trying to deploy Odoo 16 on my server but I cannot make the chat works, the new messages are not displayed until I restart the web page.

I enabled multi workers mode and proxy_mode in my odoo.conf, and here is my nginx.conf (the same as Odoo documentation):

#odoo server
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# http -> https
server {
listen 80;
server_name odoo.gp;
rewrite ^(.*) https://$host$1 permanent;
}

server {
listen 443 ssl;
server_name odoo.gp;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

# SSL parameters
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

# log
access_log /var/log/nginx/access_odoo.gp.log;
error_log /var/log/nginx/error_odoo.gp.log;

# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}

# Redirect requests to odoo backend server
location / {
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_pass http://odoo;
}

# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Please help! Thanks!

Avatar
Discard
Author

Is there anyone? :(

Author Best Answer

After many times digging, I found out where my problem is and fixed it. The problem is Google Chrome (and other chromium-based browsers) rejects the websocket connection due to my self-signed SSL certificate. On Firefox, it works fine. So I have to create my own CA certificate and add it to the trusted list of Google Chrome (as the instruction here https://dgu2000.medium.com/working-with-self-signed-certificates-in-chrome-walkthrough-edition-a238486e6858).

Hope it helps someone who facing the same problem when trying to deploy on local machine.

Avatar
Discard
Best Answer

In Odoo18, I Got The Below Error From Terminal while Refreshing The Page. Also I Cant See Any Error From UI. (Like PopUp.)

RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?




After Commanded Some Line Conf, It Working Correctly.

#workers = 4

#limit_memory_soft = 471974428

#limit_memory_hard = 3299788800

#limit_request = 1200

#limit_time_cpu = 1200

#limit_time_real = 2400

#max_cron_threads = 1


Thanks,
Abdul Kather S

Avatar
Discard
Best Answer

Here the error was also occurring because of the settings:


limit_memory_hard = 20132659200

limit_memory_soft = 1677721600

limit_request = 8192

limit_time_cpu = 3600

limt_time_real = 7200

limit_time_real_cron = -1

max_cron_threads = 1

workers = 25


Remove all of these settings from your conf file. 
It will work !

Avatar
Discard
Best Answer

I am also having the same issue I am on odoo17 and cant get it to work please help!

Avatar
Discard
Best Answer

Same issue in Discuss, Inbound

With nginx no answer, even with refresh the browser (firefox or chrome) and in odoo log : POST /longpolling/poll HTTP/1.1" 404.

Without nginx, direct with http://localhost:8069, no answer and in odoo log : RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

nginx conf :

    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072 weight=1 fail_timeout=0;
}

server {
listen 80;
listen [::]:80;
        server_name localodoo.erp;
       
        # log
access_log /var/log/nginx16/accesslocalodoo.log;
error_log /var/log/nginx16/errorlocalodoo.log;

# Set headers for proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;

        # Set timeouts
        proxy_connect_timeout   3600;
        proxy_send_timeout      3600;
        proxy_read_timeout      3600;
       
        # Gzip
        send_timeout            3600;
        client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 500M;
sendfile on;

    location /websocket {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://odoochat;
proxy_redirect off;
}

           
    location / {
proxy_redirect off;
proxy_pass http://odoo;
add_header Access-Control-Allow-Origin *;
}

    # common gzip
    gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
    gzip on;
       
}>
In odoo conf :
xmlrpc_port = 8069
#xmlrpc_interface = 127.0.0.1
gevent_port = 8072
limit_memory_hard = 1677721600
limit_memory_soft = 629145600
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 4>

Please help
Avatar
Discard
Best Answer

Greetings, 


I have this same error only with odoo version 16, I would like to know some solution if someone could solve it.


Thank you.

Avatar
Discard
Best Answer

@Bojan Nišević adding in odoo-server.conf file.

xmlrpc_interface = 127.0.0.1

 solved my issue!

Avatar
Discard
Best Answer

I have the same issue, tried everything, /websocket configuration in nginx, proxy mode is True. Nothing helps. I am getting 

Websocket(request.httprequest.environ['socket'], request.session),

KeyError: 'socket'

Avatar
Discard
Best Answer

Hello

Need to change in nginx.conf and odoo.conf as follow

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

Also add worker and max_cron_threads as per server configuration in /etc/odoo-server.conf

max_cron_threads = 1
workers = 4
db_name=DatabaseName
dbfilter=
proxy_mode=True

Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat

Avatar
Discard
Author

I don't see any difference in your suggestion. Anyway, I copied your config and still no luck :(

Hello Giang Pham,

Thank you for your feedback.

have you updated odoo.conf file as per my answer?

if you have still issue then i want to check your odoo log file and other configuration.

feel free to connect with me

CandidRoot Solutions Pvt. Ltd.
Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat

Author

Yes, here is my odoo.conf:

[options]
addons_path = /opt/odoo/16.0/addons
admin_passwd = xxx
csv_internal_sep = ,
data_dir = /home/admin/.local/share/OpenERP
dbfilter =
db_host = 127.0.0.1
db_maxconn = 64
db_name = odoo16-demo
db_password = odoo
db_port = 5433
db_sslmode = prefer
db_template = template0
db_user = odoo
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
gevent_port = 8072
http_enable = True
http_interface =
http_port = 8069
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
list_db = False
log_db = False
log_db_level = warning
logfile = /home/admin/odoolog/odoo.log
log_handler = :INFO
log_level = info
max_cron_threads = 2
osv_memory_count_limit = False
pg_path =
pidfile =
proxy_mode = True
reportgz = False
screencasts =
screenshots = /tmp/odoo_tests
server_wide_modules = base,web
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_enable = False
test_file =
test_tags = None
transient_age_limit = 1.0
translate_modules = ['all']
unaccent = True
upgrade_path =
without_demo = False
workers = 3

I don't know if this is a problem or not, but my nginx hosts multiple config files for multiple odoo instances, in both v15 and v16. The v15 instance work fine, only the v16 has this problem.

Have the Same issue for multiple version of Odoo on the same server. Did you find any solution ?

Related Posts Replies Views Activity
1
Feb 23
2452
0
Oct 22
3578
1
May 25
1112
1
Apr 25
2434
1
Apr 25
3120