molovol / MoloVol

MoloVol is a free, cross-plattform, scientific software for volume and surface computations of single molecules and crystallographic unit cells.
https://molovol.com
MIT License
22 stars 4 forks source link

Dockerfiles for REST-API for calculation back-end #109

Closed BSVogler closed 2 years ago

BSVogler commented 2 years ago

By containerizing the software and adding a webserver via python flask it enables the easy installation on any system and enables a REST-API for the calculation backend e.g. for using a web-interface.

A demo is running on my NAS (available from 08:45-24:00 MEZ). Because it is an armv32v7 I added a build file for this architecture. It is hosted on dockerhub.

The webserver can be omitted by building using the headless.Dockerfile. Query parameters are forwarded into the wxwidget provided CLI arguments.

Build and running via docker or podman podman build . then run with podman run -dt -p 5001:5000/tcp <image>

use any REST client to POST

http://127.0.0.1:5001/?cli-arguments=--version with Header Accept application/json

Return

{
  "output": "Version: 1.0.0\n"
}

e.g. http://127.0.0.1:5001/?cli-arguments=-r 1.2 -g 0.2 -fs /inputfile/probetest_triplet.xyz -q -o time,vol

Return:

{
  "output": "903: Elements file import failed. Calculation aborted.\n"
}

Example arguments taken from this ticket, but this may be outdated: https://github.com/molovol/MoloVol/wiki/Command-Line-Interface

Calling GET on this endpoints will return the HTML form (not working yet)

Open issue:

I can host a version as a demo in the following days.

BSVogler commented 2 years ago

I pushed an x86 image to docker hub so it can be installed by running docker pull bsvogler/molovol

I must note that the build is platform dependent and does not run on arm. There are currently problems with the ARM build. I added the WIP docker file as well. AFAIK there are no binaries of wxwidgets. Compiling takes more than 2h on my machine. It currently fails afterwards because a rust compiler is missing but needed.

BSVogler commented 2 years ago

I wrote a blogpost about the technical part: https://blog.benediktsvogler.com/blog/how-to-deploy-containers-on-a-qnap-nas