You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
I am trying to migrate a web application from using the tiangolo/uwsgi-nginx-flask image to this one, based on Meinheld, Gunicorn and Flask.
My application runs behind a reverse proxy implemented with Traefik, and is mounted on a subpath. For example, on "/demo".
I have a cookiecutter template that easily implements most of this setup, except for the Traefik bits, which I add on deployment using docker-compose and a docker-compose.yml file like this:
version: '3'
services:
# The reverse proxy service (Træfik)
reverse-proxy:
image: traefik # The official Traefik docker image
command: --api --docker # Enables the web UI and tells Træfik to listen to docker
restart: always
ports:
- "80:80" # The HTTP port
- "8080:8080" # The Web UI (enabled by --api)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
myapp:
build:
context: ./myapp/
dockerfile: Dockerfile.nginx-uwsgi # just change to Dockerfile.meinheld-gunicorn to use this image as base
labels:
- "traefik.frontend.rule=PathPrefix:/demo"
- "traefik.frontend.priority=1"
depends_on:
- reverse-proxy
When using nginx and uwgsi, I need to add a couple of lines to the uwsgi.ini config file, following hints from Flask uwsgi docs:
[uwsgi]
; Uncomment following lines if not mounting the application on root "/" (see http://flask.pocoo.org/docs/1.0/deploying/uwsgi/)
manage-script-name <--- ADDED FOR MOUNTING ON SUBPATH /demo
mount = /demo=myapp:app <--- ADDED FOR MOUNTING ON SUBPATH /demo
module = myapp
callable = app
uid = uwsgi
gid = uwsgi
How can I achieve the same thing when using this Meinheld + Gunicorn image?
Gunicorn docs briefly mentions that SCRIPT_NAME can be set in the environment for Gunicorn to pick up. meinheld-gunicorn-flask image does not provide SCRIPT_NAME as an environment variable to set (I tried it anyway), so the next thing I tried is adding this setting in the gunicorn_conf.py file. Following this issue comment for format, I added the following to gunicorn_conf.py (tried with and without the slash):
Hello.
I am trying to migrate a web application from using the tiangolo/uwsgi-nginx-flask image to this one, based on Meinheld, Gunicorn and Flask.
My application runs behind a reverse proxy implemented with Traefik, and is mounted on a subpath. For example, on "/demo".
I have a cookiecutter template that easily implements most of this setup, except for the Traefik bits, which I add on deployment using docker-compose and a
docker-compose.yml
file like this:When using nginx and uwgsi, I need to add a couple of lines to the uwsgi.ini config file, following hints from Flask uwsgi docs:
How can I achieve the same thing when using this Meinheld + Gunicorn image?
Gunicorn docs briefly mentions that SCRIPT_NAME can be set in the environment for Gunicorn to pick up. meinheld-gunicorn-flask image does not provide SCRIPT_NAME as an environment variable to set (I tried it anyway), so the next thing I tried is adding this setting in the gunicorn_conf.py file. Following this issue comment for format, I added the following to
gunicorn_conf.py
(tried with and without the slash):Not working.
Can you help me with this one? Is this a problem with the image or am I just trying to implement this subpath feature the wrong way here?
The text was updated successfully, but these errors were encountered: