From 26504ba3d74ce6c7e9b225fa1f8389b00ea608f1 Mon Sep 17 00:00:00 2001 From: garytaylor Date: Sun, 10 Sep 2023 21:30:29 +0100 Subject: [PATCH 1/5] (ben-test) PR for testing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 023fda35f..a83daa7e5 100644 --- a/README.md +++ b/README.md @@ -106,4 +106,4 @@ MAINTENANCE_ENABLED - Set to 'true' to enable maintenance page to be enabled Any of the environment variables below can be added if you want to customize from the defaults MAINTENANCE_ALLOWED_IPS -MAINTENANCE_END - If added you will see "You will be able to use the service from " followed by this text. +MAINTENANCE_END - If added you will see "You will be able to use the service from " followed by this text.. From fdb82c88af0584c0aec960127004e8000bfb9be3 Mon Sep 17 00:00:00 2001 From: Ben Neill Date: Sun, 10 Sep 2023 22:08:29 +0100 Subject: [PATCH 2/5] Create Dockerfile --- Dockerfile | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..fb2fff69b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,63 @@ +FROM ruby:3.2.2-alpine AS assets +RUN addgroup app --gid 1000 +RUN adduser -SD -u 1000 --shell /bin/bash --home /home/app app app +RUN chown -R app:app /usr/local/bundle +COPY --chown=app:app . /home/app/et1 +ENV RAILS_ENV=production +ENV HOME=/home/app +ENV NODE_OPTIONS=--openssl-legacy-provider +RUN apk add --no-cache libpq-dev tzdata gettext sudo shared-mime-info libc6-compat && \ + apk add --no-cache --virtual .build-tools git build-base curl-dev nodejs yarn && \ + cd /home/app/et1 && \ + gem install bundler && \ + bundle config set without 'test development' && \ + bundle config set with 'assets production' && \ + bundle config set deployment 'true' && \ + bundle install --no-cache --jobs=5 --retry=3 && \ + bundle exec rails assets:precompile SECRET_KEY_BASE=doesntmatter && \ + chown -R app:app /usr/local/bundle && \ + apk del .build-tools + +FROM ruby:3.2.2-alpine + +RUN addgroup app --gid 1000 +RUN adduser -SD -u 1000 --shell /bin/bash --home /home/app app app + + +ARG APPVERSION=unknown +ARG APP_BUILD_DATE=unknown +ARG APP_GIT_COMMIT=unknown +ARG APP_BUILD_TAG=unknown + +# Setting up ping.json variables +ENV APPVERSION ${APPVERSION} +ENV APP_BUILD_DATE ${APP_BUILD_DATE} +ENV APP_GIT_COMMIT ${APP_GIT_COMMIT} +ENV APP_BUILD_TAG ${APP_BUILD_TAG} + +EXPOSE 8080 + +COPY --chown=app:app . /home/app/et1 +COPY --from=assets --chown=app:app /home/app/et1/public/packs /home/app/et1/public/packs +COPY --from=assets --chown=app:app /home/app/et1/vendor/bundle /home/app/et1/vendor/bundle +RUN chown -R app:app /usr/local/bundle +RUN apk add --no-cache libpq-dev tzdata gettext sudo shared-mime-info curl-dev file bash libc6-compat && \ + apk add --no-cache postgresql-client~=11.12 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main && \ + apk add --no-cache --virtual .build-tools git build-base && \ + cd /home/app/et1 && \ + gem install bundler foreman && \ + bundle config set without 'test development' && \ + bundle config set with 'production' && \ + bundle config set deployment 'true' && \ + bundle install --no-cache --jobs=5 --retry=3 && \ + apk del .build-tools && \ + chown -R app:app /usr/local/bundle && \ + mkdir -p /home/app/et1/tmp && \ + chown -R app:app /home/app/et1/tmp + + +USER app +ENV HOME /home/app +WORKDIR /home/app/et1 +ENV RAILS_ENV=production +CMD ["bundle", "exec", "iodine", "-port", "8080"] From 32895f1bf639bed3c67b782548761a32ac1dcc22 Mon Sep 17 00:00:00 2001 From: Ben Neill Date: Sun, 10 Sep 2023 22:54:38 +0100 Subject: [PATCH 3/5] Update values.yaml --- charts/et-pet-et1/values.yaml | 99 +++++++++++++---------------------- 1 file changed, 35 insertions(+), 64 deletions(-) diff --git a/charts/et-pet-et1/values.yaml b/charts/et-pet-et1/values.yaml index b365786e7..c10168f72 100644 --- a/charts/et-pet-et1/values.yaml +++ b/charts/et-pet-et1/values.yaml @@ -7,67 +7,7 @@ base: ingressHost: et-pet-et1.{{ .Values.global.environment }}.platform.hmcts.net aadIdentityName: et1-pet environment: - DB_HOST: - secretKeyRef: "et1-postgres-host" - key: "et1-postgres-host" - disable: false - DB_PORT: - secretKeyRef: "et1-postgres-port" - key: "et1-postgres-port" - disable: false - DB_USERNAME: - secretKeyRef: "et1-postgres-user" - key: "et1-postgres-user" - disable: false - DB_NAME: - secretKeyRef: "et1-postgres-database" - key: "et1-postgres-database" - disable: false RAILS_ENV: production - GOOGLE_ANALYTICS_ID: - secretRef: "et1-google-analytics-id" - key: "et1-google-analytics-id" - disabled: false - SECRET_KEY_BASE: - secretRef: "et1-secret-key-base" - key: "et1-secret-key-base" - disabled: false - SECRET_KEY_TOKEN: - secretRef: "et1-secret-key-token" - key: "et1-secret-key-token" - disabled: false - ZENDESK_GROUP_ID: - secretRef: "et1-zendesk-group-id" - key: "et1-zendesk-group-id" - disabled: false - ZENDESK_TOKEN: - secretRef: "et1-zendesk-token" - key: "et1-zendesk-token" - disabled: false - ZENDESK_URL: - secretRef: "et1-zendesk-url" - key: "et1-zendesk-url" - disabled: false - ZENDESK_USER: - secretRef: "et1-zendesk-user" - key: "et1-zendesk-user" - disabled: false - SMTP_USERNAME: - secretRef: "sendgrid-username" - key: "sendgrid-username" - disabled: false - SMTP_PASSWORD: - secretRef: "sendgrid-password" - key: "sendgrid-password" - disabled: false - RAVEN_DSN: - secretRef: "et1-raven-dsn" - key: "et1-raven-dsn" - disabled: false - GOVUK_NOTIFY_API_KEY_LIVE: - secretRef: "govuk-notify-api-key" - key: "govuk-notify-api-key" - disabled: false RAILS_LOG_TO_STDOUT: true ABSOLUTE_HOST: "http://et-dev-azure.dev.et.dsd.io" REMOVE_ASSET_HOST: "https://bbea327e42bedevet1.blob.core.windows.net/" @@ -82,9 +22,40 @@ base: SMTP_HOSTNAME: "smtp.sendgrid.net" SMTP_PORT: 587 DOCKER_STATE: "migrate" - GTM_ACCOUNT: - secretRef: "et1-gtm-account" - key: "et1-gtm-account" - disabled: false SERVICE_NOW_EMAIL: "DCD-ETOnlineServiceDesk@HMCTS.NET" AZURE_APP_INSIGHTS_ROLE_NAME: "ET1" + keyVaults: + et-pet: + secrets: + - name: et1-postgres-host + alias: DB_HOST + - name: et1-postgres-port + alias: DB_PORT + - name: et1-postgres-user + alias: DB_USERNAME + - name: et1-postgres-database + alias: DB_NAME + - name: et1-google-analytics-id + alias: GOOGLE_ANALYTICS_ID + - name: et1-secret-key-base + alias: SECRET_KEY_BASE + - name: et1-secret-key-token + alias: SECRET_KEY_TOKEN + - name: et1-zendesk-group-id + alias: ZENDESK_GROUP_ID + - name: et1-zendesk-token + alias: ZENDESK_TOKEN + - name: et1-zendesk-url + alias: ZENDESK_URL + - name: et1-zendesk-user + alias: ZENDESK_USER + - name: sendgrid-username + alias: SMTP_USERNAME + - name: sendgrid-password + alias: SMTP_PASSWORD + - name: et1-raven-dsn + alias: RAVEN_DSN + - name: govuk-notify-api-key + alias: GOVUK_NOTIFY_API_KEY_LIVE + - name: et1-gtm-account + alias: GTM_ACCOUNT From 51d7151cd30757d844275298a41ce4df49cac6e8 Mon Sep 17 00:00:00 2001 From: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com> Date: Sun, 10 Sep 2023 21:59:29 +0000 Subject: [PATCH 4/5] Bumping chart version/ fixing aliases --- charts/et-pet-et1/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/et-pet-et1/Chart.yaml b/charts/et-pet-et1/Chart.yaml index 850432823..6ddfea89c 100644 --- a/charts/et-pet-et1/Chart.yaml +++ b/charts/et-pet-et1/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "1.0" description: A Helm chart for et-pet et1 application name: et-pet-et1 home: https://github.com/hmcts/et-pet-et1 -version: 0.0.6 +version: 0.0.7 dependencies: - name: base version: 0.2.7 From 0891a23e7043da234c24c64504b8853a10bf8260 Mon Sep 17 00:00:00 2001 From: Ben Neill Date: Sun, 10 Sep 2023 23:21:42 +0100 Subject: [PATCH 5/5] Update values.yaml --- charts/et-pet-et1/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/et-pet-et1/values.yaml b/charts/et-pet-et1/values.yaml index c10168f72..3261a5b5c 100644 --- a/charts/et-pet-et1/values.yaml +++ b/charts/et-pet-et1/values.yaml @@ -5,7 +5,7 @@ base: startupPath: /apply/ping.json image: "hmctspublic.azurecr.io/et-pet/et1:latest" ingressHost: et-pet-et1.{{ .Values.global.environment }}.platform.hmcts.net - aadIdentityName: et1-pet + aadIdentityName: et-pet environment: RAILS_ENV: production RAILS_LOG_TO_STDOUT: true