Difference between revisions of "ViSUS Docker Deployment"
(→Quick start) |
(→Example of using precompiled mod_visus) |
||
Line 81: | Line 81: | ||
<pre>wget "http://localhost:8080/mod_visus?action=readdataset&dataset=2kbit1"</pre> | <pre>wget "http://localhost:8080/mod_visus?action=readdataset&dataset=2kbit1"</pre> | ||
+ | |||
+ | == Use ViSUS convert from docker == | ||
+ | |||
+ | The ViSUS tools executables (see [[ViSUS Convert]]) are contained in the image under <code>/usr/local/visus/bin</code>. | ||
+ | |||
+ | For example, if you want to use the tools to convert a raw dataset using your docker deployment you can do it as follow. | ||
+ | |||
+ | Mount a folder that contains your ''raw'' data and your converted ''idx'' data as follow: | ||
+ | docker run -d -p 8080:80 -v /full/path/to/your/raw/:/home/visus/datasets/raw -v /full/path/to/your/idx/:/home/visus/datasets/idx visus/visus | ||
+ | |||
+ | Check that your container is running correctly (using <code>docker ps</code>) and take note of the ''Container ID''. | ||
+ | |||
+ | Now run a bash session on this container using: | ||
+ | docker exec -it <id_from_docker_ps> /bin/bash | ||
+ | |||
+ | From this bash session you can use your ViSUS converter to convert your data (just mounted in the container) as described in [[ViSUS Convert]]. | ||
+ | |||
== Example of creating a test david_subsampled server == | == Example of creating a test david_subsampled server == | ||
Revision as of 16:52, 11 September 2017
Contents
Quick start
Start your Docker and login into your account. If you don't have installed follow these instructions: Docker Documentation
To log in from your terminal:
docker login Username: your_username Password: XXXX
Now pull the ViSUS image:
docker pull visus/visus
This image contains:
- the ViSUS Server
- configuration files (see ViSUS configuration file)
- a simple 2D web viewer
- some tools to convert data (see [[ViSUS Convert]).
Run the image:
docker run -it --rm -p 8080:80 visus/visus
Check if the server is running:
curl -v "http://localhost:8080/mod_visus?action=list"
You will get a list of the current datasets on the server.
Content of the image
This image contains folders that contains configuration and utilities. Those folder are under /home/visus:
- config, it contains the visus server.config (see ViSUS configuration file)
- apache2, it contains the apache2 config files that you can use for security settings (see ViSUS Server)
- visus, it contains visus tool (see ViSUS Convert) to convert data to IDX format
The user can map those folders locally and edit them adding:
-v local_directory:docker_directory
when you run you docker image. Your run command to mount all the folders to local directories will become as following:
docker run -d -p 8080:80 -v $PWD/config:/home/visus/config -v $PWD/apache2:/home/visus/apache2 -v $PWD/viewer:/home/visus/viewer visus/visus
Web Viewer
You can preview and navigate you data on the server using the webviewer using your browser at the URL: http://localhost:8080
Here is a picture of the viewer:
With the commands on the bottom bar you can:
- change server
- set a slice (if using a 3D dataset)
- set a timestep
- set palettes and min-max range
- choose a field of the selected dataset
Example of using precompiled mod_visus
Create 'server.config' file (replace 2kbit1 with your dataset name):
cat <<EOF > server.config <?xml version="1.0" ?> <visus> <dataset name='2kbit1' url='file:///home/visus/dataset/2kbit1/visus.idx' permissions='public'/> </visus> EOF
Create Dockerfile:
cat <<EOF > Dockerfile FROM visus/mod_visus COPY server.config /home/visus/server.config EOF
Build mod_visus docker image:
docker build -t visus/my-server .
Run the image mounting a host volume:
docker run -it --rm -p 8080:80 --volume="c:/visus_dataset/2kbit1:/home/visus/dataset/2kbit1" visus/my-server
Test if it works:
wget "http://localhost:8080/mod_visus?action=readdataset&dataset=2kbit1"
Use ViSUS convert from docker
The ViSUS tools executables (see ViSUS Convert) are contained in the image under /usr/local/visus/bin
.
For example, if you want to use the tools to convert a raw dataset using your docker deployment you can do it as follow.
Mount a folder that contains your raw data and your converted idx data as follow:
docker run -d -p 8080:80 -v /full/path/to/your/raw/:/home/visus/datasets/raw -v /full/path/to/your/idx/:/home/visus/datasets/idx visus/visus
Check that your container is running correctly (using docker ps
) and take note of the Container ID.
Now run a bash session on this container using:
docker exec -it <id_from_docker_ps> /bin/bash
From this bash session you can use your ViSUS converter to convert your data (just mounted in the container) as described in ViSUS Convert.
Example of creating a test david_subsampled server
Create 'server.config' file:
cat <<EOF > server.config <?xml version="1.0" ?> <visus> <dataset name='david_subsampled' url='file:///home/visus/dataset/david_subsampled/visus.idx' permissions='public'/> </visus> EOF
Create Dockerfile:
cat <<EOF > Dockerfile FROM visus/mod_visus COPY server.config /home/visus/server.config RUN set -x \ && apt update \ && apt install -y curl \ && cd /home/visus/dataset \ && curl http://atlantis.sci.utah.edu/download/david_subsampled.tar.gz -o temp.tar.gz \ && tar xvzf temp.tar.gz \ && rm -f temp.tar.gz \ && chown -R www-data /home/visus/dataset \ && chmod -R a+rX /home/visus/dataset EOF
Build mod_visus docker image:
docker build -t visus/david_subsampled .
Run the image mounting a host volume:
docker run -it --rm -p 8080:80 visus/david_subsampled
Test if it works:
wget "http://localhost:8080/mod_visus?action=readdataset&dataset=david_subsampled"
Some tricks
To debug mod_visus (example: to check Apache log files):
docker run -ti -p 8080:80 --entrypoint=/bin/bash visus/mod_visus -s /usr/local/bin/httpd-foreground.sh
To run an interactive 'clean' ubuntu (or whatever):
docker run -ti -p 8080:80 --entrypoint=/bin/bash ubuntu:16.04 -s
If you want to remove all old docker images and containers (and you know what you are doing!)
docker rm -f $(docker ps -a -q) docker rmi -f $(docker images -q)