fds icon indicating copy to clipboard operation
fds copied to clipboard

FDS Docker image (possible solution+tutorial and some questions)

Open rweisse opened this issue 6 years ago • 7 comments

I'm submitting a...

[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[x] Question (scroll down to bottom!)

Current behavior

In our company we have many computers running fds. Some of them are windows-, others are linux-workstations. At the moment it is a little bit annoying to update FDS on each PC. I have to download the corresponding installation file, uncompress it, manipulate the install script and deploy everything as a package by our software-deployment-system. Furthermore I have to do the same with CFAST. Both, FDS and CFAST, are bundled together with Smokeview. These bundles are often holding different versions of Smokeview. Sometimes we have to use older versions of FDS (depending on projects age). Installing multiple FDS versions on one system can be tricky.

Expected behavior

FDS should be installable by a single command via Linux terminal or Windows PowerShell. It should run inside its own (Windows/Linux)-container and it should be possible to run and install multiple containers together on one machine. Furthermore it should be possible to start simulations simultaneously. All these applies to CFAST too. Smokeview should not be part of the container (there is no container user interface). Instead it should be installable by a single executable (like now - no change).

What is the motivation / use case for changing the behavior?

Installation becomes very easy. Even the deployment of FDS and CFAST becomes less complex.

Solution/Environment

The solution is very simple. Docker might be the best technology to conquer this challenge. I have already invested some time and developed a small dockerfile for FSD 6.7.3 (Windows 10 Pro / Windows Server 2016). In principle it is possible to run the fds container inside a virtual machine (hyper-v/virtualbox). But this might waste to much cpu performance. That's why I recommand to run the container on windows together with the parameter --isolation=process or to update the local Docker deamon configuration file to enable this parameter by default:

{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": true,
  "exec-opts": [
    "isolation=process"
  ],
  "experimental": false
}

This parameter insures that fds-threads are running directly on the host-OS and not inside a virtual machine.

Installation Tutorial

  • Download and install Docker: https://hub.docker.com/editions/community/docker-ce-desktop-windows
  • Open a text editor of your choice, paste the following code , save and name it as Dockerfile (without suffix)
# escape=`

# Windows Server Core Image
FROM mcr.microsoft.com/windows/servercore:ltsc2019

# provide setup-file
ARG setupfile=https://github.com/firemodels/fds/releases/download/FDS6.7.3/FDS6.7.3-SMV6.7.10_win64.exe

# set install- and downloaddir
ENV installdir="C:\Program Files\firemodels\FDS" downloaddir=C:\download

# set path-environment
RUN setx path "%installdir%;%installdir%\mpi;%path%"

# Switch to PowerShell
SHELL ["powershell", "-command"]

# download FDS
ADD $setupfile $downloaddir\

# change setup-suffix from exe to zip, expand archive, copy files, set open-mpi default threads, install hydra-service and remove downloaddir
RUN Get-ChildItem $env:downloaddir\*.exe | Rename-Item -NewName { $_.Name -replace '.exe','.zip' };`
	Expand-Archive -Force $env:downloaddir\*.zip $env:downloaddir;`
	Copy-Item -Path $env:downloaddir\firemodels\FDS*\bin -Destination $env:installdir -Recurse;`
	setx -m OMP_NUM_THREADS (Get-CIMInstance -Class 'CIM_Processor').NumberOfCores;`
	hydra_service -install;`
	Remove-Item –path $env:downloaddir -recurse;

# set workdir for fds-simulation
WORKDIR C:\workdir
  • Open PowerShell or CMD and navigate to the folder of your dockerfile.
  • Build your FDS-Docker-Image by running: docker build -t fds:6.7.3 .
    • This will execute each line of your dockerfile. Unfortunately it's still necessary to implement the comparatively big image of Windows Server Core (around 2GB of data). But this is only done once. Every following image consuming Windows Server Core will reuse this data. Microsoft is still working on smaller versions. In the world of Linux the smallest Linux-image only takes several megabytes.
    • To install FDS inside this image, the orginal installation file of FDS will be downloaded and extracted automatically. Even the path-environment inside the image will be updated during this process.
    • As long as the location of the bin folder inside the installation file hasn't moved, this dockerfile should be compatible with minor versions of FDS. Just replace the setupfile-url inside the dockerfile or overwrite this argument by providing the corresponding parameter at buildtime: docker build --build-arg setupfile=https://github.com/firemodels/fds/releases/download/FDS6.7.1/FDS6.7.1-SMV6.7.5_win64.exe -t fds:6.7.1 .

Usage

  • Inside PowerShell navigate to a project folder (containing a fds-input file)

Interactive mode

  • To run a container of your FDS-image type: docker run --rm -it -v ${pwd}:C:\workdir fds:6.7.3
    • --rm will automatically remove the container when it exits
    • -it instructs Docker to allocate a pseudo shell
    • -v ${pwd}:C:\workdir mounts the current working directory into the container
  • The PowerShell should have been switched to your running FDS-Container and its working-dir C:\workdir
  • Type dir to list all files of your project folder.
  • To run fds just type fds <name-of-your-inputfile>.fds
  • To close your container type exit after the simulation has finished

Non-Interactive mode

  • If you like to run your FDS-Job directly inside your container with one command type: docker run --rm -v ${pwd}:C:\workdir fds:6.7.3 fds <name-of-your-inputfile>.fds
    • Do not use -it paramter
    • The container should be closed automatically after the job has finished

Basics

  • List active containers: docker ps -a
  • Stop container: docker stop <container-id or name>
  • Remove container: docker rm <container-id or name>
  • List images: docker images
  • Remove image: docker rmi <image-id or name>

Improvements

There are several technologies out there like

  • Docker Swarm (for natively managing a cluster of Docker Engines)
  • Kubernetes (container-orchestration for automating application deployment, scaling, and management)

Furthermore it is possible to Upload own Images (like the prior Dockerfile example) to Docker Hub so that everyone is able to install FDS via Docker automatically without creating an own Dockerfile. Docker Hub is a very large library and community for container images. The NIST could create their own free account and provide Docker images for FDS and CFAST. Different versions were selectable by different tags (seperated by image name through colon). To run an FDS-container users just had to type (depeding on preferred version):

  • docker run nist/fds:windows-6.7.3
  • docker run nist/fds:windows-6.7.1
  • docker run nist/fds:linux-6.7.3
  • docker run nist/fds:linux-6.7.1
  • ...

Docker would search for a suitable already installed image locally and start the container if an image was found. Otherwise it searches on Docker Hub, downloads the image automatically and runs the container afterwards.

Questions

  • At the moment the NIST neither have a Docker Hub account nor providing such images. I (or hopefully my company) could provide some images on Docker Hub without giving any warranty and support as long as NIST doesn't provide own images. Users would have to use these images on own risk. Am I allowed to provide FDS and CFAST images? Do I have to consider some (license?-) agreements or other things?
  • Are there any plans at NIST providing own docker images on Docker Hub in future? I think this would be the best way.

rweisse avatar Jan 07 '20 09:01 rweisse

Nice work Robert, Previously there was another user who proposed the usage for Vagrant here. I think the only challenge with these tools is keeping maintaining them on every each release. In my opinion, it would be best to have it as a third party, check the lists here .

sbenkorichi avatar Jan 07 '20 09:01 sbenkorichi

we don't have plans now to provide docker images. we would like to keep the process of distributing fds and smokeview as simple as we can. I'll take a look at docker though.

feel free to post your own docker images. you don't need our permission to do this. let us know when you do this. we should be able to put some link to it on one of our web pages or wikis.

note, even though the version of smokeview may be different in the latest versions of fds and cfast we distribute, you can use the smokeview installer to make the version the same when using fds or cfast. (let me know if you find this not to be the case)

On Tue, Jan 7, 2020 at 4:15 AM Robert Weiße [email protected] wrote:

I'm submitting a...

[ ] Regression

[ ] Bug report

[x] Feature request

[ ] Documentation issue or request

[ ] Support request

[x] Question (scroll down to bottom!)

Current behavior

In our company we have many computers running fds. Some of them are windows-, others are linux-workstations. At the moment it is a little bit annoying to update FDS on each PC. I have to download the corresponding installation file, uncompress it, manipulate the install script and deploy everything as a package by our software-deployment-system. Furthermore I have to do the same with CFAST. Both, FDS and CFAST, are bundled together with Smokeview. These bundles are often holding different versions of Smokeview. Sometimes we have to use older versions of FDS (depending on projects age). Installing multiple FDS versions on one system can be tricky. Expected behavior

FDS should be installable by a single command via Linux terminal or Windows PowerShell. It should run inside its own (Windows/Linux)-container and it should be possible to run and install multiple containers together on one machine. Furthermore it should be possible to start simulations simultaneously. All these applies to CFAST too. Smokeview should not be part of the container (there is no container user interface). Instead it should be installable by a single executable (like now - no change). What is the motivation / use case for changing the behavior?

Installation becomes very easy. Even the deployment of FDS and CFAST becomes less complex. Solution/Environment

The solution is very simple. Docker https://en.wikipedia.org/wiki/Docker_(software) might be the best technology to conquer this challenge. I have already invested some time and developed a small dockerfile for FSD 6.7.3 (Windows 10 Pro / Windows Server 2016). In principle it is possible to run the fds container inside a virtual machine (hyper-v/virtualbox). But this might waste to much cpu performance. That's why I recommand to run the container on windows together with the parameter --isolation=process or to update the local Docker deamon configuration file to enable this parameter by default:

{

"registry-mirrors": [],

"insecure-registries": [],

"debug": true,

"exec-opts": [

"isolation=process"

],

"experimental": false

}

This parameter insures that fds-threads are running directly on the host-OS and not inside a virtual machine. Installation Tutorial

  • Download and install Docker: https://hub.docker.com/editions/community/docker-ce-desktop-windows
  • Open a text editor of your choice, paste the following code , save and name it as Dockerfile (without suffix)

escape=`

Windows Server Core Image

FROM mcr.microsoft.com/windows/servercore:ltsc2019

provide setup-file

ARG setupfile=https://github.com/firemodels/fds/releases/download/FDS6.7.3/FDS6.7.3-SMV6.7.10_win64.exe

set install- and downloaddir

ENV installdir="C:\Program Files\firemodels\FDS" downloaddir=C:\download

set path-environment

RUN setx path "%installdir%;%installdir%\mpi;%path%"

Switch to PowerShell

SHELL ["powershell", "-command"]

download FDS

ADD $setupfile $downloaddir\

change setup-suffix from exe to zip, expand archive, copy files, set open-mpi default threads, install hydra-service and remove downloaddir

RUN Get-ChildItem $env:downloaddir*.exe | Rename-Item -NewName { $_.Name -replace '.exe','.zip' };`

Expand-Archive -Force $env:downloaddir*.zip $env:downloaddir;`

Copy-Item -Path $env:downloaddir\firemodels\FDS*\bin -Destination $env:installdir -Recurse;`

setx -m OMP_NUM_THREADS (Get-CIMInstance -Class 'CIM_Processor').NumberOfCores;`

hydra_service -install;`

Remove-Item –path $env:downloaddir -recurse;

set workdir for fds-simulation

WORKDIR C:\workdir

  • Open PowerShell or CMD and navigate to the folder of your dockerfile.
  • Build your FDS-Docker-Image by running: docker build -t fds:6.7.3 .
    • This will execute each line of your dockerfile. Unfortunately it's still necessary to implement the comparatively big image of Windows Server Core (around 2GB of data). But this is only done once. Every following image consuming Windows Server Core will reuse this data. Microsoft is still working on smaller versions. In the world of Linux the smallest Linux-image only takes several megabytes.
    • To install FDS inside this image, the orginal installation file of FDS will be downloaded and extracted automatically. Even the path-environment inside the image will be updated during this process.
    • As long as the location of the bin folder inside the installation file hasn't moved, this dockerfile should be compatible with minor versions of FDS. Just replace the setupfile-url inside the dockerfile or overwrite this argument by providing the corresponding parameter at buildtime: docker build --build-arg setupfile= https://github.com/firemodels/fds/releases/download/FDS6.7.1/FDS6.7.1-SMV6.7.5_win64.exe -t fds:6.7.1 .
    • If you haven't set your isolation-mode to process by default you may wish to add --isolation=process parameter to docker build command to disable virtualization. This will only work on Windows 10 Professional (not Home) and Windows Server 2016.

Usage

  • Inside PowerShell navigate to a project folder (containing a fds-input file)

Interactive mode

  • To run a container of your FDS-image type: docker run --rm -it -v ${pwd}:C:\workdir fds:6.7.3
    • --rm will automatically remove the container when it exits
    • -it instructs Docker to allocate a pseudo shell
    • -v ${pwd}:C:\workdir mounts the current working directory into the container
  • The PowerShell should have been switched to your running FDS-Container and its working-dir C:\workdir
  • Type dir to list all files of your project folder.
  • To run fds just type fds .fds
  • To close your container type exit after the simulation has finished

Non-Interactive mode

  • If you like to run your FDS-Job directly inside your container with one command type: docker run --rm -v ${pwd}:C:\workdir fds:6.7.3 fds .fds
    • Do not use -it paramter
    • The container should be closed automatically after the job has finished

Basics

  • List active containers: docker ps -a
  • Stop container: docker stop
  • Remove container: docker rm
  • List images: docker images
  • Remove image: docker rmi

Improvements

There are several technologies out there like

  • Docker Swarm (for natively managing a cluster of Docker Engines)
  • Kubernetes (container-orchestration for automating application deployment, scaling, and management)

Furthermore it is possible to Upload own Images (like the prior Dockerfile example) to Docker Hub https://hub.docker.com/ so that everyone is able to install FDS via Docker automatically without creating an own Dockerfile. Docker Hub is a very large library and community for container images. The NIST could create their own free account and provide Docker images for FDS and CFAST. Different versions were selectable by different tags (seperated by image name through colon). To run an FDS-container users just had to type (depeding on preferred version):

  • docker run nist/fds:windows-6.7.3
  • docker run nist/fds:windows-6.7.1
  • docker run nist/fds:linux-6.7.3
  • docker run nist/fds:linux-6.7.1
  • ...

Docker would search for a suitable already installed image locally and start the container if an image was found. Otherwise it searches on Docker Hub, downloads the image automatically and runs the container afterwards. Questions

  • At the moment the NIST neither have a Docker Hub account nor providing such images. I (or hopefully my company) could provide some images on Docker Hub without giving any warranty and support as long as NIST doesn't provide own images. Users would have to use these images on own risk. Am I allowed to provide FDS and CFAST images? Do I have to consider some (license?-) agreements or other things?
  • Are there any plans at NIST providing own docker images on Docker Hub in future? I think this would be the best way.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/firemodels/fds/issues/7885?email_source=notifications&email_token=AC6UCRQL3NPLYDC2LZ2EYG3Q4RB33A5CNFSM4KDVKP32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IEN3RRA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6UCRUPHJQ34KJDLIJIKB3Q4RB33ANCNFSM4KDVKP3Q .

-- Glenn Forney

gforney avatar Jan 07 '20 14:01 gforney

Thank you very much for your answers! At the moment I am creating a Docker Hub account for my employer where I will publish working images. As soon as I have finished the images for Linux and Windows for the last FDS version I will make the repository public and publish this link in my next comment. I appreciate linking it on your page or wiki very much. Feel free to close this issue now or wait for my next response.

rweisse avatar Jan 07 '20 14:01 rweisse

It took some time but finally I managed to do it :) I have published the precompiled docker images on Docker Hub for the last five FDS versions from version 6.5.3 up to 6.7.3 (each one for Windows and Linux).

This is the link: https://hub.docker.com/r/openbcl/fds

Running docker run --rm openbcl/fds fds in your commandline will automatically download and run the latest FDS-docker-image for your hosts operating system. You will get much more details and a how to at Docker Hub. There you will find the link to our GitHub repository too. This repo provides the source code of the corresponding dockerfiles to build/compile your own version of a FDS-docker-image if you like to do so.

I appreciate linking FDS+Docker on your page or wiki very much (maybe together with our company name?: "Brandschutz Consult Ingenieurgesellschaft mbH Leipzig").

Kind regards, Robert

rweisse avatar Jan 21 '20 15:01 rweisse

I added your info to our third part web page. Take a look and let me know if it looks ok.

https://github.com/firemodels/fds/wiki/Third-Party-Tools

On Tue, Jan 21, 2020 at 10:42 AM Robert Weiße [email protected] wrote:

It took some time but finally I managed to do it :) I have published the precompiled docker images on Docker Hub for the last five FDS versions from version 6.5.3 up to 6.7.3 (each one for Windows and Linux).

This is the link: https://hub.docker.com/r/openbcl/fds

Running docker run --rm openbcl/fds fds in your commandline will automatically download and run the latest FDS-docker-image for your hosts operating system. You will get much more details and a how to at Docker Hub. There you will find the link to our GitHub repository too. This repo provides the source code of the corresponding dockerfiles to build/compile your own version of a FDS-docker-image if you like to do so.

I appreciate linking FDS+Docker on your page or wiki very much (maybe together with our company name?: "Brandschutz Consult Ingenieurgesellschaft mbH Leipzig").

Kind regards, Robert

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/firemodels/fds/issues/7885?email_source=notifications&email_token=AC6UCRWAMGJMLPHMU5545N3Q64JX5A5CNFSM4KDVKP32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJQGAPQ#issuecomment-576741438, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6UCRS454GMV5H3XVDDDIDQ64JX5ANCNFSM4KDVKP3Q .

-- Glenn Forney

gforney avatar Jan 21 '20 16:01 gforney

This looks perfect - thank you!

rweisse avatar Jan 21 '20 16:01 rweisse

@rweisse I think it would be fine for you to advertise this to the discussion forum. Thanks

rmcdermo avatar Jan 21 '20 20:01 rmcdermo