-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mrc 5146 container gh actions #7
Conversation
docker/Dockerfile
Outdated
RUN git config --global --add safe.directory /orderly-root | ||
RUN echo ".packit" > /.gitignore | ||
RUN git config --global core.excludesFile "/.gitignore" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same issue as in outpack_server PR, gotta add this as a safe directory as it is not owned by us in the container, also the global gitignore means that the .packit where the workers are isnt tracked by git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!! just some minor commnets..
- Maybe the scripts can be one level higher above test? in a scripts folder for consitency
Also just a question... im gussiing in packet we just spin up the runner and worker right?
|
||
docker volume create orderly-root-volume | ||
|
||
docker run --rm -d --pull=missing \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: whats this one for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that one is for a couple things:
- you need a volume attached to a container to do anything with it so for us modifying the orderly repo, we could use this as the place to change things in the volume for testing
- to view how things change in the working directory (since workers will be running things and producing result files and metadata of the run) theres a helper script
docker/test/copy-orderly-root
that will copy the folder so we can see it easily - that script uses this container too
|
||
docker network create orderly.runner_network | ||
|
||
docker run --rm -d \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also wondering if redis is needed here? or maybe another script that dosent... as this will all be brought up with packet (which already brings up redis), thus will get conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do need redis here, but that's fine for testing this stuff. You will get a conflict if two containers bring up redis on the same port, but in practice it's not hard to deal with
docker/Dockerfile
Outdated
@@ -17,3 +19,15 @@ RUN install2.r --error remotes && \ | |||
|
|||
COPY . /src | |||
RUN R CMD INSTALL --install-tests /src && rm -rf /src | |||
|
|||
ENV ORDERLY_RUNNER_QUEUE_ID=orderly.runner | |||
ENV REDIS_CONTAINER_NAME=orderly.runner_redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this come from packet? or will this have another redis container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packit does not need a redis container, after addressing rich's comments, this will come from env args in docker run and so these variables will come from the packit deploy tool which makes sense
docker/Dockerfile
Outdated
@@ -17,3 +19,15 @@ RUN install2.r --error remotes && \ | |||
|
|||
COPY . /src | |||
RUN R CMD INSTALL --install-tests /src && rm -rf /src | |||
|
|||
ENV ORDERLY_RUNNER_QUEUE_ID=orderly.runner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a more informative name just to be safe ahha eg. orderly.runner.queueId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gone with orderly.runner.queue
for casing consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!! just some minor commnets..
- Maybe the scripts can be one level higher above test? in a scripts folder for consitency
Also just a question... im gussiing in packet we just spin up the runner and worker right?
docker/Dockerfile
Outdated
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
libcurl4-openssl-dev \ | ||
libssl-dev \ | ||
zlib1g-dev \ | ||
libhiredis-dev \ | ||
git \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can yo sort these alphabetically please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docker/Dockerfile
Outdated
@@ -17,3 +19,15 @@ RUN install2.r --error remotes && \ | |||
|
|||
COPY . /src | |||
RUN R CMD INSTALL --install-tests /src && rm -rf /src | |||
|
|||
ENV ORDERLY_RUNNER_QUEUE_ID=orderly.runner | |||
ENV REDIS_CONTAINER_NAME=orderly.runner_redis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this should be a default envvar in the image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
docker/test/clear-test
Outdated
set -x | ||
HERE=$(dirname $0) | ||
|
||
docker kill \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use docker rm -f
and you can avoid the repetition here
|
||
docker network create orderly.runner_network | ||
|
||
docker run --rm -d \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do need redis here, but that's fine for testing this stuff. You will get a conflict if two containers bring up redis on the same port, but in practice it's not hard to deal with
docker run --rm -d --pull=always \ | ||
--net=orderly.runner_network \ | ||
--name=orderly.runner_server \ | ||
--entrypoint="/usr/local/bin/orderly.runner.server" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--entrypoint="/usr/local/bin/orderly.runner.server" \ | |
--entrypoint="/usr/local/bin/orderly.runner.server" \ | |
--env=REDIS_CONTAINER_NAME=orderly.runner_redis \ |
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docker/test/run-test
Outdated
@@ -0,0 +1,41 @@ | |||
#!/usr/bin/env bash | |||
set -ex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -ex | |
set -exu |
Everywhere you want -e
you usually want -u
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I have addressed the comments but also done a bit of cleanup, all ive done that is extra is extract out certain variables you may want to change like container names, after approval I will also change it to pull image from main and merge it in so that we arent always pulling from this random branch. I will also remove triggers to the build and push workflow from this branch. Also I remember this ticket that I had to do involving replacing |
main_worker <- function(args = commandArgs(TRUE)) { | ||
dat <- parse_main_worker(args) | ||
|
||
# assumes ORDERLY_RUNNER_QUEUE_ID is set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this error informatively if not set?
# Create queue | ||
self$controller <- rrq::rrq_controller( | ||
queue_id %||% orderly_queue_id() | ||
queue_id %||% orderly_queue_id(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest erroring here or orderly_queue_id() here if not set? but we could explore that in another PR if you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should error in the main_worker
function because this is okay if we havent set the queue id, in fact we use that behaviour a lot in the tests, have made a ticket: https://mrc-ide.myjetbrains.com/youtrack/issue/mrc-5663/orderly.runner-worker-error-if-ORDERLYRUNNERQUEUEID-not-set
This turned into a longer PR than I had initially hoped for. This PR builds docker and pushes it dockerhub and github container registry. Main changes include:
.packit
REDIS_CONTAINER_NAME
env var so that we can connect to redis running in another container