-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement pre-installed QE components for demo server (#402)
A new image is brought into the stack which includes the pre-installed Quantum ESPRESSO from conda forge to be run from localhost. The dependencies are installed from Dockerfile while the `aiidalab-qe` need to be installed the first time container started since the app should be installed in the user home which only created after the container started. Similar for the QE from conda forge, the Dockerfile creates the virtual env and installs the QE to the system folder and when the container started the first time it is copied to the user's home if the folder not existed. This image is designed as the image for the AiiDAlab demo server in the materials cloud so that new users can have a quick taste of AiiDAlab and run simulations with QeApp.
- Loading branch information
Showing
14 changed files
with
148 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
version: '3.4' | ||
|
||
services: | ||
|
||
aiidalab: | ||
image: ${REGISTRY:-}${QE_IMAGE:-aiidalab/qe}:${VERSION:-newly-bulid} | ||
environment: | ||
TZ: Europe/Zurich | ||
DOCKER_STACKS_JUPYTER_CMD: notebook | ||
SETUP_DEFAULT_AIIDA_PROFILE: 'true' | ||
AIIDALAB_DEFAULT_APPS: '' | ||
volumes: | ||
- aiidalab-home-folder:/home/jovyan | ||
ports: | ||
- "0.0.0.0:${AIIDALAB_PORT:-}:8888" | ||
|
||
volumes: | ||
aiidalab-home-folder: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM full-stack | ||
|
||
USER root | ||
|
||
USER ${NB_USER} | ||
|
||
# Install the quantum-espresso app. | ||
ARG AIIDALAB_QE_VERSION | ||
ENV AIIDALAB_QE_VERSION ${AIIDALAB_QE_VERSION} | ||
|
||
# Install aiidalab-qe, which actually for all the dependencies. | ||
# so that it will be fairly fast when container is started. | ||
RUN git clone https://github.com/aiidalab/aiidalab-qe && \ | ||
cd aiidalab-qe && \ | ||
git checkout v${AIIDALAB_QE_VERSION} && \ | ||
pip install --quiet --no-cache-dir "./" && \ | ||
fix-permissions "./" && \ | ||
fix-permissions "${CONDA_DIR}" && \ | ||
fix-permissions "/home/${NB_USER}" | ||
|
||
ARG QE_VERSION | ||
ENV QE_VERSION ${QE_VERSION} | ||
RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \ | ||
qe=${QE_VERSION} \ | ||
&& mamba clean --all -f -y && \ | ||
fix-permissions "${CONDA_DIR}" && \ | ||
fix-permissions "/home/${NB_USER}" | ||
|
||
COPY before-notebook.d/* /usr/local/bin/before-notebook.d/ | ||
|
||
WORKDIR "/home/${NB_USER}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -e | ||
|
||
# Debugging. | ||
set -x | ||
|
||
# Copy quantum espresso env to user space. | ||
mkdir -p /home/${NB_USER}/.conda/envs | ||
if [ ! -d /home/${NB_USER}/.conda/envs/quantum-espresso-${QE_VERSION} ]; then | ||
ln -s /opt/conda/envs/quantum-espresso /home/${NB_USER}/.conda/envs/quantum-espresso-${QE_VERSION} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
# Debugging. | ||
set -x | ||
|
||
# Install qeapp if it is not already installed. | ||
if aiidalab list | grep -q quantum-espresso; then | ||
echo "Quantum ESPRESSO app is already installed." | ||
else | ||
echo "Installing Quantum ESPRESSO app." | ||
aiidalab install --yes quantum-espresso==${AIIDALAB_QE_VERSION} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def test_pw_executable_exist(aiidalab_exec, qe_version): | ||
"""Test that pw.x executable exists in the conda environment""" | ||
output = ( | ||
aiidalab_exec(f"mamba run -n quantum-espresso-{qe_version} which pw.x") | ||
.decode() | ||
.strip() | ||
) | ||
|
||
assert output == f"/home/jovyan/.conda/envs/quantum-espresso-{qe_version}/bin/pw.x" |