From 458b0b0c92cc83758d73f845ccd24953ccd9be7f Mon Sep 17 00:00:00 2001 From: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> Date: Tue, 27 Feb 2024 17:44:27 +0000 Subject: [PATCH 1/3] Adds a Docker Compose manifest for testing NGINX proxy directives Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> --- test/docker-compose.yml | 19 ++++++++++++ test/src/nginx/etc/nginx/conf.d/default.conf | 21 +++++++++++++ test/src/nginx/etc/nginx/nginx.conf | 32 ++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 test/docker-compose.yml create mode 100644 test/src/nginx/etc/nginx/conf.d/default.conf create mode 100644 test/src/nginx/etc/nginx/nginx.conf diff --git a/test/docker-compose.yml b/test/docker-compose.yml new file mode 100644 index 0000000..2c16bc0 --- /dev/null +++ b/test/docker-compose.yml @@ -0,0 +1,19 @@ +--- +version: '3.4' + +services: + proxy: + image: public.ecr.aws/nginx/nginx:1.24 + container_name: proxy + volumes: + - ./src/nginx/etc/nginx/nginx.conf:/etc/nginx/nginx.conf + - ./src/nginx/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf + ports: + - "8080:80" + + vscode: + image: analytical-platform.service.justice.gov.uk/code:local + build: + context: ../ + dockerfile: Dockerfile + container_name: vscode diff --git a/test/src/nginx/etc/nginx/conf.d/default.conf b/test/src/nginx/etc/nginx/conf.d/default.conf new file mode 100644 index 0000000..23f3884 --- /dev/null +++ b/test/src/nginx/etc/nginx/conf.d/default.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name localhost; + + location / { + proxy_pass http://vscode:8080/; + proxy_http_version 1.1; + proxy_redirect off; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_set_header X-Real-IP $remote_addr; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/test/src/nginx/etc/nginx/nginx.conf b/test/src/nginx/etc/nginx/nginx.conf new file mode 100644 index 0000000..5e076aa --- /dev/null +++ b/test/src/nginx/etc/nginx/nginx.conf @@ -0,0 +1,32 @@ + +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} From 589a41882ff70646bf128c8b1784b3f05384ff73 Mon Sep 17 00:00:00 2001 From: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> Date: Wed, 28 Feb 2024 13:29:56 +0000 Subject: [PATCH 2/3] Bump Ubuntu Bump AWS Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 78d7bf8..e257f6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/ubuntu/ubuntu@sha256:98bdc90ad3fc207b7d0a60ce166b62d410c741d35b17b615404bc060b9da989f +FROM public.ecr.aws/ubuntu/ubuntu@sha256:722b3bddfe96b95441f626cf94974d79213090ecbd16954f71d7c080fb413561 LABEL org.opencontainers.image.vendor="Ministry of Justice" \ org.opencontainers.image.authors="Analytical Platform (analytical-platform@digital.justice.gov.uk)" \ @@ -12,7 +12,7 @@ ENV CONTAINER_USER="analyticalplatform" \ CONTAINER_GID="1000" \ DEBIAN_FRONTEND="noninteractive" \ VISUAL_STUDIO_CODE_VERSION="1.86.2-1707854558" \ - AWS_CLI_VERSION="2.15.21" \ + AWS_CLI_VERSION="2.15.23" \ MINICONDA_VERSION="23.11.0-2" \ MINICONDA_SHA265="35a58b8961e1187e7311b979968662c6223e86e1451191bed2e67a72b6bd0658" \ PATH="/opt/conda/bin:${PATH}" From 8784bdacc0c64789a643df1766d7380179cd9a75 Mon Sep 17 00:00:00 2001 From: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> Date: Wed, 28 Feb 2024 13:35:56 +0000 Subject: [PATCH 3/3] Remove NGINX testing Signed-off-by: Jacob Woffenden <jacob.woffenden@digital.justice.gov.uk> --- test/docker-compose.yml | 19 ------------ test/src/nginx/etc/nginx/conf.d/default.conf | 21 ------------- test/src/nginx/etc/nginx/nginx.conf | 32 -------------------- 3 files changed, 72 deletions(-) delete mode 100644 test/docker-compose.yml delete mode 100644 test/src/nginx/etc/nginx/conf.d/default.conf delete mode 100644 test/src/nginx/etc/nginx/nginx.conf diff --git a/test/docker-compose.yml b/test/docker-compose.yml deleted file mode 100644 index 2c16bc0..0000000 --- a/test/docker-compose.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -version: '3.4' - -services: - proxy: - image: public.ecr.aws/nginx/nginx:1.24 - container_name: proxy - volumes: - - ./src/nginx/etc/nginx/nginx.conf:/etc/nginx/nginx.conf - - ./src/nginx/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf - ports: - - "8080:80" - - vscode: - image: analytical-platform.service.justice.gov.uk/code:local - build: - context: ../ - dockerfile: Dockerfile - container_name: vscode diff --git a/test/src/nginx/etc/nginx/conf.d/default.conf b/test/src/nginx/etc/nginx/conf.d/default.conf deleted file mode 100644 index 23f3884..0000000 --- a/test/src/nginx/etc/nginx/conf.d/default.conf +++ /dev/null @@ -1,21 +0,0 @@ -server { - listen 80; - server_name localhost; - - location / { - proxy_pass http://vscode:8080/; - proxy_http_version 1.1; - proxy_redirect off; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-NginX-Proxy true; - proxy_set_header X-Real-IP $remote_addr; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} diff --git a/test/src/nginx/etc/nginx/nginx.conf b/test/src/nginx/etc/nginx/nginx.conf deleted file mode 100644 index 5e076aa..0000000 --- a/test/src/nginx/etc/nginx/nginx.conf +++ /dev/null @@ -1,32 +0,0 @@ - -user nginx; -worker_processes auto; - -error_log /var/log/nginx/error.log notice; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -}