Welcome! Log In Create A New Profile

Advanced

Bad Gateway 200

Posted by philo 
Bad Gateway 200
August 06, 2020 12:50PM
I'm getting a Bad Gateway 502 Error when trying to use scispacy.linking.EntityLinker in a Django app running inside a Docker container. The offending line of python code is: linker = EntityLinker(resolve_abbreviations=True, name="umls"). When run outside of Docker it works without errors, however, the call takes several minutes and downloads ~1MB of data.

Here's what displays in my browser:

502 Bad Gateway
nginx/1.19.1

When I run sudo docker logs <my_nginx_container_id> I see the following error:

[error] 28#28: *1 upstream prematurely closed connection while reading response header from upstream

Here's my architecture:

nginx running in a docker container as my web server/reverse proxy server
gunicorn running as my application server, serving up my django app
I've also tried creating a docker network and placing both containers in it.
Here's my nginx.conf file (adding the timeout and size config didn't help):

upstream my_django {
server web:8000 fail_timeout=3000s;
}

server {
listen 80;

location / {
proxy_pass http://my_django/;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_read_timeout 10m;
proxy_connect_timeout 10m;
client_max_body_size 16m;
}
}
Here's my nginx Dockerfile:

FROM nginx:alpine
RUN rm -f /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
Here's my docker-compose.yml:

version: "3"

services:
web:
build:
context: .
args:
HTTP_PROXY: http://amec.zscaler.myco.com:9480
HTTPS_PROXY: http://amec.zscaler.myco.com:9480
image: my_django
container_name: my_django
expose:
- "8000"
nginx:
build: ./nginx
ports:
- "1337:80"
depends_on:
- web
Here's my Dockerfile:

FROM python:3.6
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ARG HTTP_PROXY
ARG HTTPS_PROXY
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
RUN mkdir /code
WORKDIR /code
ADD . /code/
RUN useradd -m user
RUN chmod 777 /home/user
USER user
CMD ["gunicorn", "My_Django.wsgi:application", "--bind", "0.0.0.0:8000"]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready