Yenthe666 / InstallScript

Odoo install script
MIT License
1.21k stars 1.54k forks source link

Longpolling 502 (Bad Gateway) Error #90

Closed AyaYousef closed 6 years ago

AyaYousef commented 6 years ago

Hello there, I'm facing an issue with Odoo version 11. I'm getting Longpolling error in my Inspector. image Here's the error log from Nginx:

2018/01/13 09:33:31 [error] 20300#20300: *476 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server: , request: "POST /longpolling/poll HTTP/1.1", upstream: "http://127.0.0.1:8072/longpolling/poll", host: "XX.XX.XX.XX", referrer: "http://XX.XX.XX.XX/web"

2018/01/13 09:33:42 [error] 20300#20300: *476 connect() failed (111: Connection refused) while connecting to upstream, client: XX.XX.XX.XX, server: , request: "POST /longpolling/poll HTTP/1.1", upstream: "http://127.0.0.1:8072/longpolling/poll", host: "XX.XX.XX.XX", referrer: "http://XX.XX.XX.XX/web"

I'm using Nginx as a reverse proxy, and here's my config:

upstream backend-odoo {

        server 127.0.0.1:8069;

}

upstream backend-odoo-im {

        server 127.0.0.1:8072;

}

server {

        listen 80;

        #server_name yourdomainname.com;

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

        location / {

                proxy_pass http://backend-odoo;

                proxy_read_timeout 300000;

              # proxy header and settings

                proxy_set_header Host $host;

                proxy_set_header X-Real-IP $remote_addr;

                proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_redirect off;

                # odoo log files

                access_log /var/log/nginx/odoo-access.log;

                error_log /var/log/nginx/odoo-error.log;

                # increase proxy buffer size

                proxy_buffers 16 64k;

                proxy_buffer_size 128k;

                # force timeouts if the backend dies

                proxy_next_upstream error timeout invalid_header http_500

                http_502 http_503;

                # enable data compression

                gzip on;

                gzip_min_length 1100;

                gzip_buffers 4 32k;

                gzip_types text/plain application/x-javascript text/xml text/css;

                gzip_vary on;

                client_max_body_size 500M;

        }

        location ~* /web/static/ {

                # cache static data

                proxy_cache_valid 200 60m;

                proxy_buffering on;

                expires 864000;

                proxy_pass http://backend-odoo;

        }

        location /longpolling {

                proxy_pass http://backend-odoo-im;

        }

}

Since I'm running Odoo on a remote server with 1CPU, I changed the number of workers to be 3 and enabled proxy mode.

Here's my Odoo config, I changed only two parameters:

proxy_mode = True

workers = 3

and here's my telnet output

$ telnet 127.0.0.1 8072
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

This configuration was working before in Odoo 10, but now I'm not quite sure wat's wrong! PS. I installed Odoo from this script sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh

chris001 commented 6 years ago

@AyaYousef I've added support for this livechat feature and nginx proxy to my fork of this install script ( PR #74 ). The telnet test works fine, result is Connected to localhost. You can run this forked installer with these commands, over your current install:

cd ~
rm odoo_install.sh
wget https://github.com/chris001/InstallScript/raw/patch-2/odoo_install.sh
chmod +x odoo_install.sh
./odoo_install.sh --nginx --email=you@youremail.com --domain=yourwebdomain.com

Try it, and post back your results here.

salmemik commented 6 years ago

I can confirm this. I had earlier exactly same Longpolling 502 (Bad Gateway) Error but not anymore after I used that patch-2 script.

Yenthe666 commented 6 years ago

Thanks a lot for the new fix @chris001!

AyaYousef commented 6 years ago

@chris001 Thanks a lot for the support, but I have only one concern since I'm going to run this script on a production server. Any expected impact that could happen after running this script?, and do I need to update the database afterward?

One more thing I noticed in the script you're using port 443 for SSL. However, I'm not using the same here, I'm using Nginx to change the default port from 8069 to 80. So I'm guessing in my case I'm not going to use nginx parameter while running the script. If you can just tell me what kind of configuration that I need to change here, it will be great.

chris001 commented 6 years ago

@AyaYousef

I'm going to run this script on a production server. Any expected impact that could happen after running this script?, and do I need to update the database afterward?

One more thing I noticed in the script you're using port 443 for SSL. However, I'm not using the same here, I'm using Nginx to change the default port from 8069 to 80. So I'm guessing in my case I'm not going to use nginx parameter while running the script. If you can just tell me what kind of configuration that I need to change here, it will be great.

AyaYousef commented 6 years ago

@chris001

What version of odoo is already running on that production server? 11? 10? 9? Is it community or enterprise. Do you realize that odoo can't just upgrade from one version to the next. To do this, you (or odoo specialist) must perform a "database migration," which is somewhat manual process, as the db structure has changed between major odoo versions (9, 10, 11).

Sorry, I forgot to mention that, I'm using Odoo V11 Community edition. I'm not planning to upgrade anything here, I was asking about the installed apps on the db, do I need to update them by using ./odoo-bin -u command?

You're using unencrypted http port 80, do you realize you risk the organization losing all its private information and bank account funds due to eavesdropping / packet sniffing, of the clear text data on the server's internet connection, by dishonest people, hackers, etc. To eliminate this risk as much as possible, SSL/TLS was invented, and I urge you to use the nginx config as installed by the script, so that all visitors to http port 80 will be automatically redirected to the secure https and have a safe secure encrypted connection. This SSL cert is free, thanks to letsencrypt and the supporters of the EFF. Please use it.

I understand the risk but only on online transactions i.e eCommerce online payment. Do I really need SSL for odoo backend i.e Sales, Purchases, Accounting apps?

chris001 commented 6 years ago

I'm using Odoo V11 Community edition. I'm not planning to upgrade anything here, I was asking about the installed apps on the db, do I need to update them by using ./odoo-bin -u command?

This installer downloads the newest version of odoo 11, and this comes with the newest version of the addons. If you were running a slightly older version of an addon, but it's still major version 11, then yes you probably must run this update command to make sure the database is updated to match the version of the newest addons which were downloaded by the installer.

I understand the risk but only on online transactions i.e eCommerce online payment. Do I really need SSL for odoo backend i.e Sales, Purchases, Accounting apps?

It's strongly recommended to run SSL and https all the time, to protect against identity theft, which is a precursor to financial theft.

AyaYousef commented 6 years ago

Ok I noticed one more thing in the new script, it's the default parameters that you're using are different than Yenthe's in Yenthe script:

OE_HOME="/$OE_USER"
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"

In Chris script:

OE_HOME="/home/${OE_USER}"
OE_HOME_EXT="${OE_HOME}/${OE_USER}-server"
OE_ENTERPRISE_ADDONS="${OE_HOME}/enterprise/addons"
OE_CUSTOM_ADDONS="${OE_HOME}/custom/addons"

and now I'm going to run the new script to override the old one, and I'm afraid that it might cause any kind of confliction. Is it safe to use Yenthe's default parameters for OE_HOME & OE_HOME_EXT

chris001 commented 6 years ago

now I'm going to run the new script to override the old one, and I'm afraid that it might cause any kind of confliction. Is it safe to use Yenthe's default parameters for OE_HOME & OE_HOME_EXT

  • You should be just be fine to use the new parameters, because the script is developed smart, to take into account exactly this type of situation, running it on an already existing odoo, the script creates a new set of odoo config files which refer to the new parameters and directories.
cliffkujala commented 6 years ago

Hello @chris001 Tried using your patch-2 to get my live chat working, but I'm still encountering problems to get 8072 opened up. `● odoo-server.service - odoo-server (Odoo 11.0 Enterprise) Loaded: loaded (/etc/systemd/system/odoo-server.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2018-06-03 17:27:30 UTC; 10min ago Main PID: 16154 (python3) Tasks: 11 Memory: 1.0G CPU: 12min 16.632s CGroup: /system.slice/odoo-server.service ├─16154 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16159 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16160 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16161 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16162 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16163 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16164 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16165 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16166 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf ├─16168 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin -c /etc/odoo/odoo-server.conf └─19442 /usr/bin/python3 /home/odoo/odoo-server/odoo-bin gevent -c /etc/odoo/odoo-server.conf

Jun 03 17:37:41 purekarting.com odoo-server[16154]: main(args) Jun 03 17:37:41 purekarting.com odoo-server[16154]: File "/home/odoo/odoo-server/odoo/cli/server.py", line 169, in main Jun 03 17:37:41 purekarting.com odoo-server[16154]: rc = odoo.service.server.start(preload=preload, stop=stop) Jun 03 17:37:41 purekarting.com odoo-server[16154]: File "/home/odoo/odoo-server/odoo/service/server.py", line 989, in start Jun 03 17:37:41 purekarting.com odoo-server[16154]: rc = server.run(preload, stop) Jun 03 17:37:41 purekarting.com odoo-server[16154]: File "/home/odoo/odoo-server/odoo/service/server.py", line 388, in run Jun 03 17:37:41 purekarting.com odoo-server[16154]: self.start() Jun 03 17:37:41 purekarting.com odoo-server[16154]: File "/home/odoo/odoo-server/odoo/service/server.py", line 363, in start Jun 03 17:37:41 purekarting.com odoo-server[16154]: from gevent.wsgi import WSGIServer Jun 03 17:37:41 purekarting.com odoo-server[16154]: ImportError: No module named 'gevent.wsgi'`

The above is the error I receive when checking status of the server.

eversatis commented 4 years ago

I runinto the same issue on odoo 13

chris001 commented 4 years ago

It's been some time since I developed my fork of this script. I believe you need to install gevent, which is a native library and needs to be compiled on your server, and in order to compile, you first must install five or ten dev or devel packages so that the compiler can link to them and successfully build gevent. Instructions are here: https://www.odoo.com/documentation/13.0/setup/install.html