From 0e183d0c64ceb250d61fdec9c99a7303295889d2 Mon Sep 17 00:00:00 2001 From: Harry Tung Date: Wed, 26 Jun 2024 15:25:03 -0700 Subject: [PATCH 1/2] Added launch script to start cluster automatically --- deploy/balena-k3s/bastion/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy/balena-k3s/bastion/Dockerfile b/deploy/balena-k3s/bastion/Dockerfile index 22aa6847..c4722e64 100644 --- a/deploy/balena-k3s/bastion/Dockerfile +++ b/deploy/balena-k3s/bastion/Dockerfile @@ -51,5 +51,11 @@ RUN arkade version && \ RUN mkdir -p /app/edge-endpoint COPY . /app/edge-endpoint +# Set environment variables for running cluster setup +ENV INFERENCE_FLAVOR="CPU" +ENV DEPLOYMENT_NAMESPACE="default" + +RUN chmod +x ./edge-endpoint/deploy/bin/cluster_setup.sh + ENTRYPOINT [] -CMD [ "tail" , "-f", "/dev/null" ] \ No newline at end of file +CMD ["/bin/sh", "-c", "./edge-endpoint/deploy/bin/cluster_setup.sh && tail -f /dev/null"] \ No newline at end of file From 779363936c75c971ee7be49ff6d35f6e0eeecea5 Mon Sep 17 00:00:00 2001 From: Harry Tung Date: Thu, 27 Jun 2024 11:29:16 -0700 Subject: [PATCH 2/2] Allowed different inference options (CPU or GPU) through env var --- deploy/balena-k3s/README.md | 5 ++++- deploy/balena-k3s/bastion/Dockerfile | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/deploy/balena-k3s/README.md b/deploy/balena-k3s/README.md index 54b907af..cdab9265 100644 --- a/deploy/balena-k3s/README.md +++ b/deploy/balena-k3s/README.md @@ -19,7 +19,10 @@ AWS_ACCESS_KEY_ID - so we can pull the edge-endpoint and gl-tritonserver images AWS_SECRET_ACCESS_KEY - needed along with AWS_ACCESS_KEY_ID ``` -Now, ssh into `bastion` and run the following: +Optionally you can also configure `EDGE_INFERENCE_FLAVOR` to use GPU instead. It will default to CPU if not set. + +Dockerfile will automatically run the following command as `bastion` launches so no need to run this anymore. + ```bash cd /app/edge-endpoint INFERENCE_FLAVOR="CPU" DEPLOYMENT_NAMESPACE="default" ./deploy/bin/cluster_setup.sh diff --git a/deploy/balena-k3s/bastion/Dockerfile b/deploy/balena-k3s/bastion/Dockerfile index c4722e64..99f1f5a5 100644 --- a/deploy/balena-k3s/bastion/Dockerfile +++ b/deploy/balena-k3s/bastion/Dockerfile @@ -51,8 +51,9 @@ RUN arkade version && \ RUN mkdir -p /app/edge-endpoint COPY . /app/edge-endpoint -# Set environment variables for running cluster setup -ENV INFERENCE_FLAVOR="CPU" +# Set environment variables for running cluster setup based on env var EDGE_INFERENCE_FLAVOR, defaults to CPU if not set +ARG INFERENCE_FLAVOR_ARG="CPU" +ENV INFERENCE_FLAVOR=${EDGE_INFERENCE_FLAVOR:-$INFERENCE_FLAVOR_ARG} ENV DEPLOYMENT_NAMESPACE="default" RUN chmod +x ./edge-endpoint/deploy/bin/cluster_setup.sh