Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosting MegaQC as one of many applications rather than as the default #428

Open
chrispyatt opened this issue Nov 18, 2022 · 7 comments
Open
Labels

Comments

@chrispyatt
Copy link

I am currently hosting MegaQC via the docker container on a RHEL8 server. I.e. navigating to the server's IP brings up the MegaQC interface.

I would like to change this set-up so that navigating to the server's IP takes me to a homepage from which I can then navigate either to MegaQC or some other application. We're currently using nginx for this elsewhere. What do I need to configure or change (on the MegaQC side of things) in order to host at e.g. IP/megaqc/ rather than just IP/?

@multimeric
Copy link
Collaborator

I remember this being a bit annoying to do. I would try setting the environment variable SCRIPT_NAME=/megaqc in the docker compose config. Hopefully that works:

       - DB_NAME=${DB_NAME}
       - DB_USER=${DB_USER}
       - DB_PASS=${DB_PASS}
+      - SCRIPT_NAME=/megaqc
   db:
     image: postgres:latest
     volumes:

@chrispyatt
Copy link
Author

I've used just the docker image, with a non-docker database, rather than docker compose. If I set that going (i.e. docker run) with SCRIPT_NAME as an environment variable, should that work?

@multimeric
Copy link
Collaborator

@chrispyatt
Copy link
Author

This seems to make it so that e.g. 0.0.0.0/megaqc takes me to a 404 landing page, but doesn't move all the urls behind /megaqc

@chrispyatt
Copy link
Author

I think what I'm looking for is some way of essentially adding a url_prefix to all the existing urls/blueprints, preferably via a config/ env variable so I don't have to rebuild the docker image. Is that possible? I'm hoping that allows nginx to point to the right place.

@multimeric
Copy link
Collaborator

multimeric commented Nov 23, 2022

SCRIPT_NAME should be exactly that. It's used by the WSGI server (gunicorn in this case). It should work exactly as in this example, which I believe is what you're after? https://dlukes.github.io/flask-wsgi-url-prefix.html#mwe.

@chrispyatt
Copy link
Author

Hmm ok this does work on my laptop, but not on the server. There must be something interfering with it. If I curl localhost:180 on my laptop, I get a 500 error as suggested, but if I do the same on the server it just brings up the megaqc homepage. This is with the exact same port/script_name variables.

Could the nginx reverse proxy on the server be messing with this (I'm not very familiar with how they work), or do you think it's likely to be something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants