From 5157aa0e1a2836456d16e5acb32901de97ee774e Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 11:39:53 -0700 Subject: [PATCH 01/19] Use nginx stable from dockerhub --- Dockerfile.web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.web b/Dockerfile.web index 88ad1eb07..72c8c890d 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -26,7 +26,7 @@ USER 1001 # PHASE 2 - prepare hosting. # https://catalog.redhat.com/software/containers/ubi8/nginx-120/6156abfac739c0a4123a86fd -FROM registry.access.redhat.com/ubi8/nginx-120 +FROM nginx:stable # Add application sources ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}" From 1163bf5bf91696f31984f9af1f5a630aed4ff185 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 11:44:20 -0700 Subject: [PATCH 02/19] Use alpine --- Dockerfile.web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.web b/Dockerfile.web index 72c8c890d..86b698488 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -26,7 +26,7 @@ USER 1001 # PHASE 2 - prepare hosting. # https://catalog.redhat.com/software/containers/ubi8/nginx-120/6156abfac739c0a4123a86fd -FROM nginx:stable +FROM nginx:stable-alpine # Add application sources ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}" From 410c5336510dc7dd061a4304d8035d76fc36cf9c Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 11:54:59 -0700 Subject: [PATCH 03/19] Update Dockerfile.web Co-authored-by: dgboss --- Dockerfile.web | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.web b/Dockerfile.web index 86b698488..3282aaa4c 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -25,7 +25,6 @@ RUN yarn run build:prod USER 1001 # PHASE 2 - prepare hosting. -# https://catalog.redhat.com/software/containers/ubi8/nginx-120/6156abfac739c0a4123a86fd FROM nginx:stable-alpine # Add application sources From bfd40fd3d7b6c369f84a4a2f27dc6f19344ae5c8 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:13:37 -0700 Subject: [PATCH 04/19] specific nginx conf path --- Dockerfile.web | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.web b/Dockerfile.web index 3282aaa4c..e20131b76 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -28,7 +28,7 @@ USER 1001 FROM nginx:stable-alpine # Add application sources -ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}" +ADD ./openshift/nginx.conf /etc/nginx/nginx.conf # Copy the static content: COPY --from=static /app/build . From da13e47f428228713da052e664b6ff92c3e7931b Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:14:34 -0700 Subject: [PATCH 05/19] docker.io prefix --- Dockerfile.web | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.web b/Dockerfile.web index e20131b76..7c2446262 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -6,7 +6,7 @@ ARG NODE_OPTIONS="--v8-pool-size=4" # PHASE 1 - build frontend. -FROM node:20-alpine AS static +FROM docker.io/library/node:20-alpine AS static # Switch to root user for package installs USER 0 WORKDIR /app @@ -25,7 +25,7 @@ RUN yarn run build:prod USER 1001 # PHASE 2 - prepare hosting. -FROM nginx:stable-alpine +FROM docker.io/library/nginx:stable-alpine # Add application sources ADD ./openshift/nginx.conf /etc/nginx/nginx.conf From 530481ecb3c65bed905952096d2efd314461fbb7 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:21:12 -0700 Subject: [PATCH 06/19] Change permissions --- Dockerfile.web | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile.web b/Dockerfile.web index 7c2446262..42beff07e 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -21,17 +21,25 @@ RUN corepack enable \ COPY web . RUN yarn run build:prod -# Switch back to default user -USER 1001 - # PHASE 2 - prepare hosting. FROM docker.io/library/nginx:stable-alpine +RUN chmod -R a+w /var/lib/nginx + +RUN chmod -R a+w /var/log/nginx + +RUN chmod -R a+w /var/run + +RUN chmod -R a+w /var/cache/nginx + # Add application sources -ADD ./openshift/nginx.conf /etc/nginx/nginx.conf +COPY ./openshift/nginx.conf /etc/nginx/nginx.conf # Copy the static content: COPY --from=static /app/build . +# Switch back to default user +USER 1001 + EXPOSE 3000 CMD nginx -g "daemon off;" \ No newline at end of file From b9cde0da55dce5560be7fa67f1965f5c3b706577 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:42:28 -0700 Subject: [PATCH 07/19] Try change client_temp path --- openshift/nginx.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index b4e293fda..09ee97b18 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -2,6 +2,9 @@ # * Official English Documentation: http://nginx.org/en/docs/ error_log /dev/stdout info; +# For openshift to have permissions +client_body_temp_path /tmp/nginx/client_temp + events { worker_connections 1024; } From 9a1f0120de42903b49f50f270c1771526d555b46 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:46:30 -0700 Subject: [PATCH 08/19] undo chmod commands --- Dockerfile.web | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Dockerfile.web b/Dockerfile.web index 42beff07e..56063e461 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -24,14 +24,6 @@ RUN yarn run build:prod # PHASE 2 - prepare hosting. FROM docker.io/library/nginx:stable-alpine -RUN chmod -R a+w /var/lib/nginx - -RUN chmod -R a+w /var/log/nginx - -RUN chmod -R a+w /var/run - -RUN chmod -R a+w /var/cache/nginx - # Add application sources COPY ./openshift/nginx.conf /etc/nginx/nginx.conf From 70a8cd4954c159c16673017d819b58c2bcee734f Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 12:55:43 -0700 Subject: [PATCH 09/19] move field --- openshift/nginx.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index 09ee97b18..0afa5c40c 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -2,8 +2,7 @@ # * Official English Documentation: http://nginx.org/en/docs/ error_log /dev/stdout info; -# For openshift to have permissions -client_body_temp_path /tmp/nginx/client_temp + events { worker_connections 1024; @@ -14,6 +13,9 @@ http { default_type application/octet-stream; access_log /dev/stdout; + # For openshift to have permissions + client_body_temp_path /tmp/nginx/client_temp + server { # listen on port 3000 listen 3000; From 34cbbe5bf47af92c96af4bdc29c308a4e197351e Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:00:40 -0700 Subject: [PATCH 10/19] added terminator --- openshift/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index 0afa5c40c..1c3b7aba1 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -14,7 +14,7 @@ http { access_log /dev/stdout; # For openshift to have permissions - client_body_temp_path /tmp/nginx/client_temp + client_body_temp_path /tmp/nginx/client_temp; server { # listen on port 3000 From c5329b225724104407470fb2013002e7040f34ac Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:12:32 -0700 Subject: [PATCH 11/19] update path --- Dockerfile.web | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile.web b/Dockerfile.web index 56063e461..e0b35c785 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -24,12 +24,15 @@ RUN yarn run build:prod # PHASE 2 - prepare hosting. FROM docker.io/library/nginx:stable-alpine -# Add application sources +# Copy application sources COPY ./openshift/nginx.conf /etc/nginx/nginx.conf # Copy the static content: COPY --from=static /app/build . +RUN mkdir -p /tmp/nginx/client_temp +RUN chmod -R 755 /tmp/nginx + # Switch back to default user USER 1001 From 4b7dc34e439f409f162a89a202ee0090e07b5627 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:25:10 -0700 Subject: [PATCH 12/19] update another --- Dockerfile.web | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile.web b/Dockerfile.web index e0b35c785..67088495f 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -33,6 +33,9 @@ COPY --from=static /app/build . RUN mkdir -p /tmp/nginx/client_temp RUN chmod -R 755 /tmp/nginx +RUN mkdir -p /var/cache/nginx/proxy_temp +RUN chmod -R 755 /var/cache/nginx/ + # Switch back to default user USER 1001 From 8b77716ac7ad3afec2c8358acc07f8a53c2da5b0 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:32:03 -0700 Subject: [PATCH 13/19] another one --- Dockerfile.web | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.web b/Dockerfile.web index 67088495f..89849e04c 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -34,6 +34,7 @@ RUN mkdir -p /tmp/nginx/client_temp RUN chmod -R 755 /tmp/nginx RUN mkdir -p /var/cache/nginx/proxy_temp +RUN mkdir -p /var/cache/nginx/fastcgi_temp RUN chmod -R 755 /var/cache/nginx/ # Switch back to default user From e7ac1a30fbe423d2222507b4b62883ae233a8349 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:41:20 -0700 Subject: [PATCH 14/19] another --- Dockerfile.web | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.web b/Dockerfile.web index 89849e04c..9eb8ccd67 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -35,6 +35,7 @@ RUN chmod -R 755 /tmp/nginx RUN mkdir -p /var/cache/nginx/proxy_temp RUN mkdir -p /var/cache/nginx/fastcgi_temp +RUN mkdir -p /var/cache/nginx/uwsgi_temp RUN chmod -R 755 /var/cache/nginx/ # Switch back to default user From d7f63120beddf4d8ff43b5c784c89c11fe995ca9 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:45:22 -0700 Subject: [PATCH 15/19] another --- Dockerfile.web | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.web b/Dockerfile.web index 9eb8ccd67..075a77060 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -36,6 +36,7 @@ RUN chmod -R 755 /tmp/nginx RUN mkdir -p /var/cache/nginx/proxy_temp RUN mkdir -p /var/cache/nginx/fastcgi_temp RUN mkdir -p /var/cache/nginx/uwsgi_temp +RUN mkdir -p /var/cache/nginx/scgi_temp RUN chmod -R 755 /var/cache/nginx/ # Switch back to default user From cf69ed99e32fdcdc40b3ef5088dd220c38feecf5 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:50:06 -0700 Subject: [PATCH 16/19] another --- Dockerfile.web | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.web b/Dockerfile.web index 075a77060..3347c4f77 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -38,6 +38,7 @@ RUN mkdir -p /var/cache/nginx/fastcgi_temp RUN mkdir -p /var/cache/nginx/uwsgi_temp RUN mkdir -p /var/cache/nginx/scgi_temp RUN chmod -R 755 /var/cache/nginx/ +RUN chmod -R 755 /var/run # Switch back to default user USER 1001 From 624715cc5ec60b5f81e161677b2efbf2dfa9bcbb Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 13:59:52 -0700 Subject: [PATCH 17/19] pid --- openshift/nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index 1c3b7aba1..7d1c7f301 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -2,7 +2,8 @@ # * Official English Documentation: http://nginx.org/en/docs/ error_log /dev/stdout info; - +# For openshift permissions +pid /tmp/nginx.pid; events { worker_connections 1024; From 72769eded1baa10afd9c15dca7a7d20a5a0e5527 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 14:13:30 -0700 Subject: [PATCH 18/19] set and index file --- openshift/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index 7d1c7f301..36f578ca0 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -21,6 +21,7 @@ http { # listen on port 3000 listen 3000; root /opt/app-root/src; + index /index.html gzip on; # By default, NGINX compresses responses only with MIME type text/html. From 7855706f95d43a12d03942ddfc287dd4002b874e Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Tue, 22 Oct 2024 14:28:17 -0700 Subject: [PATCH 19/19] update paths --- openshift/nginx.conf | 4 ++-- openshift/templates/deploy.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openshift/nginx.conf b/openshift/nginx.conf index 36f578ca0..8498f220b 100644 --- a/openshift/nginx.conf +++ b/openshift/nginx.conf @@ -20,8 +20,8 @@ http { server { # listen on port 3000 listen 3000; - root /opt/app-root/src; - index /index.html + root /; + index index.html gzip on; # By default, NGINX compresses responses only with MIME type text/html. diff --git a/openshift/templates/deploy.yaml b/openshift/templates/deploy.yaml index 3adb9a034..3a8d0d1e6 100644 --- a/openshift/templates/deploy.yaml +++ b/openshift/templates/deploy.yaml @@ -154,7 +154,7 @@ objects: timeoutSeconds: 1 volumeMounts: - name: config-env - mountPath: "/opt/app-root/src/config.js" + mountPath: "/config.js" subPath: gold.config.js ############################################################################# # API container