Skip to content

Commit

Permalink
wip: cleanup, fix postgres requests
Browse files Browse the repository at this point in the history
  • Loading branch information
tjorbo committed Jul 2, 2024
1 parent 10e82ef commit 8397295
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 64 deletions.
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@ Complete Helm Chart repository for deploying the Terminfinder to any kubernetes

[SECURITY.md](./docs/SECURITY.md)

## Components

* Frontend: `registry.opencode.de/ig-bvc/demo-apps/terminfinder-sh/terminfinder-sh-frontend:v2.2.0`
* Backend: `registry.opencode.de/ig-bvc/demo-apps/terminfinder-sh/terminfinder-sh-backend:V1.0.9`
* Postgres (part of Backend):
Using [this public Helm chart](https://github.com/bitnami/charts/tree/main/bitnami/postgresql/) as fundament, but can
be disabled through `values.yaml` of the backend file.

Please modify the `values.yaml` files or use the CLI method for deployment and configuration. It's recommended to use a
dedicated PostgreSQL instance for production usage.
It's recommended to use a dedicated PostgreSQL instance for production usage.

## Installation

Expand All @@ -38,8 +29,8 @@ dedicated PostgreSQL instance for production usage.

### Installation steps

1. Prepare the value files for the backend and frontend each.
2. Install the helm charts with `helm install ...` CLI Command
1. Prepare the value files.
2. Install the helm charts with `helm install ...` CLI Command:

```bash
# Create a namespace (or use default), where to work in:
Expand All @@ -51,21 +42,28 @@ $ helm install terminfinder-demo terminfinder-chart -n terminfinder-demo
# Verify installation of helm charts:
$ helm list -n terminfinder-demo
$ kubectl get deploy -n terminfinder-demo
```

## Upgrade Helmchart

To upgrade the helm chart, use the `helm upgrade ...` command:

# Go to your configured ingress host domain (e.g. terminfinder.open-code.local) and test it out!
# The URL of the ingresses you can get here:
$ kubectl get ingress -n terminfinder-demo
```bash
# Upgrade HelmChart
$ helm upgrade terminfinder-demo terminfinder-chart -n terminfinder-demo
```

## Delete Namespace

To delete the helm chart (release), use the `helm uninstall...` command.

Note that the persistent volume may be available even if the helm release is uninstalled.

```bash
# Delete Namespace
$ kubectl delete namespace terminfinder-demo
$ helm uninstall terminfinder-demo -n terminfinder-demo
```

Your can upgrade the helm chart as usually with `helm upgrade ...` command.

### Using an own PostgreSQL DB instance

The helm chart deployment of the `terminfinder-frontend` will be kept untouched.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $svc := .Values.global.postgresql.service.name | default (printf "%s-postgresql-hl" (include "terminfinder-backend.fullname" .)) }}
{{- $svc := .Values.global.postgresql.service.name | default (printf "%s-postgresql-hl" (include "common.names.namespace" .)) }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -35,14 +35,13 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
# TODO Logs of backend: An error occurred using the connection to database 'terminfinder' on server ''.
env:
- name: DB_DATABASE
value: {{ .Values.global.postgresql.auth.database }}
- name: DB_PORT
value: {{ .Values.global.postgresql.service.ports.postgresql | quote }}
- name: DB_ADDRESS
value: {{ printf "%s.%s.svc" $svc .Release.Namespace }}
value: {{ printf "%s" $svc }}
- name: DB_USERNAME
value: {{ .Values.global.postgresql.auth.username }}
- name: ASPNETCORE_URLS
Expand All @@ -61,12 +60,19 @@ spec:
- name: Terminfinder__Log4NetConfigFilename
value: log4net.Console.debug.config
- name: ConnectionStrings__TerminfinderConnection
value: "Server=$(DB_ADDRESS);Port=$(DB_PORT);Database=$(DB_DATABASE);User ID=$(DB_USERNAME);password=$(DB_PASSWORD);"
value: "Server=$(DB_ADDRESS),$(DB_PORT);Database=$(DB_DATABASE);User ID=$(DB_USERNAME);password=$(DB_PASSWORD);"
ports:
- name: http
containerPort: 8080
protocol: TCP
startupProbe:
failureThreshold: 3
periodSeconds: 10
httpGet:
path: /app
port: http
livenessProbe:
initialDelaySeconds: 10
httpGet:
path: /app
port: http
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,13 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: ADDRESSING
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-customer-config
key: Anrede
value: {{ .Values.customerConfig.ADDRESSING }}
- name: LOCALE
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-customer-config
key: Sprache
value: {{ .Values.customerConfig.LOCALE }}
- name: TITLE
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-customer-config
key: Titel
value: {{ .Values.customerConfig.TITLE }}
- name: EMAIL
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-customer-config
key: email
value: {{ .Values.customerConfig.EMAIL }}
- name: API_URL
value: {{ .Values.app.backend_url }}
ports:
Expand Down
22 changes: 5 additions & 17 deletions terminfinder-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
terminfinder-frontend-oss:
terminfinder-frontend:
# Default values for terminfinder-frontend.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
Expand All @@ -14,12 +14,6 @@ terminfinder-frontend-oss:

replicaCount: 1 # Not HA for now!

image:
repository: registry.opencode.de/dataport/terminfinder/terminfinder-frontend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

imagePullSecrets: [ ]
nameOverride: ""
fullnameOverride: ""
Expand Down Expand Up @@ -96,19 +90,13 @@ terminfinder-frontend-oss:

affinity: { }

terminfinder-backend-oss:
terminfinder-backend:
# Default values for terminfinder-backend.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: registry.opencode.de/dataport/terminfinder/terminfinder-backend
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""

imagePullSecrets: [ ]
nameOverride: ""
fullnameOverride: ""
Expand Down Expand Up @@ -212,7 +200,7 @@ terminfinder-backend-oss:
cpu: 250m

containerSecurityContext:
enabled: true
enabled: false
runAsUser: 1001
runAsGroup: 1001
allowPrivilegeEscalation: false
Expand All @@ -224,12 +212,12 @@ terminfinder-backend-oss:
primary:
## Enable security context with non-root user
podSecurityContext:
enabled: true
enabled: false
runAsUser: 1001
runAsGroup: 1001
fsGroup: 1001
containerSecurityContext:
enabled: true
enabled: false
runAsUser: 1001
runAsGroup: 1001
allowPrivilegeEscalation: false
Expand Down

0 comments on commit 8397295

Please sign in to comment.