From d1549271d144522453a59a222d7eec1bf9a3560a Mon Sep 17 00:00:00 2001 From: Josh Horton Date: Thu, 11 Apr 2024 17:52:52 +0100 Subject: [PATCH 1/2] add dockerfile and bespokefit-server env --- .env.template | 6 +++ Dockerfile | 23 +++++++++++ compose.yml | 15 +++++++ devtools/conda-envs/bespokefit-server.yaml | 46 ++++++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 .env.template create mode 100644 Dockerfile create mode 100644 compose.yml create mode 100644 devtools/conda-envs/bespokefit-server.yaml diff --git a/.env.template b/.env.template new file mode 100644 index 00000000..4fc09ee3 --- /dev/null +++ b/.env.template @@ -0,0 +1,6 @@ +# The port the executor can be reached on +BEFLOW_GATEWAY_PORT= +# The password to the redis database only workers and the executor need this +BEFLOW_REDIS_PASSWORD= +# If ForceBalance tmp files should be kept? +BEFLOW_KEEP_TMP_FILES= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..de90580a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM mambaorg/micromamba:1.5.8 + +LABEL org.opencontainers.image.source=https://github.com/openforcefield/openff-bespokefit +LABEL org.opencontainers.image.description="Automated tools for the generation of bespoke SMIRNOFF format parameters for individual molecules." +LABEL org.opencontainers.image.licenses=MIT + +# Don't buffer stdout & stderr streams, so if there is a crash no partial buffer output is lost +# https://docs.python.org/3/using/cmdline.html#cmdoption-u +ENV PYTHONUNBUFFERED=1 + +COPY --chown=$MAMBA_USER:$MAMBA_USER devtools/conda-envs/bespokefit-server.yaml /tmp/env.yaml +COPY --chown=$MAMBA_USER:$MAMBA_USER openff /tmp/openff +RUN micromamba install -y -n base git -f /tmp/env.yaml && \ + micromamba clean --all --yes + +# Ensure that conda environment is automatically activated +# https://github.com/mamba-org/micromamba-docker#running-commands-in-dockerfile-within-the-conda-environment +ARG MAMBA_DOCKERFILE_ACTIVATE=1 +RUN python -m pip install --no-deps -e . + +WORKDIR /home/mambauser +RUN mkdir /home/mambauser/.OpenEye +ENV OE_LICENSE=/home/mambauser/.OpenEye/oe_license.txt diff --git a/compose.yml b/compose.yml new file mode 100644 index 00000000..62361e73 --- /dev/null +++ b/compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + falcbot: + command: openff-bespoke executor launch --launch-redis --n-optimizer-workers 0 --n-qc-compute-workers 0 --n-fragmenter-workers 0 --directory bespoke-executor + build: . + container_name: "bepokefit-server" + ports: + - 80:8000 + volumes: + - type: bind + source: $HOME/.OpenEye/ + target: /home/mambauser/.OpenEye/ + env_file: + - .env \ No newline at end of file diff --git a/devtools/conda-envs/bespokefit-server.yaml b/devtools/conda-envs/bespokefit-server.yaml new file mode 100644 index 00000000..a66923c5 --- /dev/null +++ b/devtools/conda-envs/bespokefit-server.yaml @@ -0,0 +1,46 @@ +name: bespokefit-server + +channels: + - openeye + - conda-forge + +dependencies: + + # Base depends + - python + - pip + + ### Core dependencies. + + - numpy + - pydantic + - pyyaml + - tqdm + - rich + - click + - click-option-group + - rdkit + - openff-utilities + - openff-toolkit-base =0.15 + - openff-interchange # only needed because openff-toolkit-base + - openff-units + - openff-qcsubmit >=0.50 + + # Optional + - openff-fragmenter-base + - openeye-toolkits + + ### Bespoke dependencies + + - qcportal ==0.53 + - qcelemental + - chemper + + # Executor + - uvicorn + - fastapi + - starlette + - celery + - httpx + - redis-server + - redis-py \ No newline at end of file From e7e25d9e162828ce46e3d5d9289cc82f1d87a4bf Mon Sep 17 00:00:00 2001 From: Josh Horton Date: Mon, 15 Apr 2024 11:50:01 +0100 Subject: [PATCH 2/2] update for working deployment --- .env.template | 4 +++- Dockerfile | 3 ++- devtools/conda-envs/bespokefit-server.yaml | 9 ++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env.template b/.env.template index 4fc09ee3..a271200c 100644 --- a/.env.template +++ b/.env.template @@ -3,4 +3,6 @@ BEFLOW_GATEWAY_PORT= # The password to the redis database only workers and the executor need this BEFLOW_REDIS_PASSWORD= # If ForceBalance tmp files should be kept? -BEFLOW_KEEP_TMP_FILES= \ No newline at end of file +BEFLOW_KEEP_TMP_FILES= +# bind to the local host to ensure the executor can reach redis +BEFLOW_REDIS_ADDRESS="0.0.0.0" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index de90580a..55bb803d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,7 @@ ENV PYTHONUNBUFFERED=1 COPY --chown=$MAMBA_USER:$MAMBA_USER devtools/conda-envs/bespokefit-server.yaml /tmp/env.yaml COPY --chown=$MAMBA_USER:$MAMBA_USER openff /tmp/openff +COPY --chown=$MAMBA_USER:$MAMBA_USER LICENSE README.md setup.cfg setup.py /tmp/ RUN micromamba install -y -n base git -f /tmp/env.yaml && \ micromamba clean --all --yes @@ -20,4 +21,4 @@ RUN python -m pip install --no-deps -e . WORKDIR /home/mambauser RUN mkdir /home/mambauser/.OpenEye -ENV OE_LICENSE=/home/mambauser/.OpenEye/oe_license.txt +ENV OE_LICENSE=/home/mambauser/.OpenEye/oe_license.txt \ No newline at end of file diff --git a/devtools/conda-envs/bespokefit-server.yaml b/devtools/conda-envs/bespokefit-server.yaml index a66923c5..e99b6d06 100644 --- a/devtools/conda-envs/bespokefit-server.yaml +++ b/devtools/conda-envs/bespokefit-server.yaml @@ -13,7 +13,7 @@ dependencies: ### Core dependencies. - numpy - - pydantic + - pydantic >=1.10.8,<2.0.0a0 - pyyaml - tqdm - rich @@ -22,9 +22,9 @@ dependencies: - rdkit - openff-utilities - openff-toolkit-base =0.15 - - openff-interchange # only needed because openff-toolkit-base - openff-units - - openff-qcsubmit >=0.50 + - openff-qcsubmit + - versioneer # Optional - openff-fragmenter-base @@ -32,10 +32,9 @@ dependencies: ### Bespoke dependencies - - qcportal ==0.53 - qcelemental - chemper - + - qcengine # Executor - uvicorn - fastapi