From 722f7e09fbb4a70ef9913b8f9e1e0c08afba9c11 Mon Sep 17 00:00:00 2001 From: Greg Tyler Date: Fri, 17 Nov 2023 08:41:45 +0000 Subject: [PATCH] docs: add password for staging environment (#535) This will avoid the staging environment being indexed by search engines The username/password are published publicly on the PR because they're not secret --- .github/workflows/tag-staging.yml | 3 ++- Dockerfile | 1 + docker/htpasswd | 1 + docker/nginx.conf | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 docker/htpasswd diff --git a/.github/workflows/tag-staging.yml b/.github/workflows/tag-staging.yml index eb5fa878..eaadf89e 100644 --- a/.github/workflows/tag-staging.yml +++ b/.github/workflows/tag-staging.yml @@ -52,7 +52,8 @@ jobs: KUBE_CLUSTER: ${{ secrets.KUBE_CLUSTER }} - name: Update PR with success run: | - gh pr comment $PRNUM --body "🚀 Deploying to [staging environment](https://moj-frontend-staging.apps.live.cloud-platform.service.justice.gov.uk/)" + echo -e "🚀 Deploying to [staging environment](https://moj-frontend-staging.apps.live.cloud-platform.service.justice.gov.uk/)\n\n**Username:** \`staging\`, **Password:** \`moj\`" > comment.txt + gh pr comment $PRNUM --body-file comment.txt gh pr edit $PRNUM --remove-label "staging:request" gh pr edit $PRNUM --add-label "staging:active" env: diff --git a/Dockerfile b/Dockerfile index 052727a5..a4990e4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ FROM nginxinc/nginx-unprivileged:alpine AS nginx EXPOSE 3000 +COPY docker/htpasswd /etc/nginx/.htpasswd COPY docker/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/public /usr/share/nginx/html diff --git a/docker/htpasswd b/docker/htpasswd new file mode 100644 index 00000000..41302517 --- /dev/null +++ b/docker/htpasswd @@ -0,0 +1 @@ +staging:$apr1$aOnwYL2z$pC8FxfkQ8MQbYJ0ScqJv10 diff --git a/docker/nginx.conf b/docker/nginx.conf index fc85f27e..5ba4f178 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -7,6 +7,9 @@ server { location / { root /usr/share/nginx/html; index index.html index.htm; + + auth_basic "Staging site"; + auth_basic_user_file /etc/nginx/.htpasswd; } error_page 500 502 503 504 /50x.html;