Skip to content

504 Gateway Time-out after installing docker production on Debian 11.6 #4112

Closed

Description

@deltronix

Deployment Method

  • 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*

I have followed the installation steps for the docker compose production of Inventree on a Debian 11 server. However I'm not able to access it remotely or locally (through w3m) I get "504 Gateway Time-out".

Steps to Reproduce

  1. Install on Debian 11 using docker compose via these instructions https://docs.inventree.org/en/latest/start/docker_prod/
  2. Execute w3m http://localhost:1337
  3. Error 504

Relevant log output

inventree-proxy  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
inventree-proxy  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
inventree-proxy  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
inventree-proxy  | 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
inventree-proxy  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
inventree-server  | Loading config file : /home/inventree/data/config.yaml
inventree-server  | InvenTree translation coverage: 22%
inventree-worker  | Loading config file : /home/inventree/data/config.yaml
inventree-worker  | InvenTree translation coverage: 22%
inventree-proxy   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
inventree-proxy   | /docker-entrypoint.sh: Configuration complete; ready for start up
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: using the "epoll" event method
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: nginx/1.22.1
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: OS: Linux 5.10.0-20-amd64
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker processes
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 21
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 22
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 23
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 24
inventree-db      |
inventree-db      | PostgreSQL Database directory appears to contain a database; Skipping initialization
inventree-db      |
inventree-db      | 2022-12-27 16:17:36.497 UTC [1] LOG:  starting PostgreSQL 13.9 (Debian 13.9-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
inventree-db      | 2022-12-27 16:17:36.499 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
inventree-db      | 2022-12-27 16:17:36.499 UTC [1] LOG:  listening on IPv6 address "::", port 5432
inventree-db      | 2022-12-27 16:17:36.595 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
inventree-db      | 2022-12-27 16:17:36.695 UTC [27] LOG:  database system was shut down at 2022-12-27 16:17:14 UTC
inventree-db      | 2022-12-27 16:17:36.747 UTC [1] LOG:  database system is ready to accept connections
inventree-proxy   | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
inventree-proxy   | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
inventree-proxy   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
inventree-proxy   | 10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
inventree-proxy   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
inventree-proxy   | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
inventree-proxy   | /docker-entrypoint.sh: Configuration complete; ready for start up
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: using the "epoll" event method
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: nginx/1.22.1
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: OS: Linux 5.10.0-20-amd64
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker processes
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 21
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 22
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 23
inventree-proxy   | 2022/12/27 16:17:40 [notice] 1#1: start worker process 24
inventree-proxy   | 2022/12/27 16:19:49 [error] 23#23: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.22.0.1, server: , request: "GET / HTTP/1.0", upstream: "http://172.22.0.3:8000/", host: "localhost:1337"
inventree-proxy   | 172.22.0.1 - - [27/Dec/2022:16:19:49 +0000] "GET / HTTP/1.0" 504 167 "-" "w3m/0.5.3+git20210102" "-"
inventree-server  | Loading config file : /home/inventree/data/config.yaml
inventree-server  | InvenTree translation coverage: 22%
inventree-server  | [2022-12-27 16:18:12 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:15)
inventree-server  | [2022-12-27 16:18:12 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:16)
inventree-server  | [2022-12-27 16:18:12 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:17)
inventree-server  | [2022-12-27 16:18:12 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:18)
inventree-server  | [2022-12-27 16:18:13 +0000] [14] [WARNING] Worker with pid 17 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:13 +0000] [14] [WARNING] Worker with pid 18 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:13 +0000] [14] [WARNING] Worker with pid 16 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:13 +0000] [14] [WARNING] Worker with pid 15 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:43 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:119)
inventree-server  | [2022-12-27 16:18:43 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:120)
inventree-server  | [2022-12-27 16:18:43 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:121)
inventree-server  | [2022-12-27 16:18:43 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:122)
inventree-server  | [2022-12-27 16:18:44 +0000] [14] [WARNING] Worker with pid 119 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:44 +0000] [14] [WARNING] Worker with pid 120 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:44 +0000] [14] [WARNING] Worker with pid 121 was terminated due to signal 9
inventree-server  | [2022-12-27 16:18:44 +0000] [14] [WARNING] Worker with pid 122 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:14 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:225)
inventree-server  | [2022-12-27 16:19:14 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:226)
inventree-server  | [2022-12-27 16:19:14 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:227)
inventree-server  | [2022-12-27 16:19:14 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:228)
inventree-server  | [2022-12-27 16:19:15 +0000] [14] [WARNING] Worker with pid 225 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:15 +0000] [14] [WARNING] Worker with pid 226 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:15 +0000] [14] [WARNING] Worker with pid 227 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:15 +0000] [14] [WARNING] Worker with pid 228 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:46 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:330)
inventree-server  | [2022-12-27 16:19:46 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:331)
inventree-server  | [2022-12-27 16:19:46 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:332)
inventree-server  | [2022-12-27 16:19:46 +0000] [14] [CRITICAL] WORKER TIMEOUT (pid:333)
inventree-server  | [2022-12-27 16:19:47 +0000] [14] [WARNING] Worker with pid 331 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:47 +0000] [14] [WARNING] Worker with pid 333 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:47 +0000] [14] [WARNING] Worker with pid 332 was terminated due to signal 9
inventree-server  | [2022-12-27 16:19:47 +0000] [14] [WARNING] Worker with pid 330 was terminated due to signal 9

Activity

  1. added
    question
    setup
    triage:not-checked
    on Dec 27, 2022
  2. bloemp commented on Dec 27, 2022

    @bloemp
    Contributor

    Hi deltronix,

    I'm far from an expert, but here are a few pointers you can try... first off.. other people have encountered the signal 9 problem and it was because of resource problems, please have a look at #4086.
    Unless you changed something, the default docker production image wil expose port 1337 to port 80 on your localhost.
    But before any of those port show something you should look at fixing the signal 9 problem...

  3. SchrodingersGat commented on Dec 28, 2022

    @SchrodingersGat
    Member

    Have a look at this link - if the docker container does not have sufficient resources? https://docs.docker.com/config/containers/resource_constraints/

  4. deltronix commented on Dec 28, 2022

    @deltronix
    Author

    Well the container has no resource limit at the moment. Which is evident from the fact that in htop the gunicorn process is basically using 100% of all 4 available threads, seemingly doing nothing (RAM utilizations is around 1GB). It's running on an OVH dedicated server with the following specs:
    CPU: Intel ATOM N2800 - 2c/4t - 1.86 GHz
    RAM: 4 GB 1066 MHz
    Which I assumed would be enough to run an inventree for 1 or 2 users. Maybe it's not? However from the thread linked by @bloemp it seems that 1vCore and 1GB of RAM was sufficient for them...

  5. bloemp commented on Dec 28, 2022

    @bloemp
    Contributor

    Well the person in the linked thread had succes moving to 2 vCPU's. @matmair was asking how many worker threads where running, he had success running on a single vCPU. Personally I'm running InvenTree as a docker container on a Synology NAS with a Intel Celeron J3355 Dual core 2 - 2.5GHz with 8GB of memory. Not sure how that compares to your Atom N2800. But if my NAS is busy doing data scrubbing or something, InvenTree won't start. So your mileage may vary...

    You could try to edit the config.yaml file and change the key
    background:
    workers: 4 (decrease it see if makes any difference)

  6. SchrodingersGat commented on Dec 31, 2022

    @SchrodingersGat
    Member

    You could also try increasing the timeout values for the workers?

  7. deltronix commented on Dec 31, 2022

    @deltronix
    Author

    Thanks for the suggestions, I downgraded to 0.8.4 to see what would happen and that resolved the issue for now. When I find the time I will try changing the worker amount and timeouts on 0.9.0!

  8. deltronix commented on Jan 4, 2023

    @deltronix
    Author

    EDIT:
    I have added the following lines to the .env file and now inventree 0.9.2 succesfully starts!
    INVENTREE_GUNICORN_WORKERS=2
    INVENTREE_BACKGROUND_WORKERS=2

  9. removed
    question
    triage:not-checked
    on May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    setup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions