-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize indicator runners #1968
Comments
Good idea! Started thinking a little about this (using some tips from this blog), here's something for the hhs indicator to get started (chose it because I don't think it requires extra credentials). The lint command worked, the indicator started, but I didn't see it through to the end: # covidcast-indicators/hhs_hosp/Dockerfile
FROM python:3.8.19-slim-bookworm
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
RUN apt-get update
RUN apt-get install -y make git
COPY . /usr/src/app
RUN make install # covidcast-indicators/hhs_hosp/.dockerignore
# Ignore bulky directories we bind-mount
cache
receiving
# Ignore local virtual environment
env
# EOF
# Commands to be run in the covidcast-indicators/hhs_hosp directory
docker build -f Dockerfile . -t delphi_hhs
docker run -it delphi_hhs make lint
docker run \
-it \
--mount type=bind,source="$(pwd)"/cache,target=/usr/src/app/cache \
--mount type=bind,source="$(pwd)"/receiving,target=/usr/src/app/receiving \
-e DELPHI_EPIDATA_KEY="$(echo $DELPHI_EPIDATA_KEY)" \
delphi_hhs env/bin/python -m delphi_hhs Next steps might be something like:
|
So, I have maybe a dumb patch of an idea that can temporarily make sure that indicators have up to date environments: A chronicle job that backs up the |
I was mistaken, we do actually make use of Using Jenkins (on a separate machine), we "build" environments and tar them up and then unzip those directory trees in the prod and staging machines. However, such environments are not intended to be moved, even to a different directory on the same machine. Perhaps it is good that we do not " $ less ~indicators/runtime/nchs_mortality/env/bin/activate | grep nchs_mortality
VIRTUAL_ENV="/mnt/data/jenkins/workspace/covidcast-indicators_prod/nchs_mortality/env" This approach has the "build once and then distribute" paradigm similar to Docker, but it unfortunately has these problems (and i am surprised we havent been bitten by them (yet?)). After consulting w/ @korlaxxalrok , he thinks that (but dont quote me on this!) Jenkins can be made to build virtual environments on the prod/staging servers or Jenkins could build Docker images in a similar way instead. He also suggested that we could get GH actions to do it, but voiced concerns about secrets being leaked from there (unless we are careful to use methods to mask variables in the logs). |
Following up to #1967, for consistency and reproducibility, we should "Dockerize" (or equivalent/similar) our indicator runtime environments. Though it will not be perfect, it will help us run the same code on different machines without having to worry about subtle differences in configurations or versioning of dependencies.
Our current installations essentially run on "bare hardware" (not even inside
venv
s, AFAICT) where different jobs may expect particular setups but instead actually be limited by each other's constraints. This will be a kind of paradigm shift in that our deployment processes and job scheduling/triggering will have to change.Somewhat related to cmu-delphi/delphi-epidata#1389 .
The text was updated successfully, but these errors were encountered: