From 14175f98901f453e4cf8b8feb9acfbf4c3bd6c11 Mon Sep 17 00:00:00 2001 From: Jules BOURDAIS Date: Mon, 30 Jun 2025 14:56:10 +0200 Subject: [PATCH 1/4] docker setup --- docker/Dockerfile | 32 ++++++++++++++++++++++++++++ docker/Dockerfile.common | 34 ++++++++++++++++++++++++++++++ docker/README.md | 13 ++++++++++++ docker/scripts/build_examples.bash | 4 ++++ docker/scripts/build_peacock.bash | 8 +++++++ docker/scripts/entrypoint.bash | 4 ++++ docker/scripts/run_example.bash | 3 +++ docker/scripts/setup.bash | 5 +++++ docker/scripts/setup_venv.bash | 4 ++++ 9 files changed, 107 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/Dockerfile.common create mode 100644 docker/README.md create mode 100755 docker/scripts/build_examples.bash create mode 100755 docker/scripts/build_peacock.bash create mode 100755 docker/scripts/entrypoint.bash create mode 100755 docker/scripts/run_example.bash create mode 100755 docker/scripts/setup.bash create mode 100755 docker/scripts/setup_venv.bash diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2f0ec50 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,32 @@ +FROM peacock_common:latest + +WORKDIR /work + +RUN git clone https://github.com/idaholab/moose.git +RUN git clone https://github.com/Kitware/peacock.git + + + +RUN source /environment && ./build_examples.bash +SHELL ["bash" , "-c"] + +RUN source $NVM_DIR/nvm.sh && \ +nvm install 16 && \ +nvm use 16 && \ +nvm alias default 16 + +# Export PATH for node/npm access in later layers +ENV NODE_VERSION=16 +ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH + +# Verify node installation +RUN node -v && npm -v && echo yesss +RUN ./setup_venv.bash +RUN ./build_peacock.bash && \ + /work/venv/bin/python -m pip install /work/peacock + +# setup python path for MOOSE and paraview +ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages + +ENTRYPOINT ["/work/entrypoint.bash"] +CMD ["-I", "./moose/examples/ex08_materials/ex08.i"] diff --git a/docker/Dockerfile.common b/docker/Dockerfile.common new file mode 100644 index 0000000..5a0b685 --- /dev/null +++ b/docker/Dockerfile.common @@ -0,0 +1,34 @@ +FROM idaholab/moose:latest + +WORKDIR /opt + +SHELL ["/bin/bash", "-ce"] + +# install paraview +RUN wget --quiet -O ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v6.0&type=binary&os=Linux&downloadFile=ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + tar xf "ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + mv ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64/ paraview/ && \ + rm ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz + +# install required runtime dependencies for paraview & utility packages +RUN dnf install -qy libglvnd-opengl libglvnd-glx tree mesa-libEGL mesa-libOSMesa + +ENV PVPYTHONPATH=/opt/paraview/bin/pvpython + +WORKDIR /work + +# install node 16 (for OpenSSL compat) +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && source ~/.bashrc && nvm install 16 + +ENV NVM_DIR=/root/.nvm + +# install moose language server +RUN git clone https://github.com/idaholab/moose-language-support.git +RUN cd moose-language-support && source ~/.bashrc && nvm use 16 && npm i && npm run esbuild + +COPY scripts/ /work/ + +# setup python path for MOOSE and paraview +ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages + +EXPOSE 8080 diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..1c93fc3 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,13 @@ +# peacock docker + +Build the image: +```bash +docker build -f Dockerfile.common . -t peacock_common:latest +docker build -f Dockerfile . -t peacock:latest +``` + +Run the image: +```bash +docker run -it --rm -p 8080:8080 peacock:latest) +``` + diff --git a/docker/scripts/build_examples.bash b/docker/scripts/build_examples.bash new file mode 100755 index 0000000..b299710 --- /dev/null +++ b/docker/scripts/build_examples.bash @@ -0,0 +1,4 @@ +#!/bin/bash +cd /work/moose/examples + +make -j $(( $(nproc) - 2)) diff --git a/docker/scripts/build_peacock.bash b/docker/scripts/build_peacock.bash new file mode 100755 index 0000000..1e17a27 --- /dev/null +++ b/docker/scripts/build_peacock.bash @@ -0,0 +1,8 @@ +#!/bin/bash + +cd /work/peacock +source $NVM_DIR/nvm.sh && \ +nvm use 16 +node -v && cd vue-components && npm i && npm run build +cd - +cd lang-server && npm i && npm run build diff --git a/docker/scripts/entrypoint.bash b/docker/scripts/entrypoint.bash new file mode 100755 index 0000000..6d54720 --- /dev/null +++ b/docker/scripts/entrypoint.bash @@ -0,0 +1,4 @@ +#!/bin/bash + +export PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages:$PYTHONPATH +/work/venv/bin/peacock-trame --server --host 0.0.0.0 -L /work/moose-language-support/out/main.js $@ diff --git a/docker/scripts/run_example.bash b/docker/scripts/run_example.bash new file mode 100755 index 0000000..63fd7d9 --- /dev/null +++ b/docker/scripts/run_example.bash @@ -0,0 +1,3 @@ +#!/bin/bash +EXAMPLE_PATH=/opt/moose/share/combined/reactor/hexagonal_grid_positions.i +/work/venv/bin/peacock-trame --server --host 0.0.0.0 -I ./moose/examples/ex08_materials/ex08.i -L /work/moose-language-support/out/main.js diff --git a/docker/scripts/setup.bash b/docker/scripts/setup.bash new file mode 100755 index 0000000..53009fb --- /dev/null +++ b/docker/scripts/setup.bash @@ -0,0 +1,5 @@ +#!/bin/bash +bash setup_venv.bash +bash build_peacock.bash +/work/venv/bin/python -m pip install /work/peacock +bash build_examples.bash diff --git a/docker/scripts/setup_venv.bash b/docker/scripts/setup_venv.bash new file mode 100755 index 0000000..b024174 --- /dev/null +++ b/docker/scripts/setup_venv.bash @@ -0,0 +1,4 @@ +#!/bin/bash +# setup python environment +/opt/miniforge3/bin/python -m venv venv +./venv/bin/python -m pip install vtk && ./venv/bin/python -m pip install --upgrade pip From b279bc4d9a0ff7fe2a305217bc3ff69b55162d3d Mon Sep 17 00:00:00 2001 From: Jules BOURDAIS Date: Mon, 18 Aug 2025 16:36:24 +0200 Subject: [PATCH 2/4] docker: improve setup & fix errors - use paraview 6.0.0 - install mesa-dri-drivers to fix errors - move app setup in docker entrypoint to allow local peacock mount at container runtime - make sure we use python 3.12 for venv setup --- docker/Dockerfile | 11 ++++------- docker/Dockerfile.common | 14 ++++++-------- docker/README.md | 9 +++++++-- docker/scripts/entrypoint.bash | 4 +++- docker/scripts/setup_venv.bash | 3 +-- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2f0ec50..7c98881 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,10 +2,10 @@ FROM peacock_common:latest WORKDIR /work -RUN git clone https://github.com/idaholab/moose.git -RUN git clone https://github.com/Kitware/peacock.git - +RUN git clone https://github.com/idaholab/moose.git --branch 2025-05-09-release --depth 1 +RUN git clone https://github.com/bourdaisj/peacock.git && cd peacock && git checkout improve-exodus-viewer-time-and-block-handling +COPY scripts/ /work/ RUN source /environment && ./build_examples.bash SHELL ["bash" , "-c"] @@ -20,10 +20,7 @@ ENV NODE_VERSION=16 ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH # Verify node installation -RUN node -v && npm -v && echo yesss -RUN ./setup_venv.bash -RUN ./build_peacock.bash && \ - /work/venv/bin/python -m pip install /work/peacock +RUN node -v && npm -v # setup python path for MOOSE and paraview ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages diff --git a/docker/Dockerfile.common b/docker/Dockerfile.common index 5a0b685..84cecaf 100644 --- a/docker/Dockerfile.common +++ b/docker/Dockerfile.common @@ -1,17 +1,17 @@ -FROM idaholab/moose:latest +FROM idaholab/moose:2025.05.30-1a66aba WORKDIR /opt SHELL ["/bin/bash", "-ce"] # install paraview -RUN wget --quiet -O ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v6.0&type=binary&os=Linux&downloadFile=ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz" && \ - tar xf "ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz" && \ - mv ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64/ paraview/ && \ - rm ParaView-6.0.0-RC1-MPI-Linux-Python3.12-x86_64.tar.gz +RUN wget --quiet -O ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v6.0&type=binary&os=Linux&downloadFile=ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + tar xf "ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + mv ParaView-6.0.0-MPI-Linux-Python3.12-x86_64/ paraview/ && \ + rm ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz # install required runtime dependencies for paraview & utility packages -RUN dnf install -qy libglvnd-opengl libglvnd-glx tree mesa-libEGL mesa-libOSMesa +RUN dnf install -qy libglvnd-opengl libglvnd-glx tree mesa-libEGL mesa-libOSMesa mesa-dri-drivers ENV PVPYTHONPATH=/opt/paraview/bin/pvpython @@ -26,8 +26,6 @@ ENV NVM_DIR=/root/.nvm RUN git clone https://github.com/idaholab/moose-language-support.git RUN cd moose-language-support && source ~/.bashrc && nvm use 16 && npm i && npm run esbuild -COPY scripts/ /work/ - # setup python path for MOOSE and paraview ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages diff --git a/docker/README.md b/docker/README.md index 1c93fc3..3db9bc3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,8 +6,13 @@ docker build -f Dockerfile.common . -t peacock_common:latest docker build -f Dockerfile . -t peacock:latest ``` -Run the image: +Run the image with default entrypoint and builtin peacock: ```bash -docker run -it --rm -p 8080:8080 peacock:latest) +docker run -it --rm -p 8080:8080 peacock:latest ``` +Run the image with local peacock and bash shell for more control +```bash +cd /my/path/to/peacock/sources +docker run -it --rm -p 8080:8080 -v $PWD:/work/peacock --entrypoint /bin/bash peacock:latest +``` diff --git a/docker/scripts/entrypoint.bash b/docker/scripts/entrypoint.bash index 6d54720..36e5bab 100755 --- a/docker/scripts/entrypoint.bash +++ b/docker/scripts/entrypoint.bash @@ -1,4 +1,6 @@ #!/bin/bash - +./setup_venv.bash +./build_peacock.bash && \ + /work/venv/bin/python -m pip install /work/peacock export PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages:$PYTHONPATH /work/venv/bin/peacock-trame --server --host 0.0.0.0 -L /work/moose-language-support/out/main.js $@ diff --git a/docker/scripts/setup_venv.bash b/docker/scripts/setup_venv.bash index b024174..4dc734e 100755 --- a/docker/scripts/setup_venv.bash +++ b/docker/scripts/setup_venv.bash @@ -1,4 +1,3 @@ #!/bin/bash -# setup python environment -/opt/miniforge3/bin/python -m venv venv +/opt/miniforge3/bin/python3.12 -m venv venv ./venv/bin/python -m pip install vtk && ./venv/bin/python -m pip install --upgrade pip From f921aeee79ce7b4bb5b47020d46a4851d78c30d3 Mon Sep 17 00:00:00 2001 From: Jules BOURDAIS Date: Fri, 22 Aug 2025 15:45:41 +0200 Subject: [PATCH 3/4] fix scripts permissions --- docker/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7c98881..6ce88aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,5 +25,12 @@ RUN node -v && npm -v # setup python path for MOOSE and paraview ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages +RUN ["chmod", "+x", "/work/build_examples.bash"] +RUN ["chmod", "+x", "/work/build_peacock.bash"] +RUN ["chmod", "+x", "/work/entrypoint.bash"] +RUN ["chmod", "+x", "/work/run_example.bash"] +RUN ["chmod", "+x", "/work/setup_venv.bash"] +RUN ["chmod", "+x", "/work/setup.bash"] + ENTRYPOINT ["/work/entrypoint.bash"] CMD ["-I", "./moose/examples/ex08_materials/ex08.i"] From 8ea531af93ab62b7e79b9b9408050753b9434ce1 Mon Sep 17 00:00:00 2001 From: "software.solution" Date: Fri, 29 Aug 2025 14:58:01 +0100 Subject: [PATCH 4/4] rework docker setup: split into moosepv & peacock images --- README.rst | 5 +++ docker/Dockerfile | 36 ---------------- docker/Dockerfile.common | 32 -------------- docker/Dockerfile.moosepv | 29 +++++++++++++ docker/Dockerfile.peacock | 30 +++++++++++++ docker/README.md | 43 +++++++++++++++---- docker/add_moose_examples.bash | 5 +++ .../entrypoint.bash => run_peacock.bash} | 4 +- docker/scripts/build_examples.bash | 4 -- docker/scripts/build_peacock.bash | 8 ---- docker/scripts/run_example.bash | 3 -- docker/scripts/setup.bash | 5 --- docker/scripts/setup_venv.bash | 3 -- peacock_trame/app/fileEditor.py | 1 + 14 files changed, 106 insertions(+), 102 deletions(-) delete mode 100644 docker/Dockerfile delete mode 100644 docker/Dockerfile.common create mode 100644 docker/Dockerfile.moosepv create mode 100644 docker/Dockerfile.peacock create mode 100755 docker/add_moose_examples.bash rename docker/{scripts/entrypoint.bash => run_peacock.bash} (68%) delete mode 100755 docker/scripts/build_examples.bash delete mode 100755 docker/scripts/build_peacock.bash delete mode 100755 docker/scripts/run_example.bash delete mode 100755 docker/scripts/setup.bash delete mode 100755 docker/scripts/setup_venv.bash diff --git a/README.rst b/README.rst index aebea89..67e4b5a 100644 --- a/README.rst +++ b/README.rst @@ -110,3 +110,8 @@ Run the application assuming the same layout as previously described cd ./moose/examples/ex08_materials make peacock-trame -I ./ex08.i + +Docker image +----------------------------------------------------------- + +Alternatively you can use the docker image. Just head to the `docker folder/ `_ diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 6ce88aa..0000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM peacock_common:latest - -WORKDIR /work - -RUN git clone https://github.com/idaholab/moose.git --branch 2025-05-09-release --depth 1 -RUN git clone https://github.com/bourdaisj/peacock.git && cd peacock && git checkout improve-exodus-viewer-time-and-block-handling - -COPY scripts/ /work/ - -RUN source /environment && ./build_examples.bash -SHELL ["bash" , "-c"] - -RUN source $NVM_DIR/nvm.sh && \ -nvm install 16 && \ -nvm use 16 && \ -nvm alias default 16 - -# Export PATH for node/npm access in later layers -ENV NODE_VERSION=16 -ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH - -# Verify node installation -RUN node -v && npm -v - -# setup python path for MOOSE and paraview -ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages - -RUN ["chmod", "+x", "/work/build_examples.bash"] -RUN ["chmod", "+x", "/work/build_peacock.bash"] -RUN ["chmod", "+x", "/work/entrypoint.bash"] -RUN ["chmod", "+x", "/work/run_example.bash"] -RUN ["chmod", "+x", "/work/setup_venv.bash"] -RUN ["chmod", "+x", "/work/setup.bash"] - -ENTRYPOINT ["/work/entrypoint.bash"] -CMD ["-I", "./moose/examples/ex08_materials/ex08.i"] diff --git a/docker/Dockerfile.common b/docker/Dockerfile.common deleted file mode 100644 index 84cecaf..0000000 --- a/docker/Dockerfile.common +++ /dev/null @@ -1,32 +0,0 @@ -FROM idaholab/moose:2025.05.30-1a66aba - -WORKDIR /opt - -SHELL ["/bin/bash", "-ce"] - -# install paraview -RUN wget --quiet -O ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v6.0&type=binary&os=Linux&downloadFile=ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ - tar xf "ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ - mv ParaView-6.0.0-MPI-Linux-Python3.12-x86_64/ paraview/ && \ - rm ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz - -# install required runtime dependencies for paraview & utility packages -RUN dnf install -qy libglvnd-opengl libglvnd-glx tree mesa-libEGL mesa-libOSMesa mesa-dri-drivers - -ENV PVPYTHONPATH=/opt/paraview/bin/pvpython - -WORKDIR /work - -# install node 16 (for OpenSSL compat) -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash && source ~/.bashrc && nvm install 16 - -ENV NVM_DIR=/root/.nvm - -# install moose language server -RUN git clone https://github.com/idaholab/moose-language-support.git -RUN cd moose-language-support && source ~/.bashrc && nvm use 16 && npm i && npm run esbuild - -# setup python path for MOOSE and paraview -ENV PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages - -EXPOSE 8080 diff --git a/docker/Dockerfile.moosepv b/docker/Dockerfile.moosepv new file mode 100644 index 0000000..31b8d5b --- /dev/null +++ b/docker/Dockerfile.moosepv @@ -0,0 +1,29 @@ +FROM idaholab/moose:2025.05.30-1a66aba + +WORKDIR /opt + +SHELL ["/bin/bash", "-ce"] + +# install paraview +RUN wget --quiet -O ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz "https://www.paraview.org/files/v6.0/ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + tar xf "ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz" && \ + mv ParaView-6.0.0-MPI-Linux-Python3.12-x86_64/ paraview/ && \ + rm ParaView-6.0.0-MPI-Linux-Python3.12-x86_64.tar.gz + +ENV PVPYTHONPATH=/opt/paraview/bin/pvpython + +ENV NVIDIA_DRIVER_CAPABILITIES=all +ENV NVIDIA_VISIBLE_DEVICES=all + +ENV MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA + +# install packages for both NVIDIA EGL and mesa llvmpipe runtimes +RUN dnf install -qy libglvnd-opengl libglvnd-egl mesa-libGL mesa-dri-drivers + +COPY ./add_moose_examples.bash /work/add_moose_examples.bash +RUN /work/add_moose_examples.bash + +# build the porous_flow module +RUN cd /work/moose/modules/porous_flow && source /environment && make -j $(( $(nproc) - 2)) + +ENTRYPOINT ["/opt/paraview/bin/pvpython"] diff --git a/docker/Dockerfile.peacock b/docker/Dockerfile.peacock new file mode 100644 index 0000000..250d4df --- /dev/null +++ b/docker/Dockerfile.peacock @@ -0,0 +1,30 @@ +FROM node:20-bookworm AS js_assets_builder + +WORKDIR /work + +RUN git clone https://github.com/idaholab/moose-language-support.git && \ + cd moose-language-support && npm install --no-audit && \ + npm run esbuild + +ENV NODE_OPTIONS=--openssl-legacy-provider + +RUN git clone https://github.com/Kitware/peacock.git && \ + cd peacock/vue-components && npm i --no-audit && npm run build && \ + cd /work/peacock/lang-server && npm i --no-audit && npm run build + +FROM moosepv:latest + +WORKDIR /work + +COPY --from=js_assets_builder /work/moose-language-support/out /work/moose-language-support/out +COPY --from=js_assets_builder /work/peacock /work/peacock + +COPY ./run_peacock.bash /work/run_peacock.bash + +RUN /opt/miniforge3/bin/python3.12 -m venv venv && ./venv/bin/python -m pip install --upgrade pip && \ + ./venv/bin/python -m pip install vtk && ./venv/bin/python -m pip install /work/peacock + +ENV PYTHON_EXECUTABLE=/work/venv/bin/python + +ENTRYPOINT ["/work/run_peacock.bash"] +CMD ["-I", "/work/moose/examples/ex08_materials/ex08.i"] diff --git a/docker/README.md b/docker/README.md index 3db9bc3..887aa8f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,18 +1,45 @@ -# peacock docker +# Peacock docker image -Build the image: +## Build ```bash -docker build -f Dockerfile.common . -t peacock_common:latest -docker build -f Dockerfile . -t peacock:latest +docker build -f Dockerfile.moosepv . -t moosepv:latest +docker build -f Dockerfile.peacock . -t peacock:latest ``` -Run the image with default entrypoint and builtin peacock: + +## Basic usage ```bash +# run the image with default entrypoint and builtin peacock +# ParaView OpenGL renderer will be llvmpipe docker run -it --rm -p 8080:8080 peacock:latest + +# same but if you have a NVIDIA GPU you want to use +docker run --privileged --runtime=nvidia --gpus all -it --rm -p 8080:8080 peacock:latest + +# run with custom peacock input and executable, here porous_flow +docker run -it --rm -p 8080:8080 peacock:latest -I /work/moose/modules/porous_flow/examples/flow_through_fractured_media/diffusion.i -E /work/moose/modules/porous_flow/porous_flow-opt ``` -Run the image with local peacock and bash shell for more control +## Advanced usage ```bash -cd /my/path/to/peacock/sources -docker run -it --rm -p 8080:8080 -v $PWD:/work/peacock --entrypoint /bin/bash peacock:latest +# run the image with an interactive bash shell for more control +docker run -it --rm -p 8080:8080 --entrypoint /bin/bash peacock:latest + +# map your local data into the container +# example: use host input file with container executable +# the -u flag is important so that the output files are written back to the host with correct permissions +docker run -it --rm -p 8080:8080 -u $UID:$GID -v /path/to/moose/examples/ex08_materials:/work/user_data peacock:latest -I /work/user_data/ex08.i -E /work/moose/examples/ex08_materials/ex08-opt + +# by overriding the container entrypoint, you can do much more than just running peacock +# example, getting porous flow options as JSON +docker run -it --rm --entrypoint /work/moose/modules/porous_flow/porous_flow-opt peacock:latest -options_left 0 --json > porous_flow_params.json + +# for peacock developers: mount your local peacock +cd /path/to/your/local/peacock +docker run -it --rm -p 8080:8080 --entrypoint /bin/bash -v $PWD:/work/peacock peacock:latest +# then, pip install peacock in editable mode +> $PYTHON_EXECUTABLE -m pip install -e /work/peacock +# you're now free to modify your host peacock and run it inside the container +# just make sure the vue-components and lang-server are built on the host +> /work/run_peacock.bash -I /work/moose/examples/ex08_materials/ex08.i ``` diff --git a/docker/add_moose_examples.bash b/docker/add_moose_examples.bash new file mode 100755 index 0000000..02dd822 --- /dev/null +++ b/docker/add_moose_examples.bash @@ -0,0 +1,5 @@ +#!/bin/bash +git clone https://github.com/idaholab/moose.git /work/moose --branch 2025-05-09-release --depth 1 +cd /work/moose/examples +source /environment +make -j $(( $(nproc) - 2)) diff --git a/docker/scripts/entrypoint.bash b/docker/run_peacock.bash similarity index 68% rename from docker/scripts/entrypoint.bash rename to docker/run_peacock.bash index 36e5bab..6d54720 100755 --- a/docker/scripts/entrypoint.bash +++ b/docker/run_peacock.bash @@ -1,6 +1,4 @@ #!/bin/bash -./setup_venv.bash -./build_peacock.bash && \ - /work/venv/bin/python -m pip install /work/peacock + export PYTHONPATH=/opt/moose/share/moose/python:/opt/paraview/lib/python3.12/site-packages:$PYTHONPATH /work/venv/bin/peacock-trame --server --host 0.0.0.0 -L /work/moose-language-support/out/main.js $@ diff --git a/docker/scripts/build_examples.bash b/docker/scripts/build_examples.bash deleted file mode 100755 index b299710..0000000 --- a/docker/scripts/build_examples.bash +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -cd /work/moose/examples - -make -j $(( $(nproc) - 2)) diff --git a/docker/scripts/build_peacock.bash b/docker/scripts/build_peacock.bash deleted file mode 100755 index 1e17a27..0000000 --- a/docker/scripts/build_peacock.bash +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -cd /work/peacock -source $NVM_DIR/nvm.sh && \ -nvm use 16 -node -v && cd vue-components && npm i && npm run build -cd - -cd lang-server && npm i && npm run build diff --git a/docker/scripts/run_example.bash b/docker/scripts/run_example.bash deleted file mode 100755 index 63fd7d9..0000000 --- a/docker/scripts/run_example.bash +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -EXAMPLE_PATH=/opt/moose/share/combined/reactor/hexagonal_grid_positions.i -/work/venv/bin/peacock-trame --server --host 0.0.0.0 -I ./moose/examples/ex08_materials/ex08.i -L /work/moose-language-support/out/main.js diff --git a/docker/scripts/setup.bash b/docker/scripts/setup.bash deleted file mode 100755 index 53009fb..0000000 --- a/docker/scripts/setup.bash +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -bash setup_venv.bash -bash build_peacock.bash -/work/venv/bin/python -m pip install /work/peacock -bash build_examples.bash diff --git a/docker/scripts/setup_venv.bash b/docker/scripts/setup_venv.bash deleted file mode 100755 index 4dc734e..0000000 --- a/docker/scripts/setup_venv.bash +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -/opt/miniforge3/bin/python3.12 -m venv venv -./venv/bin/python -m pip install vtk && ./venv/bin/python -m pip install --upgrade pip diff --git a/peacock_trame/app/fileEditor.py b/peacock_trame/app/fileEditor.py index dd36f7a..861c65e 100644 --- a/peacock_trame/app/fileEditor.py +++ b/peacock_trame/app/fileEditor.py @@ -39,6 +39,7 @@ try: from paraview import simple + # print("Using PV OpenGL Renderer: ", simple.GetOpenGLInformation().GetRenderer()) USE_PARAVIEW = True except ModuleNotFoundError: USE_PARAVIEW = False