InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

502 Bad Gateway after first install and reboot VM

Open toptop34 opened this issue 1 year ago • 7 comments

Deployment Method

  • [X] Installer
  • [ ] Docker Development
  • [ ] Docker Production
  • [ ] Bare metal Development
  • [ ] Bare metal Production
  • [ ] Digital Ocean image
  • [ ] Other (please provide a link Steps to Reproduce

Describe the problem*

Hi. Ubuntu 20.04 Fast install

A quick-and-easy install can be done done with the following one-liner.

wget -qO install.sh https://get.inventree.org && bash install.sh

1 - before you start installation script u need to install curl and gpg... 2 - after all was installed i make reboot and 502 Bad Gateway

How to fixit?

Steps to Reproduce

How to fix this problem?

Relevant log output

No response

toptop34 avatar Jan 28 '24 18:01 toptop34

We will need more information, especially the output from the install, the service status output for inventree-web and inventree-worker and the version output from inventree run invoke version

matmair avatar Jan 30 '24 23:01 matmair

For anyone who may find this in the future, I had this issue on my first setup attempt. Eventually I realized it was because I had nginx installed on the host machine and I was seeing the 502 nginx error page, NOT an error from inventree.

I would suggest verifying you don't have any other webservers running on the host machine.

XanderLuciano avatar Mar 09 '24 08:03 XanderLuciano

@XanderLuciano good tip - if there is a conflicting server already running, that will certainly cause problems.

SchrodingersGat avatar Mar 11 '24 06:03 SchrodingersGat

@toptop34 can you confirm this is the issue you are facing too?

matmair avatar Mar 11 '24 19:03 matmair

Seeing the same problem on a fresh install of Ubuntu 20.04 server install.

systemctl status nginx

 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-04-15 19:39:38 UTC; 1min 27s ago
       Docs: man:nginx(8)
    Process: 633 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 769 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 781 (nginx)
      Tasks: 2 (limit: 2257)
     Memory: 10.4M
     CGroup: /system.slice/nginx.service
             ├─781 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─782 nginx: worker process

Apr 15 19:39:36 inventree-new systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 15 19:39:38 inventree-new systemd[1]: Started A high performance web server and a reverse proxy server.

systemctl status inventree-web

inventree-web.service
     Loaded: loaded (/etc/systemd/system/inventree-web.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-04-15 19:39:36 UTC; 1min 36s ago
   Main PID: 624 (sleep)
      Tasks: 1 (limit: 2257)
     Memory: 212.0K
     CGroup: /system.slice/inventree-web.service
             └─624 /bin/sleep infinity

Apr 15 19:39:36 inventree-new systemd[1]: Started inventree-web.service.

systemctl status inventree-worker

inventree-worker.service
     Loaded: loaded (/etc/systemd/system/inventree-worker.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-04-15 19:39:36 UTC; 1min 51s ago
   Main PID: 628 (sleep)
      Tasks: 1 (limit: 2257)
     Memory: 220.0K
     CGroup: /system.slice/inventree-worker.service
             └─628 /bin/sleep infinity

inventree run invoke version

InvenTree - inventree.org
The Open-Source Inventory Management System


Installation paths:
Base        /opt/inventree
Config      /etc/inventree/config.yaml
Media       /opt/inventree/data/media
Static      /opt/inventree/data/static

Versions:
Python      3.9.5
Django      4.2.11
InvenTree   0.15.0 dev
API         187
Node        N/A
Yarn        N/A

Commit hash:None
Commit date:None

Install goes through without any errors and at the end of the install it says browse to: http://192.168.1.66

Tried browing there (also tried rebooting) and get

502 Bad Gateway nginx/1.18.0 (Ubuntu)

I've checked and nginx was not present prior to the inventree install.

StormTrooper avatar Apr 15 '24 19:04 StormTrooper

@matmair Found the issue which caused my problem. Not sure if it's specific to stable or a bug in the master. (I installed master)

During the install process this file is created:

/opt/inventree/vendor/pkgr/processes/worker

Which has a typo in it:

exec env/bin/python src/backendInvenTree/manage.py qcluster 

Inserting a slash between backend and InvenTree fixes this issue for me.

StormTrooper avatar Apr 15 '24 21:04 StormTrooper

Same problem here today. I'm so lost on this now. How is anyone installing this?

Fresh Ubuntu Server 20.04 install. Nothing else done except run the install script with wget. Python venv problem?

./worker: 2: exec: env/bin/python: not found

Syslog:

Apr 17 03:39:52 inventory inventree-web-1.service[903]: /opt/inventree/vendor/pkgr/processes/web: 2: exec: env/bin/gunicorn: not found
Apr 17 03:39:52 inventory systemd[1]: inventree-web-1.service: Main process exited, code=exited, status=127/n/a
Apr 17 03:39:52 inventory systemd[1]: inventree-web-1.service: Failed with result 'exit-code'.
Apr 17 03:39:52 inventory inventree-worker-1.service[904]: /opt/inventree/vendor/pkgr/processes/worker: 3: exec: env/bin/python: not found
Apr 17 03:39:52 inventory systemd[1]: inventree-worker-1.service: Main process exited, code=exited, status=127/n/a
Apr 17 03:39:52 inventory systemd[1]: inventree-worker-1.service: Failed with result 'exit-code'.

va7wv avatar Apr 17 '24 03:04 va7wv

This issue seems stale. Please react to show this is still important.

github-actions[bot] avatar Jun 16 '24 11:06 github-actions[bot]