meinheld-gunicorn-flask-docker icon indicating copy to clipboard operation
meinheld-gunicorn-flask-docker copied to clipboard

Container not accepting requests

Open Givo29 opened this issue 3 years ago • 0 comments

I'm trying to dockerise my react-flask application and for some reason the flask container is not accepting requests.

Dockerfile:

FROM tiangolo/meinheld-gunicorn-flask:python3.7

# RUN mkdir -p /app
COPY ./server /app
RUN pip install -r /app/requirements.txt
RUN pip install greenlet==0.4.17

Docker Compose:

  backend:
    restart: always
    container_name: backend
    build:
      context: ./backend
      dockerfile: Dockerfile.deploy
    environment:
      PORT: "5000"
      LOG_LEVEL: "debug"
    expose:
      - 5000

Request Error: [HPM] Error occurred while proxying request localhost:3000/authenticate to https://0.0.0.0:5000/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)

Container log dump:

[2021-05-31 09:51:09 +0000] [1] [DEBUG] Current configuration:
  config: /app/gunicorn_conf.py
  bind: ['0.0.0.0:5000']
  backlog: 2048
  workers: 12
  worker_class: egg:meinheld#gunicorn_worker
  threads: 1
  worker_connections: 1000
  max_requests: 0
  max_requests_jitter: 0
  timeout: 30
  graceful_timeout: 30
  keepalive: 120
  limit_request_line: 4094
  limit_request_fields: 100
  limit_request_field_size: 8190
  reload: False
  reload_engine: auto
  reload_extra_files: []
  spew: False
  check_config: False
  preload_app: False
  sendfile: None
  reuse_port: False
  chdir: /app
  daemon: False
  raw_env: []
  pidfile: None
  worker_tmp_dir: None
  user: 0
  group: 0
  umask: 0
  initgroups: False
  tmp_upload_dir: None
  secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
  forwarded_allow_ips: ['127.0.0.1']
  accesslog: None
  disable_redirect_access_to_syslog: False
  access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
  errorlog: -
  loglevel: debug
  capture_output: False
  logger_class: gunicorn.glogging.Logger
  logconfig: None
  logconfig_dict: {}
  syslog_addr: udp://localhost:514
  syslog: False
  syslog_prefix: None
  syslog_facility: user
  enable_stdio_inheritance: False
  statsd_host: None
  dogstatsd_tags:
  statsd_prefix:
  proc_name: None
  default_proc_name: main:app
  pythonpath: None
  paste: None
  on_starting: <function OnStarting.on_starting at 0x7febca2a87a0>
  on_reload: <function OnReload.on_reload at 0x7febca2a88c0>
  when_ready: <function WhenReady.when_ready at 0x7febca2a89e0>
  pre_fork: <function Prefork.pre_fork at 0x7febca2a8b00>
  post_fork: <function Postfork.post_fork at 0x7febca2a8c20>
  post_worker_init: <function PostWorkerInit.post_worker_init at 0x7febca2a8d40>
  worker_int: <function WorkerInt.worker_int at 0x7febca2a8e60>
  worker_abort: <function WorkerAbort.worker_abort at 0x7febca2a8f80>
  pre_exec: <function PreExec.pre_exec at 0x7febca2c50e0>
  pre_request: <function PreRequest.pre_request at 0x7febca2c5200>
  post_request: <function PostRequest.post_request at 0x7febca2c5290>
  child_exit: <function ChildExit.child_exit at 0x7febca2c53b0>
  worker_exit: <function WorkerExit.worker_exit at 0x7febca2c54d0>
  nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7febca2c55f0>
  on_exit: <function OnExit.on_exit at 0x7febca2c5710>
  proxy_protocol: False
  proxy_allow_ips: ['127.0.0.1']
  keyfile: None
  certfile: None
  ssl_version: 2
  cert_reqs: 0
  ca_certs: None
  suppress_ragged_eofs: True
  do_handshake_on_connect: False
  ciphers: None
  raw_paste_global_conf: []
  strip_header_spaces: False
[2021-05-31 09:51:09 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2021-05-31 09:51:09 +0000] [1] [DEBUG] Arbiter booted
[2021-05-31 09:51:09 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2021-05-31 09:51:09 +0000] [1] [INFO] Using worker: egg:meinheld#gunicorn_worker
[2021-05-31 09:51:09 +0000] [10] [INFO] Booting worker with pid: 10
[2021-05-31 09:51:09 +0000] [11] [INFO] Booting worker with pid: 11
[2021-05-31 09:51:09 +0000] [12] [INFO] Booting worker with pid: 12
[2021-05-31 09:51:09 +0000] [13] [INFO] Booting worker with pid: 13
[2021-05-31 09:51:09 +0000] [14] [INFO] Booting worker with pid: 14
[2021-05-31 09:51:09 +0000] [15] [INFO] Booting worker with pid: 15
[2021-05-31 09:51:09 +0000] [16] [INFO] Booting worker with pid: 16
[2021-05-31 09:51:10 +0000] [17] [INFO] Booting worker with pid: 17
[2021-05-31 09:51:10 +0000] [18] [INFO] Booting worker with pid: 18
[2021-05-31 09:51:10 +0000] [19] [INFO] Booting worker with pid: 19
[2021-05-31 09:51:10 +0000] [20] [INFO] Booting worker with pid: 20
[2021-05-31 09:51:10 +0000] [21] [INFO] Booting worker with pid: 21
[2021-05-31 09:51:10 +0000] [1] [DEBUG] 12 workers

I'm not sure if this is a bug or something I'm doing wrong, please help

Givo29 avatar May 31 '21 09:05 Givo29