mirror of
https://github.com/OHTU-German-learning-website/OHTU-German-learning-website.git
synced 2026-10-12 19:13:51 +03:00
Add OpenShift configuration manifests
This commit is contained in:
@@ -7,3 +7,4 @@ gradesa/test-results/*
|
||||
gradesa/playwright-report/*
|
||||
playwright-report
|
||||
screenshots
|
||||
secrets.yaml
|
||||
|
||||
@@ -46,6 +46,29 @@ This should be all that's needed:
|
||||
- `npm run dev` — Starts the dev server.
|
||||
- You can now find the NextJS app on localhost:3000
|
||||
|
||||
## OpenShift
|
||||
|
||||
The project is currently hosted on University of Helsinki TIKE OpenShift cluster. The deployment is managed with the manifest files in the manifests folder. The CI/CD pipeline is set up so that when new commit(s) are merged to master, a GitHub actions pipeline runs and builds the new code into a container image which is then pushed to ghcr.io. OpenShift is configured to poll for new images automatically with an interval of 15 minutes. This means that after a change has been merged to master and the pipelines have run successfully, it should take max 15 minutes for the new version to appear in production.
|
||||
|
||||
All manifest files except secrets.yaml are under the manifests directory. The secrets.yaml file contains environment variables related to the database connection. A template for the file is as follows:
|
||||
|
||||
```
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: gradesa-secret
|
||||
data:
|
||||
DB_PASSWORD: <base64 encoded data>
|
||||
MAILERSEND_API_KEY: <base64 encoded data>
|
||||
SESSION_SECRET: <base64 encoded data>
|
||||
DB_HOST: <base64 encoded data>
|
||||
DB_USER: <base64 encoded data>
|
||||
DB_PORT: <base64 encoded data>
|
||||
DB_NAME: <base64 encoded data>
|
||||
```
|
||||
|
||||
When constructing the file remember that the encoded form can not contain a trailing newline, so instead of using `echo secret | base64` (echo adds new line automatically at the end), use `printf secret | base64` to encode the secrets into base64.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [Product and Sprint Backlogs](https://github.com/orgs/OHTU-German-learning-website/projects/3)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: gradesa-dep
|
||||
annotations:
|
||||
alpha.image.policy.openshift.io/resolve-names: "*"
|
||||
image.openshift.io/triggers: >-
|
||||
[{"from":{"kind":"ImageStreamTag","name":"gradesa:staging","namespace":"ohtuprojekti-staging"},"fieldPath":"spec.template.spec.containers[?(@.name==\"gradesa\")].image","pause":"false"}]
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gradesa-dep
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gradesa-dep
|
||||
spec:
|
||||
containers:
|
||||
- name: gradesa
|
||||
image: gradesa:staging
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: gradesa-secret
|
||||
resources:
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "500m"
|
||||
requests:
|
||||
memory: "100Mi"
|
||||
cpu: "50m"
|
||||
@@ -0,0 +1,19 @@
|
||||
kind: ImageStream
|
||||
apiVersion: image.openshift.io/v1
|
||||
|
||||
metadata:
|
||||
name: gradesa
|
||||
labels:
|
||||
app: gradesa
|
||||
spec:
|
||||
lookupPolicy:
|
||||
local: false
|
||||
tags:
|
||||
- name: staging
|
||||
from:
|
||||
kind: DockerImage
|
||||
name: ghcr.io/ohtu-german-learning-website/ohtu-german-learning-website:latest
|
||||
importPolicy:
|
||||
scheduled: true
|
||||
referencePolicy:
|
||||
type: Local
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: route.openshift.io/v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: gradesa-route
|
||||
namespace: ohtuprojekti-staging
|
||||
labels:
|
||||
app: gradesa
|
||||
type: external
|
||||
spec:
|
||||
host: gradesa2-ohtuprojekti-staging.ext.ocp-prod-0.k8s.it.helsinki.fi
|
||||
port:
|
||||
targetPort: 8080
|
||||
to:
|
||||
kind: Service
|
||||
name: gradesa-svc
|
||||
tls:
|
||||
termination: edge
|
||||
insecureEdgeTerminationPolicy: Redirect
|
||||
wildcardPolicy: None
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gradesa-svc
|
||||
spec:
|
||||
selector:
|
||||
app: gradesa-dep
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
type: ClusterIP
|
||||
Reference in New Issue
Block a user