Skip to content

Commit

Permalink
feat(4829): implement maintenance-app with its deployment pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhanchik committed Feb 3, 2025
1 parent ccdb66d commit 0264c1f
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/deploy-maintenance-mode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: 06.Deploy Maintenance Mode

on:
workflow_dispatch:

env:
GITHUB_REGISTRY: ghcr.io
MAINTENANCE_BRANCH: feat/4829

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
packages: write
contents: write
security-events: write

jobs:
build-push-maintenance:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout maintenance branch
uses: actions/checkout@v4
with:
ref: ${{ env.MAINTENANCE_BRANCH }}

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: maintenance-page
push: true
tags: ${{ env.GITHUB_REGISTRY }}/maintenance-mode:latest

deploy-maintenance:
runs-on: ubuntu-22.04
needs: build-push-maintenance
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Authenticate to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
namespace: ${{ vars.OPENSHIFT_NAMESPACE }}
insecure_skip_tls_verify: true

- name: Deploy Maintenance Mode
run: |
oc apply -f k8s/maintenance-deployment.yaml
oc apply -f k8s/maintenance-service.yaml
oc apply -f k8s/maintenance-route.yaml || echo "Route not required"
- name: Verify Deployment
run: oc rollout status deployment/maintenance-mode -n ${{ vars.OPENSHIFT_NAMESPACE }}

- name: Notify RocketChat on Failure
if: failure()
uses: ./.github/actions/rocketchat-notification
with:
webhook-url: ${{ secrets.ROCKETCHAT_WEBHOOK_URL }}
data: |
{
"text": ":warning: Maintenance Mode Deployment Failed! Check the logs."
}
6 changes: 6 additions & 0 deletions maintenance-mode/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM nginx:1.25.3-alpine

COPY static /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 3000
59 changes: 59 additions & 0 deletions maintenance-mode/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# see https://hub.docker.com/_/nginx `Running nginx as a non-root user`
worker_processes auto;

pid /tmp/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"';

client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

server {
listen 3000;
server_name localhost;

access_log off;
error_log /dev/null;

add_header cross-origin-embedder-policy "require-corp";
add_header cross-origin-opener-policy "same-origin";
add_header cross-origin-resource-policy "same-origin";
add_header x-dns-prefetch-control "off";
add_header expect-ct "max-age=0";
add_header x-frame-options "SAMEORIGIN";
add_header strict-transport-security "max-age=15552000; includeSubDomains";
add_header x-download-options "noopen";
add_header x-content-type-options "nosniff";
add_header origin-agent-cluster "?1";
add_header x-permitted-cross-domain-policies "none";
add_header referrer-policy "strict-origin";
add_header x-xss-protection "0";
add_header permissions-policy "midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri.html $uri/index.html /index.html;
}
}
}
22 changes: 22 additions & 0 deletions maintenance-mode/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Maintenance</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<div class="message-box">
<div class="animated-icon">⚙️</div>
<h1>We'll Be Back Soon!</h1>
<p>
Registry site is currently undergoing scheduled maintenance. We apologize for the inconvenience and appreciate
your patience.
</p>
<footer>&copy; 2025 B.C. Gov's Platform Product Registry</footer>
</div>
</div>
</body>
</html>
71 changes: 71 additions & 0 deletions maintenance-mode/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* General Reset */
body,
html {
margin: 0;
padding: 0;
box-sizing: border-box;
width: 100%;
height: 100%;
font-family: 'Arial', sans-serif;
color: #333;
background: #f4f4f9;
}

/* Centering Container */
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
text-align: center;
padding: 20px;
}

/* message Box */
.message-box {
max-width: 600px;
padding: 30px;
background: #ffffff; /* White card */
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}

/* Heading */
h1 {
font-size: 2.5rem;
color: #ff5733;
margin-bottom: 20px;
}

/* Subtext */
p {
font-size: 1.1rem;
color: #666;
margin-bottom: 20px;
line-height: 1.6;
}

/* Animation */
.animated-icon {
font-size: 3rem;
color: #ff5733;
animation: bounce 1.5s infinite;
}

/* Bounce Animation */
@keyframes bounce {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
}

/* Footer */
footer {
font-size: 0.9rem;
color: #999;
margin-top: 20px;
}

0 comments on commit 0264c1f

Please sign in to comment.