gunicorn

Flask Docker container SocketIO Issues

纵饮孤独 提交于 2021-02-18 12:18:06
问题 I have a Flask application that uses SocketIO to fetch data from Postgres live. The app works fine when I run this locally. The problem arouses when I use docker-compose to host my Flask app. My JS client and flask server is hosted into a single app and on the same container. My socketio in JS is like this: var socket = io().connect(window.location.protocol + '//' + document.domain + ':' + location.port); Dockerfile: # Using python 3.7 in Alpine FROM python:3.6.5-stretch # Set the working

GAE don't see gunicorn, but it is already installed

拈花ヽ惹草 提交于 2021-02-18 10:23:09
问题 I am trying to deploy Django app with Google App Engine. My app.yaml file: # [START runtime] runtime: python api_version: 1 threadsafe: true env: flex entrypoint: gunicorn -b :$PORT wsgi runtime_config: python_version: 3.4 env_variables: CLOUDSQL_CONNECTION_NAME: ugram-mysql CLOUDSQL_USER: root handlers: - url: / script: wsgi.application # [END runtime] But when I run gcloud app deploy , app deploy is running (5 minutes), but I get an error: Updating service [default]...failed. ERROR: (gcloud

How to prevent Gunicorn from returning a 'Server' http header?

泪湿孤枕 提交于 2021-02-17 18:53:45
问题 I would like to mask the version or remove the header altogether. 回答1: To change the 'Server:' http header, in your conf.py file: import gunicorn gunicorn.SERVER_SOFTWARE = 'Microsoft-IIS/6.0' And use an invocation along the lines of gunicorn -c conf.py wsgi:app To remove the header altogether, you can monkey-patch gunicorn by replacing its http response class with a subclass that filters out the header. This might be harmless, but is probably not recommended. Put the following in conf.py:

gunicorn or flask printing to console causes internal server error

℡╲_俬逩灬. 提交于 2021-02-17 05:12:36
问题 I have a flask app which I am hosting using the wsgi gunicorn. A while back I found out that having print statements in my code caused my program to throw a 500 internal server error (when I didn't have an SSH connection with the server). I assume this is because since I wasn't connected to the server there was no where to print. However, I now am encountering a bug with a similar nature. I have an python script that will send requests to my web server. When I have an SSH connection with the

Gunicorn is not respecting timeout when using UvicornWorker

橙三吉。 提交于 2021-02-11 17:45:46
问题 I am setting up a timeout check so I made and endpoint: @app.get("/tc", status_code=200) def timeout_check(): time.sleep(500) return "NOT OK" I am using the docker image tiangolo/uvicorn-gunicorn-fastapi:python3.7 and my command to run the server: CMD ["gunicorn","--log-level","debug","--keep-alive","15", "--reload", "-b", "0.0.0.0:8080", "--timeout", "15", "--worker-class=uvicorn.workers.UvicornH11Worker", "--workers=10", "myapp.main:app"] I am expecting the endpoint to fail after 15 seconds

Gunicorn --preload option is causing workers to hang?

白昼怎懂夜的黑 提交于 2021-02-09 08:26:23
问题 We have a flask app that uses a lot of memory for ML models, and I'm trying to reduce the memory footprint by using gunicorn's preload option, but when I add the --preload flag, and deploy that (with -w 4 , to a docker container running on GKE), it will handle just a few requests, and then hang until it times out, at which point gunicorn will start another worker to replace it and the same thing will happen. It's not clear yet how many requests each worker will process before hanging

Gunicorn --preload option is causing workers to hang?

北城以北 提交于 2021-02-09 08:25:54
问题 We have a flask app that uses a lot of memory for ML models, and I'm trying to reduce the memory footprint by using gunicorn's preload option, but when I add the --preload flag, and deploy that (with -w 4 , to a docker container running on GKE), it will handle just a few requests, and then hang until it times out, at which point gunicorn will start another worker to replace it and the same thing will happen. It's not clear yet how many requests each worker will process before hanging

Gunicorn --preload option is causing workers to hang?

北城余情 提交于 2021-02-09 08:23:27
问题 We have a flask app that uses a lot of memory for ML models, and I'm trying to reduce the memory footprint by using gunicorn's preload option, but when I add the --preload flag, and deploy that (with -w 4 , to a docker container running on GKE), it will handle just a few requests, and then hang until it times out, at which point gunicorn will start another worker to replace it and the same thing will happen. It's not clear yet how many requests each worker will process before hanging

Gunicorn --preload option is causing workers to hang?

拜拜、爱过 提交于 2021-02-09 08:20:05
问题 We have a flask app that uses a lot of memory for ML models, and I'm trying to reduce the memory footprint by using gunicorn's preload option, but when I add the --preload flag, and deploy that (with -w 4 , to a docker container running on GKE), it will handle just a few requests, and then hang until it times out, at which point gunicorn will start another worker to replace it and the same thing will happen. It's not clear yet how many requests each worker will process before hanging

gunicorn log-config access_log_format

老子叫甜甜 提交于 2021-02-08 14:00:07
问题 I want gunicorn to log JSON in my docker container. I want to use --access-logformat in the config file. Trying to add format or access_log_format or access_logformat does not configure the logger. How do I configure the access_log_format to output JSON? http://docs.gunicorn.org/en/stable/settings.html#access-log-format gunicorn_logging.conf [loggers] keys=root, gunicorn.error, gunicorn.access [handlers] keys=console [formatters] keys=json [logger_root] level=INFO handlers=console access_log