Skip to Content
Menu
This question has been flagged
1815 Views

Hi everyone!
I've some problems with an Odoo 8 instance and workers configuration.
My VPS has 4 CPU and I've set at 9 the number of workers.


When I try to send invoice email, Odoo return an error 502 
and there are no errors in log file, only worker timeout.


Here's my odoo.cfg


[options]
addons_path = /opt/odoo/buildout/parts/odoo/openerp/addons,/opt/odoo/buildout/parts/odoo/addons
admin_passwd = 
auto_reload = False
csv_internal_sep = ,
data_dir = /opt/odoo/.local/share/Odoo
db_host = localhost
db_maxconn = 64
db_name = False
db_password = 
db_port = False
db_template = template1
db_user = odoo
dbfilter = .*
debug_mode = False
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLiteCity.dat
import_partial = 
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = /var/log/odoo/odoo-server.log
logrotate = True
longpolling_port = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = True
reportgz = False
secure_cert_file = server.cert
secure_pkey_file = server.pkey
server_wide_modules = web,web_kanban
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
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
workers = 9
xmlrpc = True
xmlrpc_interface = 
xmlrpc_port = 8069

and this is my Nginx configuration:

upstream odooweb {
    server 127.0.0.1:8069 weight=1 fail_timeout=3600s;
}

upstream odoo8-im {
        server 127.0.0.1:8072 weight=1 fail_timeout=0;
}

server {
    listen      80 default_server;
    charset     utf-8;
    server_name    domain.com;

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

    # necessary for Let's Encrypt
    location /.well-known {
        alias /var/www/html/.well-known;
    }
    location / {
    	rewrite ^ https://$server_name$request_uri? permanent;
    }
}

server {    
    listen      443 default;
    charset     utf-8;
    access_log    /var/log/nginx/odoo-access.log;
    error_log     /var/log/nginx/odoo-error.log;

    keepalive_timeout    60;

    server_name   domain.com;

    # Specifies the maximum accepted body size of a client request,
    # as indicated by the request header Content-Length.
    client_max_body_size 200m;

    # ssl certificate files
    ssl on;    

    # Uncomment 2 lines above for modern browsers compatibility
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

    ssl_prefer_server_ciphers   on;
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;

    # increase proxy buffer to handle some OpenERP web requests
    proxy_buffers       16 64k;
    proxy_buffer_size   128k;

    # necessary for Let's Encrypt
    location /.well-known {
        alias /var/www/html/.well-known;
    }

    location / {
        proxy_pass    http://odooweb;

        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

        # Set timeouts
        proxy_connect_timeout   3600;
        proxy_send_timeout      3600;
        proxy_read_timeout      3600;
        send_timeout            3600;

        # set headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

        # Let the OpenERP web service know that we're using HTTPS, otherwise
        # it will generate URL using http:// and not https://
        proxy_set_header X-Forwarded-Proto https;

        # by default, do not forward anything
        proxy_redirect off;
    }

    location /longpolling {
       proxy_pass http://odoo8-im;
    }

    # cache some static data in memory for 60mins.
    # under heavy load this should relieve stress on the OpenERP web interface a bit.
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering    on;
        expires 864000;
        proxy_pass http://odooweb;
    }
} 

Thanks a lot for your help
Avatar
Discard