Skip to content

Commit

Permalink
fix(docker): make it docker deployable
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Jun 3, 2022
1 parent 9188ce0 commit e365864
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 30 deletions.
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ FROM kitware/trame:1.2-glvnd-runtime-ubuntu20.04-py39
RUN install -d -o trame-user -g trame-user /deploy

# Install ParaView-EGL
ARG PV_URL=https://www.paraview.org/files/v5.10/ParaView-5.10.0-egl-MPI-Linux-Python3.9-x86_64.tar.gz
# ARG PV_URL=https://www.paraview.org/files/v5.10/ParaView-5.10.0-egl-MPI-Linux-Python3.9-x86_64.tar.gz
ARG PV_URL=https://www.paraview.org/files/nightly/ParaView-master-5.10.1-1278-g070ee00d18-egl-MPI-Linux-Python3.9-x86_64.tar.gz
RUN mkdir -p /opt/paraview && cd /opt/paraview && wget -qO- $PV_URL | tar --strip-components=1 -xzv
ENV TRAME_PARAVIEW=/opt/paraview

# Copy the server directory
COPY --chown=trame-user:trame-user ./server /deploy/server

1 change: 0 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## Building paraview-visualizer docker image (Linux only)

```bash
export TRAME_PARAVIEW=/path/to/your/paraview/home
./scripts/build_image.sh
```

Expand Down
2 changes: 0 additions & 2 deletions docker/scripts/build_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ popd

docker run --rm --gpus all \
-e TRAME_BUILD_ONLY=1 \
-e TRAME_PARAVIEW=/opt/paraview \
-v "$TRAME_PARAVIEW:/opt/paraview" \
-v "$DEPLOY_DIR:/deploy" \
-v "$ROOT_DIR/paraview-visualizer:/local-app" \
kitware/trame:1.2-glvnd-runtime-ubuntu20.04-py39
34 changes: 29 additions & 5 deletions docker/setup/apps.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
PyWebVue: # Default app under /index.html
app: pv-visualizer
args:
trame: # Default app under /index.html
www_modules:
- pv_visualizer.html.module
cmd:
- /opt/paraview/bin/pvpython
- -m
- paraview.apps.trame
- --trame-app
- pv_visualizer
- --data
- /data
- --host
- ${host}
- --port
- ${port}
- --authKey
- ${secret}
- --server
Visualizer: # /Visualizer.html or /?name=Visualizer&data=...
app: pv-visualizer
args:
cmd:
- /opt/paraview/bin/pvpython
- -m
- paraview.apps.trame
- --trame-app
- pv_visualizer
- --data
- ${data} # <-- come from url(data=...)
- --host
- ${host}
- --port
- ${port}
- --authKey
- ${secret}
- --server
27 changes: 15 additions & 12 deletions pv_visualizer/app/main.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
from pathlib import Path
from trame.app import get_server, dev
from . import engine, ui

SERVER = None


def _reload():
dev.reload(ui)
ui.initialize(SERVER)


def main(server=None, **kwargs):
from . import engine, ui

global SERVER
if server is None:
server = get_server()

# Add CLI
server.cli.add_argument(
"--data", help="Path to browse", dest="data", default=str(Path.home())
)
server.cli.add_argument(
"--plugins", help="List of distributed plugins to load", dest="plugins"
)

# Make UI auto reload
def _reload():
dev.reload(ui)
ui.initialize(SERVER)

server.controller.on_server_reload.add(_reload)

# Init application
SERVER = server

engine.initialize(server)
ui.initialize(server)

Expand All @@ -29,10 +38,4 @@ def main(server=None, **kwargs):

if __name__ == "__main__":
server = get_server()
server.cli.add_argument(
"--data", help="Path to browse", dest="data", default=str(Path.home())
)
server.cli.add_argument(
"--plugins", help="List of distributed plugins to load", dest="plugins"
)
main(server)
9 changes: 1 addition & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ packages = find:
include_package_data = True
install_requires =
trame
# vtk
# pandas
# numpy
# altair
# mpld3
# plotly
simput
# pydeck
trame-simput

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit e365864

Please sign in to comment.