Atlas docker build#2080
Conversation
|
Tagging @leeevans to see if he can take a look at this to see how it might work with Broadsea. |
|
@blootsvoets I'm supportive of adding a Dockerfile in this repo for use in deploying a standalone front end Atlas container. I expect you may also want to create a separate future pull request to add a Dockerfile in the WebAPI repo to deploy the backend as a separate container. Please work with @anthonysena to refresh this pull request with the latest Atlas repo code changes. |
|
@leeevans thank you, I've rebased the code to the latest master to speed up the review process. Could you take another look please? I've made an accompanying PR for WebAPI: OHDSI/WebAPI#1384. |
|
@blootsvoets - these changes look good from my side. Can you note any instructions here for deployment in docker using these assets? Maybe this is straightforward for experienced Docker users but I'd like to make sure that we note it for the user guide on the wiki. |
|
Sure, can I suggest the following content of a wiki page: |
|
If needed, this wiki text could also be added to the OHDSI/WebAPI repo. |
|
@blootsvoets thanks for making the requested changes. It would be helpful if you could add a docker-compose.yml file that just runs Atlas in it's own separate Docker container. I think we can then approve this pull request. |
|
No problem, I've added a functional docker-compose in the |
|
@blootsvoets thanks for all of the quick updates to this PR. From my side this looks good but I'll look for @leeevans to give the approval here. I do need to think further about the PR you've contributed to WebAPI. I have yet to dig into the details you provided but hope to get some time for that soon. |
|
Hi @blootsvoets I believe your intention with this PR was to build and launch an ATLAS frontend only docker container? Therefore the docker-compose file to add here would just show how that ATLAS UI only docker container would be launched. FYI. There is already an existing OHDSI Docker based solution for launching Atlas/WebAPI which covers Windows/Mac/Linux OS and postgres/sqlserver/oracle DBMS: https://github.com/OHDSI/Broadsea. If you are interested in working on rearchitecting that solution I'd be happy to schedule a call to discuss your ideas along with @anthonysena |
|
It’s just that I don’t see a lot of value in a docker-compose file for only the frontend: The browser will block requests due to CORS on some queries by default. By using a reverse proxy (traefik) it avoids all potential CORS issues. If the example only contains atlas, it may be more straightforward to just show the In the end, it would be nice if the docker image was uploaded using automatic build on docker hub. That way a repository like Broadsea can just reference existing docker images. I’ll be on leave the coming period, but @MaximMoinat could discuss it in more detail? |
|
In any case, it looks like the wiki pages for setting up Atlas and WebAPI have some duplication, would it be helpful to have a single page explaining installation instructions for both? |
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
There was a problem hiding this comment.
ATLAS requires the WebAPI url to end with a '/', so we could add a small check here:
| # make sure the WebAPI URL ends with a slash | |
| if [[ "$WEBAPI_URL" != */ ]]; then | |
| WEBAPI_URL="$WEBAPI_URL/" | |
| fi |
This might need to be slightly modified to work with plain /bin/sh.
There was a problem hiding this comment.
Good catch. I've added a POSIX-shell case statement instead.
|
I've updated the branch so it can cleanly merged (as well as the WebAPI counterpart OHDSI/WebAPI#1384). @leeevans could you please reconsider this PR? |
|
This is still a great idea in general @blootsvoets. I would suggest some changes before this PR it is accepted, however:
|
Introduces a Dockerfile and all necessery files to run a production deployment of the Atlas frontend. This makes frontend developments easier to test in a live setting. It also facilitates hosting and keeping track of custom builds.
|
@t-abdul-basser thank you for the detailed descriptions. I've removed the docker-compose files. On how to use it: docker build -t ohdsi/atlas:<tag> .
docker run \
-e WEBAPI_URL=<my external webapi URL> \
-e ATLAS_HOSTNAME=<my external hostname> \
-p "8080:80" \
ohdsi/atlas:<tag>It can then be accessed at http://localhost:8080/atlas/. To avoid CORS blocking requests to Atlas, run this behind a reverse proxy that hosts both Atlas and WebAPI behind the same hostname:port. I can update the wiki with this description if this PR gets merged. I hope this addresses points 2-4. To address point 1, I can make a PR with Broadsea to add a docker-compose file. |
|
Really looking forward to this. Something that might be addressed (or I could add a PR for this at a later point):
|
|
Using the unprivileged image is a good idea, I can change that. Indeed, when automated builds are set up, it would be good to add multiple OCI labels. |
Implemented in e009f03. I needed to change the startup and configuration scripts a bit to avoid permission issues. I've also expanded gzip functionality so the webserver can statically serve Gzip-compressed files instead of needing to compress them during runtime. |
|
This is a very high-quality dockerization. I look forward to seeing it merged. One great aspect is that it is purely additive -- so users who are not using docker will essentially be unaffected by this PR. The users who ARE using docker will get a container image that closely follows or exceeds established best practices and widely-respected guidelines. To help evaluate this PR, I'll list the recommendations and how this container compares: Use of Docker's official best practicesEvaluating this Dockerfile against the officially-published Dockerfile best practices: ✅
|
|
@glvnst Thank you! I'll definitely bookmark your best practices ;)
I just noticed that the nginx image already includes a way to use envsubst (see https://github.com/nginxinc/docker-nginx/blob/master/mainline/alpine/20-envsubst-on-templates.sh), so 30-atlas-env-subst.sh might actually be unnecessary. But I agree this shouldn't block the PR. |
- Removed inconsequential environment variables - Use envsubst instead of sed
- Added labels - Made long find command multi-line
|
@blootsvoets - nice speaking with you, @leeevans and Maxim earlier. I just wanted to note that I'm fully supportive of merging this in once @leeevans provides review/approval. Thanks! |
leeevans
left a comment
There was a problem hiding this comment.
Thanks @blootsvoets - looks good to me
Introduces a Dockerfile and all necessery files to run a production deployment of the Atlas frontend. This makes frontend developments easier to test in a live production setting. It also facilitates hosting and keeping track of custom builds. For us, having a separate Dockerfile for the Atlas and WebAPI makes it easier to collaborate between developers of different parts of the OHDSI stack.
This PR does not yet include necessary documentation to run the project. Where would be best to put such documentation, in the README or on the wiki?