-
Notifications
You must be signed in to change notification settings - Fork 91
Add support for Docker #350
Add support for Docker #350
Conversation
Again referencing #305, and in the spirit of #344, this adds support for deployment through mod_wsgi-express, leveraging upstream code as much as possible. The mod_wsgi author publishes mod_wsgi-docker at https://github.com/GrahamDumpleton/mod_wsgi-docker, which this is built on top of. I would welcome further input or pulls. Images are available on dockerhub:
I will add docs shortly. @hershman, what do you think? I didn't see your PR until I had these mostly done last night. |
f468100
to
10b49c3
Compare
This looks really good @afirth, thanks for putting this together. As you've noticed, it's unfortunate that @hershman has already opened a PR with a working Docker recipe. I think the fairest thing to do is to merge @hershman's changes first, and perhaps you could extend on this afterwards? I like the idea of using the upstream images, this is a good idea. |
Added documentation. Now supports using environment variables to set data_source and debug. Automated builds available at https://registry.hub.docker.com/u/afirth/ga4gh_server_apache/ |
b04b15d
to
5003d38
Compare
Neat automation and integration with documentation - thanks for the nice work. ~p |
|
||
$ VBoxManage controlvm boot2docker-vm natpf1 "ga4gh,tcp,127.0.0.1,8000,,8000" | ||
|
||
For more info on port forwarding see https://www.virtualbox.org/manual/ch06.html#natforward and https://github.com/CenturyLinkLabs/panamax-ui/wiki/How-To%3A-Port-Forwarding-on-VirtualBox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these links should use the sphinx link syntax
@dcolligan I'm not sure what you mean. I didn't think link text added anything here so I left them plain. No markup is required for links without alt-text. Is there a guideline that all links should be hidden? Res: fixed |
@afirth It breaks up the flow of reading to see long gnarly URLs in the midst of a text block. "... see here and here." would be easier for a reader to parse, for instance. |
@dcolligan updated, thanks for the review |
To give a proper review, I think we should have someone that actually knows something about docker review this. But if everyone else is just as inexperienced with it as I am, I suppose I can look at it a bit more closely after we resolve which parts of which of the 2 PRs we want to merge. |
As I said, I've merged #344 into here as there's been no movement on that build, and it was/is failing. I'd like to get this in so I can switch the autobuilds over to upstream instead of my branch |
Oops, looks like it was rebased a few minutes ago. I can rebase on top of it and fix the doc merge conflicts if that's the way others want to go. |
OK, we've merged @hershman's PR, and you should be able to build on that now @afirth. Can you rebase this PR off upstream/develop please? We can review the changes (to the degree that we're able to --- I agree with @dcolligan's point above, I'm also clueless in terms of Docker) then. |
cd1f908
to
06509ed
Compare
rebased and squashed |
@@ -0,0 +1,7 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this file do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a pre-build hook which adds the source of this repository to requirements.txt. Basically as doing pip install -e ./
Previous build instructions pull from github rather than building from source. If the user chooses the automated builds, that will still happen, but this way it is possible to build from source locally for development. I will expand the comments here to indicate the file's purpose. Res: fixed
#TODO this logic could move to frontend.configure() or BaseConfig | ||
# For docker, if/when a default is set in serverconfig.py, run -v /localdata:/default-path | ||
# If the env variable GA4GH_DATA_SOURCE is set, use that path. Otherwise, use the default path | ||
DATA_SOURCE = os.getenv('GA4GH_DATA_SOURCE', "/ga4gh-example-data") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we support configuration from environment variables already --- I don't quite get what we're trying to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only environment variable imported is GA4GH_CONFIGURATION, the path of the config file. I agree we should support this in frontend, but I thought that would be out of scope of adding support for Docker. This allows setting the location of the datasource by passing an env variable to the docker container. os.getenv returns arg2 if arg1 is unset. This logic could be discarded when frontend.py is updated with production oriented argument parsing. Res: won't fix
I've had a look through this @afirth, and it's generally great. I don't quite understand how it all fits together though (which is my fault as a Docker noob), so it would be really helpful if you could write a quick description of how it all works, perhaps in a README in the deploy directory. The documentation looks good, but I wonder if we're mixing the message of the page a little bit with all the details of running demos, fixing DNS problems and so on. This page is intended to be the definitive source of information for production deployments, but there's an awful lot of stuff here for getting things working on your laptop. Perhaps this sort of information would also be better in the Docker README? Anyway, this all excellent, so thanks a lot! |
fcfa615
to
375e8de
Compare
@jeromekelleher Thanks a lot for your comments. I've fixed those that I can and will squash the commits after review. Regarding the README, I worry that this is akin to explaining how apache and mod_wsgi work in this repo. It would duplicate the documentation at https://github.com/GrahamDumpleton/mod_wsgi-docker which is the base of this development (from the mod_wsgi author), and on docs.docker.com. I've added an explicit link to the upstream project to the advanced section of the docs. |
4f9a169
to
757756e
Compare
Thanks very much for the responses @afirth, and for your patience with stupid questions! I like this a lot, I think we should merge and see how it goes as we get more experience. We can streamline things a bit later if needs be. +1 after squashing. |
757756e
to
9857264
Compare
squashed |
@@ -0,0 +1,3 @@ | |||
from ga4gh.frontend import app as application |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I just spotted this now as I was about to merge it. I don't think this file should be in the ga4gh directory, as it's not part of the Python package. Could you move this to deploy (or somewhere else) please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely. I'll leave that question for another day :)
Moved the file and copied it in place with the pre-build hook. Diff here, squashed into this PR
9857264
to
1e627b5
Compare
1) ./Dockerfile, which builds the server with mod_wsgi-express 2) deploy/variants/demo/, which adds the example data to 1) 3) deploy/variants/centos-demo-noapache/, which builds only the python, as the demo in existing docs 4) deploy/variants/ubunto-demo-apache/, by @hershman, which builds apache demo on ubuntu Add maintainer line to @hershman's Dockerfile Support GA4GH_DEBUG and GA4GH_DATA_SOURCE to set values in config.py Update installation.rst for Docker Add link text for URLs Update comments in pre-build hook Fix broken docker installation link Expand documentation for docker run Add link to ports section and fix typo Add link to upstream mod_wsgi-docker project Move application.wsgi to deploy dir and place with pre-build hook
1e627b5
to
b6ded9d
Compare
@jeromekelleher No problem. Squashed on top, dockerhub builds passed. |
Merging. Thanks @afirth! |
existing docs