Code Monkey home page Code Monkey logo

Comments (4)

jgontrum avatar jgontrum commented on June 11, 2024 1

I'm not experienced with Google Cloud, but the Docker container internally uses port 80 and AFAIK the host should not interfere with the internals of the container. When you start the container e.g. with docker run -p "127.0.0.1:8080:80" jgontrum/spacyapi:en_v2, you map the local port 8080 to the container port 80. So if 8080 doesn't work for you, can't you try -p "127.0.0.1:32543:80"?

from spacy-api-docker.

ValentinFunk avatar ValentinFunk commented on June 11, 2024

Unfortunately the requirements Cloud Run has is for the container is to listen to whatever port is specified in the PORT env variable. Unfortunately I cannot specify which port they use - they say that they use "8080" but this shouldn't be relied on, the app should support the PORT env variable at best.

I realize this is a bit of a limitation from the Cloud Run side as you usually have something to route to the container (using -p for docker bridge network, some reverse proxy, kubernetes service, ...) and it seems this is a bit unique to Cloud Run.

Would be cool if this could be changed here to support the use case, since otherwise it would require forking and it seems like it wouldn't break anything for current users to support it. Since you already have support for the PORT env variable it would only require changing the internal ports of the frontend and service which are not exposed right now.

To summarize, this is basically a feature request to support using PORT=8080 with the container :)
docker run -e PORT=8080 -p "8080" jgontrum/spacyapi:en_v2

BTW thank you very much for packaging this all up in an easy to use container! It's a fantastic time saver 😊

from spacy-api-docker.

koehlkm avatar koehlkm commented on June 11, 2024

I'm having a similar issue when trying to use Cloud Run. Has anyone had any success with deploying this on GCP or have any recommendations?

from spacy-api-docker.

premuifyify avatar premuifyify commented on June 11, 2024

@kamshak I am facing the same issue here deploying on Cloud Run.

Basically Cloud Run prefers listening on the port 8080 and as the container is using nginx i have replaced the default.conf file to make nginx expose port 8080 as given on the link - https://stackoverflow.com/questions/47364019/how-to-change-the-port-of-nginx-when-using-with-docker#:~:text=If%20you%20want%20to%20change,conf%20file%20inside%20the%20container.&text=navigating%20to%20localhost%3A3333%20in,to%20include%20the%20default%20nginx.

** Dockerfile **

FROM jgontrum/spacyapi:base_v2
RUN pip install wheel
ENV languages "en_core_web_lg"
RUN cd /app && env/bin/download_models
COPY default.conf /etc/nginx/conf.d/
COPY nginx.conf /etc/nginx/
EXPOSE 8080

The problem is that it gives a 502 error on hitting any api. Here are the logs:

/usr/lib/python2.7/dist-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2020-06-25 22:20:43,107 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, youcan set user=root in the config file to avoid this message.
2020-06-25 22:20:43,107 INFO Included extra file "/etc/supervisor/conf.d/supervisor.conf" during parsing
2020-06-25 22:20:43,132 INFO RPC interface 'supervisor' initialized
2020-06-25 22:20:43,132 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-06-25 22:20:43,133 INFO supervisord started with pid 7
2020-06-25 22:20:44,136 INFO spawned: 'nginx' with pid 10
2020-06-25 22:20:44,142 INFO spawned: 'api' with pid 11
2020-06-25 22:20:44,145 INFO spawned: 'frontend' with pid 12
2020-06-25 22:20:45,333 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-06-25 22:20:45,334 INFO success: api entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-06-25 22:20:45,334 INFO success: frontend entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-06-25 22:20:49,475 INFO exited: frontend (exit status 2; expected)
2020-06-25 22:21:34,723 INFO exited: api (exit status 2; expected)

I can't figure out what is the problem here. Any help is appreciated.

from spacy-api-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.