DigitalSlideArchive / digital_slide_archive

The official deployment of the Digital Slide Archive and HistomicsTK.
https://digitalslidearchive.github.io
Apache License 2.0
108 stars 49 forks source link

Extra mounted volumes seem to be ignored by deploy_docker.py #190

Closed fepegar closed 2 years ago

fepegar commented 2 years ago

Hi, and thanks for this great tool!

I would like to deploy DSA on Microsoft Azure, reading data from Azure blob storage and overlaying annotations.

For now, I'm just trying to deploy locally using deploy.sh. I have found that whatever I pass using --mount can't be found in the container. When I exec into it, I can't find it. I have a folder ~/.histomics_data that is successfully mounted on /data. I was wondering why the volumes mounted by deploy.sh were working, but not the ones I passed myself. I replaced /data with another path (/datum), but I couldn't find a /datum folder in the container. Moreover, /opt/digital_slide_archive/mounts is always empty, which seems inconsistent with the docs for --mount:

https://github.com/DigitalSlideArchive/digital_slide_archive/blob/b9f245401aaf6017338ca8d01c16eec6df306a0f/ansible/deploy_docker.py#L959-L964

What does ro mean in the help message? Am I doing anything wrong?

I hope this all makes sense. I'm don't have much experience with Docker or web applications. Please let me know if you need more information or if I you would like me to contribute with a PR.

fepegar commented 2 years ago

Additionally, and please let me know if I should open a new issue for this, mounted folders and symbolic links in ~/.histomics_data don't seem to work either. Is this expected? I can give you more details about what I tried, if necessary.

manthey commented 2 years ago

The mount command can is used like in standard docker run commands and is of the form: --mount <path on your machine>:<path inside the docker container OR a simple name>:ro, where the path inside the docker container portion and the ro option are both optional. ro makes the mount read-only (so it can't be used to store new data). The path inside the docker container can either be a complete path (e.g., /data or /mnt/sample_data) or a single name which will be used internally as /opt/digital_slide_archive/mounts/<name>, or, if not specified, the name is auto-assigned as mount1, mount2, etc.

If you show the full command you are trying, I can advise what needs to be changed. I imagine you want to do something like --mount /home/user/.histomics_data:/data.

fepegar commented 2 years ago

The mount command can is used like in standard docker run commands and is of the form: --mount ::ro, where the path inside the docker container portion and the ro option are both optional. ro makes the mount read-only (so it can't be used to store new data). The path inside the docker container can either be a complete path (e.g., /data or /mnt/sample_data) or a single name which will be used internally as /opt/digital_slide_archive/mounts/, or, if not specified, the name is auto-assigned as mount1, mount2, etc.

Thanks for the explanation, that's very clear.

If you show the full command you are trying, I can advise what needs to be changed. I imagine you want to do something like --mount /home/user/.histomics_data:/data.

I guess some code is worth a thousand words:

$ mkdir myfolder

$ realpath myfolder
/home/fernando/git/digital_slide_archive/myfolder

$ devops/deploy.sh --mount /home/fernando/git/digital_slide_archive/myfolder:/mymounted start
Starting rabbitmq:management - dsa_rabbitmq
Starting mongo:latest - dsa_mongodb
Starting memcached:latest - dsa_memcached
Starting dsarchive/dsa_worker:latest - dsa_worker
Starting dsarchive/dsa_girder:latest - dsa_girder

$ docker exec -it dsa_girder bash -c "ls /"
bin   data  etc   lib    lib64   media  opt   root  sbin  sys  usr
boot  dev   home  lib32  libx32  mnt    proc  run   srv   tmp  var

As you can see, mymounted is missing from / in the container. In WSL, /data is also missing.

manthey commented 2 years ago

Hmm.. Did you stop and remove the containers before running the start command with the extra mount parameter? Docker doesn't add mounts to running containers.

fepegar commented 2 years ago

Yes, I ran devops/deploy.sh stop before running the lines above.

Tested on Docker 19.03.6, Docker 20.10.11+azure-3 and Docker 20.10.7 (WSL).

manthey commented 2 years ago

stop isn't sufficient -- it stops the running containers, but doesn't remove them. start will then restart the stopped containers without adding new mounts. rm will stop and remove the containers, after which start will recreate them from the docker images with all of the mount options.

fepegar commented 2 years ago

rm before mounting worked. Thanks! I'll open more issues regarding some other questions.

fepegar commented 2 years ago

For completeness, I ran devops/deploy.sh rm before trying again.