Skip to content

Commit

Permalink
add maintenance page functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Neill Turner committed Oct 29, 2024
1 parent 71d83bd commit df60938
Show file tree
Hide file tree
Showing 52 changed files with 530 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Set maintenance mode

on:
workflow_dispatch:
inputs:
environment:
required: true
type: choice
options:
- test
- production
mode:
required: true
type: choice
options:
- enable
- disable

jobs:
set-maintenance-mode:
name: Set maintenance mode
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Enable or disable maintenance mode
uses: DFE-Digital/github-actions/maintenance@master
with:
azure-credentials: ${{ secrets.AZURE_CREDENTIALS}}
environment: ${{ inputs.environment }}
mode: ${{ inputs.mode }}
docker-repository: ghcr.io/dfe-digital/apply-for-qualified-teacher-status-maintenance
github-token: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,20 @@ production-cluster:
get-cluster-credentials: set-azure-account
az aks get-credentials --overwrite-existing -g ${CLUSTER_RESOURCE_GROUP_NAME} -n ${CLUSTER_NAME}
kubelogin convert-kubeconfig -l $(if ${GITHUB_ACTIONS},spn,azurecli)

maintenance-image-push: ## Build and push maintenance page image: make production maintenance-image-push GITHUB_TOKEN=x [MAINTENANCE_IMAGE_TAG=y]
$(if ${GITHUB_TOKEN},, $(error Provide a valid Github token with write:packages permissions as GITHUB_TOKEN variable))
$(if ${MAINTENANCE_IMAGE_TAG},, $(eval export MAINTENANCE_IMAGE_TAG=$(shell date +%s)))
docker build -t ghcr.io/dfe-digital/apply-for-qualified-teacher-status-maintenance:${MAINTENANCE_IMAGE_TAG} maintenance_page
echo ${GITHUB_TOKEN} | docker login ghcr.io -u USERNAME --password-stdin
docker push ghcr.io/dfe-digital/apply-for-qualified-teacher-status-maintenance:${MAINTENANCE_IMAGE_TAG}

maintenance-fail-over: get-cluster-credentials ## Fail main app over to the maintenance page. Requires an existing maintenance docker image: make production maintenance-fail-over MAINTENANCE_IMAGE_TAG=y. See https://github.com/DFE-Digital/teacher-services-cloud/blob/main/documentation/maintenance-page.md#github-token
$(eval export CONFIG)
./maintenance_page/scripts/failover.sh

enable-maintenance: maintenance-image-push maintenance-fail-over ## Build, push, fail over: make production enable-maintenance GITHUB_TOKEN=x [MAINTENANCE_IMAGE_TAG=y]

disable-maintenance: get-cluster-credentials ## Fail back to the main app: make production disable-maintenance
$(eval export CONFIG)
./maintenance_page/scripts/failback.sh
4 changes: 4 additions & 0 deletions maintenance_page/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginxinc/nginx-unprivileged:1.26.1

COPY nginx.conf /etc/nginx/nginx.conf
COPY ./html/ /usr/share/nginx/html
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions maintenance_page/html/assets/images/favicon-ec189703.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions maintenance_page/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en" class="govuk-template">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>This service is currently unavailable - Apply for qualified teacher status - GOV.UK</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#0b0c0c">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="assets/images/favicon-7ddbfd51.ico" type="image/x-icon">
<link rel="mask-icon" href="assets/images/govuk-mask-icon.svg" color="#0b0c0c">
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/govuk-apple-touch-icon-180x180.png">
<link rel="apple-touch-icon" sizes="167x167" href="assets/images/govuk-apple-touch-icon-167x167.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/images/govuk-apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" href="assets/images/govuk-apple-touch-icon.png">
<meta property="og:image" content="assets/govuk-opengraph-image.png">
<link rel="stylesheet" media="all" href="stylesheets/govuk-frontend-5.3.1.min.css">
</head>
<body class="govuk-template__body">
<style>
.app-header--production.app-header--full-border {
border-bottom-color: #1d70b8;
}
</style>
<header class="govuk-header govuk-!-display-none-print app-header--production app-header--full-border app-header--wide-logo" role="banner" data-module="govuk-header">
<div class="govuk-header__container govuk-width-container">
<div class="govuk-header__logo">
<a class="govuk-header__link govuk-header__link--homepage" href="https://www.gov.uk/">
<span class="govuk-header__logotype">
<svg
focusable="false"
role="img"
class="govuk-header__logotype"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 148 30"
height="30"
width="148"
aria-label="GOV.UK"
>
<title>GOV.UK</title>
<path d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5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2-2.7 1.5-1 .4-2.2.5-3.4.5-1.2 0-2.4-.2-3.4-.5-1-.4-1.9-.9-2.7-1.5-.8-.7-1.3-1.5-1.8-2.4-.4-.9-.6-2-.6-3.1V6.9h4.2v13c0 .8.1 1.4.3 2 .2.6.5 1 .9 1.4.4.4.8.6 1.4.8.6.2 1.1.3 1.8.3zm13-17.4h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L148 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z"></path>
</svg>
<span class="govuk-header__logotype-text"></span>
</span>
</a>
</div>
<div class="govuk-header__content">
<a class="govuk-header__link govuk-header__service-name" href="/">Apply for qualified teacher status</a>
</div>
</div>
</header>
<div class="govuk-width-container">
<main class="govuk-main-wrapper" id="main-content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">This service is currently unavailable</h1>
<p class="govuk-body">We're sorry the service is not available right now.</p>
<p class="govuk-body">Try again later.</p>
<p class="govuk-body">If you reached this page after submitting information then it has not been saved. You will need to enter it again when the service is available.</p>
</div>
</div>
</main>
</div>
<footer role="contentinfo" class="govuk-footer govuk-!-display-none-print">
<div class="govuk-width-container">
<div class="govuk-footer__meta">
<div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
<h2 class="govuk-heading-m">Get help</h2>
<p class="govuk-body-s govuk-!-margin-bottom-1">Call 0800 389 2500 or <a class="govuk-link govuk-footer__link" href="https://getintoteaching.education.gov.uk/help-and-support?utm_source=apply-for-teacher-training.service.gov.uk&amp;utm_medium=referral&amp;utm_campaign=candidate_interface%2Fstart_page-create_account_or_sign_in&amp;utm_content=candidate_not_logged_in">chat online</a>.</p>
<p class="govuk-body-s govuk-!-margin-bottom-1">Monday to Friday, 8:30am to 5:30pm (except public&nbsp;holidays)</p>
</div>
<div class="govuk-footer__meta-item">
<a class="govuk-footer__link govuk-footer__copyright-logo govuk-!-margin-bottom-1" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">© Crown copyright</a>
</div>
</div>
</div>
</footer>
</body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions maintenance_page/manifests/maintenance/deployment_maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: apply-for-qts-maintenance
labels:
app: apply-for-qts-maintenance
spec:
replicas: 2
selector:
matchLabels:
app: apply-for-qts-maintenance
template:
metadata:
labels:
app: apply-for-qts-maintenance
spec:
nodeSelector:
teacherservices.cloud/node_pool: applications
kubernetes.io/os: linux
containers:
- name: apply-for-qts-maintenance
image: ghcr.io/dfe-digital/apply-for-qualified-teacher-status-maintenance:dummy-tag
ports:
- containerPort: 8080
resources:
requests:
memory: 64M
cpu: 0.1
limits:
memory: 64M
cpu: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: apply-for-qts-maintenance
labels:
app: apply-for-qts-maintenance
spec:
replicas: 2
selector:
matchLabels:
app: apply-for-qts-maintenance
template:
metadata:
labels:
app: apply-for-qts-maintenance
spec:
nodeSelector:
teacherservices.cloud/node_pool: applications
kubernetes.io/os: linux
containers:
- name: apply-for-qts-maintenance
image: ghcr.io/dfe-digital/apply-for-qualified-teacher-status-maintenance:#MAINTENANCE_IMAGE_TAG#
ports:
- containerPort: 8080
resources:
requests:
memory: 64M
cpu: 0.1
limits:
memory: 64M
cpu: 1
12 changes: 12 additions & 0 deletions maintenance_page/manifests/maintenance/service_maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: Service
metadata:
name: apply-for-qts-maintenance
spec:
selector:
app: apply-for-qts-maintenance
ports:
- protocol: TCP
port: 80
targetPort: 8080
16 changes: 16 additions & 0 deletions maintenance_page/manifests/production/ingress_external_to_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apply-for-qts-in-england.education.gov.uk
spec:
ingressClassName: nginx
rules:
- host: apply-for-qts-in-england.education.gov.uk
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: apply-for-qts-production
port:
number: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: #DNS_ZONE_NAME#
spec:
ingressClassName: nginx
rules:
- host: #DNS_ZONE_NAME#
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: apply-for-qts-maintenance
port:
number: 80
16 changes: 16 additions & 0 deletions maintenance_page/manifests/production/ingress_internal_to_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apply-for-qts-production.teacherservices.cloud
spec:
ingressClassName: nginx
rules:
- host: apply-for-qts-production.teacherservices.cloud
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: apply-for-qts-production
port:
number: 80
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apply-for-qts-production.teacherservices.cloud
spec:
ingressClassName: nginx
rules:
- host: apply-for-qts-production.teacherservices.cloud
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: apply-for-qts-maintenance
port:
number: 80
16 changes: 16 additions & 0 deletions maintenance_page/manifests/production/ingress_maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: apply-for-qts-maintenance.teacherservices.cloud
spec:
ingressClassName: nginx
rules:
- host: apply-for-qts-maintenance.teacherservices.cloud
http:
paths:
- pathType: ImplementationSpecific
backend:
service:
name: apply-for-qts-maintenance
port:
number: 80
Loading

0 comments on commit df60938

Please sign in to comment.