From 09ea961fc496d8034548d8a6e4649688512f25c9 Mon Sep 17 00:00:00 2001 From: Aron Asor Date: Sun, 22 Oct 2023 16:16:20 -0700 Subject: [PATCH 1/3] refactor: move sigil download logic to a separate script Docker is having trouble parsing complex env var substitution, so we move that logic to a full fledged script. --- k8s/images/nginx/Dockerfile | 9 +++++---- k8s/images/nginx/download_sigil.sh | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100755 k8s/images/nginx/download_sigil.sh diff --git a/k8s/images/nginx/Dockerfile b/k8s/images/nginx/Dockerfile index 378d964e19..da4de60fae 100644 --- a/k8s/images/nginx/Dockerfile +++ b/k8s/images/nginx/Dockerfile @@ -1,9 +1,10 @@ FROM byrnedo/alpine-curl # download all extra deps we need for the production container - # templating executable -RUN curl -L "https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_$(uname -sm|tr \ _).tgz" \ | tar -zxC /usr/bin +COPY /k8s/images/nginx/download_sigil.sh /tmp/download_sigil.sh +RUN chmod +x /tmp/download_sigil.sh +RUN /tmp/download_sigil.sh FROM nginx:1.11 @@ -12,6 +13,6 @@ ADD deploy/nginx.conf.jinja2 /etc/nginx/nginx.conf.jinja2 ADD k8s/images/nginx/entrypoint.sh /usr/bin # install the templating binary -COPY --from=0 /usr/bin/sigil /usr/bin +COPY --from=0 /tmp/sigil /usr/bin -CMD entrypoint.sh \ No newline at end of file +CMD entrypoint.sh diff --git a/k8s/images/nginx/download_sigil.sh b/k8s/images/nginx/download_sigil.sh new file mode 100755 index 0000000000..d5b8e05e90 --- /dev/null +++ b/k8s/images/nginx/download_sigil.sh @@ -0,0 +1,8 @@ +#!/bin/sh +export SIGIL_VERSION=0.10.1 +export OS=`sh -c "uname -s | tr '[:upper:]' '[:lower:]'"` +export ARCH=`sh -c "uname -m | tr '[:upper:]' '[:lower:]' | sed 's/aarch64/arm64/'"` + + +curl -L "https://github.com/gliderlabs/sigil/releases/download/v${SIGIL_VERSION}/gliderlabs-sigil_${SIGIL_VERSION}_${OS}_${ARCH}.tgz" | tar -zxC /tmp +mv /tmp/gliderlabs-sigil-${ARCH} /tmp/sigil From f61442e37bb7d4341c628b3905f344b8a0f8d225 Mon Sep 17 00:00:00 2001 From: Aron Asor Date: Fri, 10 Nov 2023 14:48:45 -0800 Subject: [PATCH 2/3] fix: increase timeout on reading upstream studio server responses Fixes https://github.com/learningequality/infrastructure/issues/452 --- deploy/nginx.conf.jinja2 | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/nginx.conf.jinja2 b/deploy/nginx.conf.jinja2 index c762a077b3..9f8aed7e7a 100644 --- a/deploy/nginx.conf.jinja2 +++ b/deploy/nginx.conf.jinja2 @@ -82,6 +82,7 @@ http { proxy_pass http://studio; proxy_redirect off; proxy_set_header Host $host; + proxy_read_timeout 100s; } location /content/ { From 6ccb9a930838e8a32e9d4e96845e98c18aa535d1 Mon Sep 17 00:00:00 2001 From: Aron Asor Date: Thu, 16 Nov 2023 21:25:03 -0800 Subject: [PATCH 3/3] chore: upgrade nginx to 1.25 That's the latest stable version as of this writing --- k8s/images/nginx/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/images/nginx/Dockerfile b/k8s/images/nginx/Dockerfile index da4de60fae..d0f41afaa5 100644 --- a/k8s/images/nginx/Dockerfile +++ b/k8s/images/nginx/Dockerfile @@ -6,13 +6,13 @@ COPY /k8s/images/nginx/download_sigil.sh /tmp/download_sigil.sh RUN chmod +x /tmp/download_sigil.sh RUN /tmp/download_sigil.sh -FROM nginx:1.11 +FROM nginx:1.25 RUN rm /etc/nginx/conf.d/* # if there's stuff here, nginx won't read sites-enabled ADD deploy/nginx.conf.jinja2 /etc/nginx/nginx.conf.jinja2 ADD k8s/images/nginx/entrypoint.sh /usr/bin # install the templating binary -COPY --from=0 /tmp/sigil /usr/bin +COPY --from=0 /tmp/sigil /usr/bin/ CMD entrypoint.sh