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

WIP: Paraview express #2

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
53 changes: 29 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/
RUN chmod +x /bin/tini

# ffmpeg
# RUN apt update \
# && apt install -y --no-install-recommends --allow-unauthenticated \
# ffmpeg \
# && rm -rf /var/lib/apt/lists/* \
# && mkdir /usr/local/ffmpeg \
# && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg
RUN apt update \
&& apt install -y --no-install-recommends --allow-unauthenticated \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /usr/local/ffmpeg \
&& ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg

# python library
COPY image/usr/local/lib/web/backend/requirements.txt /tmp/
Expand Down Expand Up @@ -105,25 +105,32 @@ FROM system

COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/

# Install QGIS
# Install Paraview

RUN apt update \
&& apt upgrade -y \
&& apt install build-essential -y

RUN apt-get update && apt-get install -y xterm paraview
RUN apt-get install -y qt5-default
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs protobuf-compiler
RUN npm install -g pvw-visualizer
RUN ldconfig && \
mkdir /usr/local/opt/ && \
mkdir /Applications

EXPOSE 8000
CMD ["python", "/opt/cdatweb/run.py", "--port", "8000", "--upload-directory", "/opt/uvcdat/sample_data"]

RUN apt update \
&& apt install -y \
python3-pip \
python3-dev \
python3-setuptools \
dirmngr \
xterm \
&& apt autoclean \
&& apt autoremove \
&& rm -rf /var/lib/apt/lists/*

RUN echo "deb http://qgis.org/ubuntu bionic main" >> /etc/apt/sources.list
RUN echo "deb-src http://qgis.org/ubuntu bionic main" >> /etc/apt/sources.list
libxkbcommon-x11-0

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key CAEB3DC3BDF7FB45
ADD docker-paraviewweb/startup.sh startup.sh

RUN apt update && apt-get install -y qgis python3-qgis qgis-plugin-grass
RUN chmod +x /startup.sh
CMD /startup.sh

COPY image /
EXPOSE 6080
Expand All @@ -135,8 +142,6 @@ RUN groupadd --gid 816877 G-816877
RUN useradd --uid 458981 --create-home --shell /bin/bash --user-group --groups G-816877,adm,sudo ubuntu && chown ubuntu:G-816877 /home/ubuntu
RUN usermod -g G-816877 ubuntu
RUN mkdir -p /home/ubuntu/.config/pcmanfm/LXDE/ && cp /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf /home/ubuntu/.config/pcmanfm/LXDE/ && chown -R ubuntu:G-816877 /home/ubuntu/.config

COPY kill.py /
# COPY /etc/pki/tls/certs/designsafe-exec-01.tacc.utexas.edu.cer /etc/nginx/ssl/
# COPY /etc/pki/tls/private/designsafe-exec-01.tacc.utexas.edu.key /etc/nginx/ssl/
# HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health
ENTRYPOINT ["/startup.sh"]
ENTRYPOINT ["/startup.sh"]
25 changes: 25 additions & 0 deletions Paraview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

appname=`basename $0 | sed s,\.sh$,,`

dirname=`dirname $0`
tmp="${dirname#?}"

if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi

core=$dirname/lib/core
coredep=$dirname/lib/coredep
export QTTOOLDIR=/opt/Qt5.12.4/5.12.4/gcc_64/bin
export QTLIBDIR=/opt/Qt5.12.4/5.12.4/gcc_64/lib
LD_LIBRARY_PATH=$dirname:$core:$coredep:$QTLIBDIR:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
#export QT_DEBUG_PLUGINS=1
#echo "$0 = "$0
#echo "appname = "$appname
#echo "dirname = "$dirname
#echo "tmp = "$tmp
echo "LD_LIBRARY_PATH = "$LD_LIBRARY_PATH

$dirname/$appname "$@"
11 changes: 11 additions & 0 deletions README_Paraview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
app
--------
Here are some notes on this app's image.


Building Docker image
================
This Dockerfile will download, unzip, and run Paraview 5.6 for Ubuntu 18.04.
```
docker build -t tagname .
```
14 changes: 14 additions & 0 deletions docker-paraviewweb/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sudo: required

language: python
python: 2.7

services:
- docker

before_install:
- docker build -t bmcv/galaxy-paraviewweb .
- docker run -d -p 8777:8777 bmcv/galaxy-paraviewweb

script:
- docker ps
40 changes: 40 additions & 0 deletions docker-paraviewweb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM nginx

MAINTAINER Thomas Wollmann <[email protected]>

ENV CONDA /miniconda/
ENV PATH $CONDA/bin:$PATH

RUN apt-get update && apt-get install -y wget bzip2 npm nodejs-legacy && \
wget -q http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh && \
bash Miniconda2-latest-Linux-x86_64.sh -p /miniconda -b && \
rm Miniconda2-latest-Linux-x86_64.sh && \
rm -rf /var/lib/apt/lists/* && \
apt-get purge -y wget && \
conda install paraview -c bioconda -c conda-forge -y && \
npm install -g pvw-visualizer

RUN echo $CONDA/lib/paraview-5.2/ > /etc/ld.so.conf.d/paraview.conf && \
ldconfig && \
mkdir /usr/local/opt/ && \
mkdir /Applications

ADD nginx.conf /etc/nginx/nginx.conf

WORKDIR /input

ENV DEBUG=false \
GALAXY_WEB_PORT=10000 \
NOTEBOOK_PASSWORD=none \
CORS_ORIGIN=none \
DOCKER_PORT=none \
API_KEY=none \
HISTORY_ID=none \
REMOTE_HOST=none \
GALAXY_URL=none

EXPOSE 8777

ADD startup.sh /
RUN chmod +x /startup.sh
CMD /startup.sh
21 changes: 21 additions & 0 deletions docker-paraviewweb/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 46 additions & 0 deletions docker-paraviewweb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

[![Build Status](https://travis-ci.org/BMCV/docker-paraviewweb.svg?branch=master)](https://travis-ci.org/BMCV/docker-paraviewweb)
[![Docker Pulls](https://img.shields.io/docker/pulls/bmcv/galaxy-paraviewweb.svg)](https://hub.docker.com/r/bmcv/galaxy-paraviewweb/)
[![Docker Stars](https://img.shields.io/docker/stars/bmcv/galaxy-paraviewweb.svg)](https://hub.docker.com/r/bmcv/galaxy-paraviewweb/)

Docker ParaViewWeb Container
========================


This [ParaViewWeb](http://paraviewweb.kitware.com/) Docker container is used by the [Galaxy Project](https://galaxyproject.org/).

![screenshot](screenshot.png)

Usage
=====

* Build your own image and run it

[Docker](https://www.docker.com) is a pre-requirement for this project. You can build the container with:
```bash
docker build -t paraviewweb .
```
The build process can take some time, but if finished you can run your container with:
```bash
docker run -p 8777:8777 -v /home/user/paraviewweb/input/:/input/ -v /home/user/paraviewweb/output/:/output/ paraviewweb
```
and you will have a running [ParaViewWeb](http://paraviewweb.kitware.com/) instance on ``http://localhost:8777/apps/Visualizer``.

Environment Variables
=====================

Some environment variables are made available to the user which will allow for configuring the behaviour of individual instances.

Variable | Use
------------------- | ---
`DATASET_HID` | Path of file relative to /input which is loaded on startup

Acknowledgment
========================
This work was supported by the BMBF-funded Heidelberg Center for Human Bioinformatics (HD-HuB) within the German Network for Bioinformatics Infrastructure (de.NBI) #031A537C.

Works best with
=====================

* [Galaxy Image Analysis Tools](https://github.com/ThomasWollmann/galaxy-image-analysis)
* [Galaxy Imaging](https://github.com/bgruening/docker-galaxy-imaging)
File renamed without changes.
28 changes: 28 additions & 0 deletions docker-paraviewweb/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
events {
worker_connections 128;
}

http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 8777;
server_name 0.0.0.0;

location / {
proxy_pass http://127.0.0.1:9777;

add_header Access-Control-Allow-Origin *;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With';

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
Empty file.
Binary file added docker-paraviewweb/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docker-paraviewweb/startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

service nginx start

if [ -z "$DATASET_HID" ]
then
Visualizer --paraview $CONDA/lib/paraview-5.2/ \
--data /input \
--port 8777 \
--server-only
else
Visualizer --paraview $CONDA/lib/paraview-5.2/ \
--data /input \
--port 8777 \
--server-only \
--load-file $DATASET_HID
fi
8 changes: 4 additions & 4 deletions image/etc/supervisor/conf.d/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ command=bash /usr/local/lib/web/frontend/static/novnc/utils/launch.sh --listen 6
stopasgroup=true
stdout_logfile=/var/log/novnc.log

[program:qgis]
[program:paraview]
priority=35
directory=/home/ubuntu/mydata
command=xterm -r -ls -geometry 80x24+10+10 -title '*** Exit this window to kill your QGIS session ***' -e '/usr/bin/qgis --nologo'
command=xterm -r -ls -geometry 80x24+10+10 -title '*** Exit this window to kill your Paraview session ***' -e 'paraview'
user=ubuntu
autostart=true
autorestart=false
stopsignal=QUIT
environment=DISPLAY=":1",HOME="/home/ubuntu"
stdout_logfile=/var/log/qgis.log
stdout_logfile=/var/log/paraview.log
redirect_stderr=true

[eventlistener:exit]
command=/kill.py
process_name=qgis
process_name=paraview
events=PROCESS_STATE_EXITED
26 changes: 26 additions & 0 deletions kill.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
import sys
import os
import signal

def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while 1:
write_stdout('READY\n')
line = sys.stdin.readline()
write_stdout('This line kills supervisor: ' + line);
try:
pidfile = open('/var/run/supervisord.pid','r')
pid = int(pidfile.readline());
os.kill(pid, signal.SIGQUIT)
except Exception as e:
write_stdout('Could not kill supervisor: ' + e.strerror + '\n')
write_stdout('RESULT 2\nOK')
if __name__ == '__main__':
main()
import sys
Binary file removed screenshots/lxde.png
Binary file not shown.
2 changes: 1 addition & 1 deletion web/static/websockify
Submodule websockify updated 58 files
+0 −4 .gitignore
+6 −1 .travis.yml
+0 −0 COPYING
+0 −14 LICENSE.txt
+36 −49 README.md
+2 −2 Windows/Windows Service Readme.txt
+0 −621 docs/LICENSE.GPL-3
+0 −373 docs/LICENSE.MPL-2.0
+0 −6 docs/TODO
+0 −4 docs/flash_policy.txt
+1 −4 docs/release.txt
+2 −14 docs/websockify.1
+0 −919 include/VT100.js
+0 −99 include/keysym.js
+0 −364 include/util.js
+0 −363 include/websock.js
+0 −216 include/webutil.js
+0 −235 include/wsirc.js
+0 −337 include/wstelnet.js
+0 −14 other/Makefile
+0 −51 other/README.md
+0 −7 other/js/README.md
+0 −23 other/js/package.json
+0 −225 other/js/websockify.js
+0 −118 other/launch.sh
+0 −13 other/project.clj
+0 −911 other/websocket.c
+0 −104 other/websocket.h
+0 −434 other/websocket.rb
+0 −388 other/websockify.c
+0 −233 other/websockify.clj
+0 −171 other/websockify.rb
+0 −22 other/wswrap
+5 −3 run
+1 −4 setup.py
+4 −0 test-requirements.txt
+23 −31 tests/echo.html
+0 −69 tests/echo.rb
+27 −0 tests/fixtures/private.pem
+9 −0 tests/fixtures/public.pem
+1 −0 tests/fixtures/symmetric.key
+0 −1 tests/include
+28 −39 tests/latency.html
+29 −37 tests/load.html
+27 −32 tests/plain_echo.html
+17 −19 tests/simple.html
+99 −5 tests/test_websocketproxy.py
+87 −1 tests/test_websockifyserver.py
+4 −0 websockify/__main__.py
+14 −8 websockify/auth_plugins.py
+118 −0 websockify/sysloghandler.py
+72 −2 websockify/token_plugins.py
+5 −3 websockify/websocket.py
+222 −78 websockify/websocketproxy.py
+20 −12 websockify/websocketserver.py
+38 −16 websockify/websockifyserver.py
+0 −98 wsirc.html
+0 −73 wstelnet.html