ESGF / esgf-cwt

Activities of the ESGF Compute Working Team (CWT)
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

Get dev environment set up at CEDA #26

Open agstephens opened 1 year ago

agstephens commented 1 year ago

Creating a reproducible development environment

We want to create a simple development environment that developers can get up and running with in minutes.

The best option for that is Docker, because:

Which types of environment do we want to support?

We want a system that allows us to toggle various settings in the container that we are building:

  1. Install Slurm or not: include_slurm: True|False
  2. Build environment with "environment.yml" or "spec-list.txt": conda_mode: environment_file|spec_file
  3. Install "roocs" packages from PyPI or from GitHub in develop mode: roocs_mode: pypi|develop

How can we manage this?

It looks like we can use Docker Compose to provide a set of different configurations, e.g.:

https://docs.docker.com/compose/environment-variables/#using-the---env-file--option

Create multiple files, such as:

$ cat ./docker-configs/env.prod
TAG: 1.6
INCLUDE_SLURM: true
INSTALL_MODE: spec_file

$ cat ./docker-configs/env.dev
TAG: 1.6
INCLUDE_SLURM: false
INSTALL_MODE: environment_file

$ cat ./docker-compose.yml
version: '1'
services:
  web:
    images: "roocs/rook-prod:${TAG}"

Usage is:

$ docker compose --env-file ./docker-configs/env.dev up

The Dockerfile will need some conditional lines like this:

The env variables INSTALL_MODE ...comes in from the outside environment (file)...

RUN [ "${INSTALL_MODE}" == "environment_file" ]  && echo "conda install with env file" || echo "conda install spec file"
agstephens commented 1 year ago

@alaniwi and @cehbrecht: what are your thoughts on the above suggestion?

agstephens commented 1 year ago

Plan to set up ".devcontainer" for rook