Skip to content

Commit

Permalink
Merge pull request #20 from catenax-ng/main
Browse files Browse the repository at this point in the history
Release changes for QG4
  • Loading branch information
mkanal committed Feb 14, 2023
2 parents 9b76bb9 + 0f24e7a commit 798ff4e
Show file tree
Hide file tree
Showing 113 changed files with 1,304 additions and 807 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chart-release.yml
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Update helm dependencies for trace-x
run: |
cd charts/tx-traceability-foss-frontend
cd charts/traceability-foss-frontend
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dependency update
- name: Run chart-releaser
Expand Down
444 changes: 277 additions & 167 deletions DEPENDENCIES

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Dockerfile
@@ -1,3 +1,4 @@
# Nonroot user is not needed beause we are using the "nginx-unprivileged" image
# STAGE 1: Build
FROM node:18-alpine as builder

Expand All @@ -20,6 +21,7 @@ HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=10s \
CMD curl -fSs 127.0.0.1:8080/healthz || exit 1

USER root

RUN rm /usr/share/nginx/html/index.html && rm /etc/nginx/conf.d/default.conf

# Copy project files from ‘builder’ stage copy over the artifacts in dist folder to default nginx public folder
Expand All @@ -43,3 +45,4 @@ COPY ./scripts/inject-dynamic-env.js /docker-entrypoint.d/

# Validate NGINX configuration
RUN nginx -t
USER 101
86 changes: 77 additions & 9 deletions INSTALL.md
@@ -1,13 +1,5 @@
## How to build the application

The angular app is built into Docker containers and exposed through NGINX

It is important to specify the type of configuration profile, previously defined in the angular JSON file, so it can
build the application correctly.

## How to run the docker image
# Environment variables

When running the build docker image you are able to pass through multiple environment variables to configure the FE.
Support environment variables are:

```javascript
Expand Down Expand Up @@ -39,6 +31,82 @@ This variable points to the desired api
`CATENAX_PORTAL_BASE_URL`
This variable is used to set the base path of the application. (Should be set if application runs as a subtopic)

# Helm deployment

## Configuration of values.yaml

To run a helm chart you first need to specify a values file with instructions on how to run your helm file.
Here is an example how you could structure this file for this frontend helm chart.

`your-values.yaml`

```yaml
image:
tag: $APP_REVISION
ENVIRONMENT_VAR_1: 'VALUE'
ENVIRONMENT_VAR_2: 'VALUE'
...

ingress:
enabled: true
className: "nginx"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: "${FE_HOST_URL}"
paths:
- path: /
pathType: Prefix
tls:
- hosts:
- "${FE_HOST_URL}"
secretName: "${FE_HOST_URL}-tls"

```

## Helm installation

Add the Trace-X frontend Helm repository:

```sh
$ helm repo add traceability-foss-frontend https://catenax-ng.github.io/tx-traceability-foss-frontend
```

Then install the Helm chart into your cluster:

```sh
$ helm install -f your-values.yaml traceability-foss-frontend traceability-foss-frontend/traceability-foss-frontend
```

### Deployment using ArgoCD

Create a new Helm chart and use Trace-X as a dependency.

```yaml
dependencies:
- name: traceability-foss-frontend
alias: frontend
version: x.x.x
repository: 'https://catenax-ng.github.io/tx-traceability-foss-frontend/'
```

Then provide your configuration as the values.yaml of that chart.

Create a new application in ArgoCD and point it to your repository / Helm chart folder.

# Docker deployment

## How to build the application

The angular app is built into Docker containers and exposed through NGINX

It is important to specify the type of configuration profile, previously defined in the angular JSON file, so it can
build the application correctly.

## How to run the docker image

When running the build docker image you are able to pass through multiple environment variables to configure the FE.

### Example command:

```shell
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -25,6 +25,7 @@ Secondly, Angular `scales` perfectly in the long run. Because of the restricted
With that in mind it made sense it chose Angular for an `open source` project.

Source files are exposed statically through the NGINX web server.
TRACE-FOSS product composes of the backend and frontend repositories, backend repository can be found under [GitHub repository](https://github.com/catenax-ng/tx-traceability-foss-backend).

### Challenges and solutions

Expand Down
@@ -1,5 +1,5 @@
apiVersion: v2
name: tx-traceability-foss-frontend
name: traceability-foss-frontend
description: A Helm chart for Traceability frontend application

# A chart can be either an 'application' or a 'library' chart.
Expand Down
@@ -1,15 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tx-traceability-foss-frontend.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "traceability-foss-frontend.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "tx-traceability-foss-frontend.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tx-traceability-foss-frontend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "traceability-foss-frontend.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "traceability-foss-frontend.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tx-traceability-foss-frontend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "traceability-foss-frontend.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tx-traceability-foss-frontend.name" -}}
{{- define "traceability-foss-frontend.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tx-traceability-foss-frontend.fullname" -}}
{{- define "traceability-foss-frontend.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "tx-traceability-foss-frontend.chart" -}}
{{- define "traceability-foss-frontend.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "tx-traceability-foss-frontend.labels" -}}
helm.sh/chart: {{ include "tx-traceability-foss-frontend.chart" . }}
{{ include "tx-traceability-foss-frontend.selectorLabels" . }}
{{- define "traceability-foss-frontend.labels" -}}
helm.sh/chart: {{ include "traceability-foss-frontend.chart" . }}
{{ include "traceability-foss-frontend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "tx-traceability-foss-frontend.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tx-traceability-foss-frontend.name" . }}
{{- define "traceability-foss-frontend.selectorLabels" -}}
app.kubernetes.io/name: {{ include "traceability-foss-frontend.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "tx-traceability-foss-frontend.serviceAccountName" -}}
{{- define "traceability-foss-frontend.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "tx-traceability-foss-frontend.fullname" .) .Values.serviceAccount.name }}
{{- default (include "traceability-foss-frontend.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
Expand Up @@ -2,16 +2,16 @@ apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Values.namespace | default .Release.Namespace }}
name: {{ include "tx-traceability-foss-frontend.fullname" . }}
name: {{ include "traceability-foss-frontend.fullname" . }}
labels:
{{- include "tx-traceability-foss-frontend.labels" . | nindent 4 }}
{{- include "traceability-foss-frontend.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "tx-traceability-foss-frontend.selectorLabels" . | nindent 6 }}
{{- include "traceability-foss-frontend.selectorLabels" . | nindent 6 }}
revisionHistoryLimit: 2
template:
metadata:
Expand All @@ -21,19 +21,19 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "tx-traceability-foss-frontend.selectorLabels" . | nindent 8 }}
{{- include "traceability-foss-frontend.selectorLabels" . | nindent 8 }}
spec:
automountServiceAccountToken: false
{{- if .Values.imagePullSecret.dockerconfigjson }}
imagePullSecrets:
- name: {{ include "tx-traceability-foss-frontend.fullname" . }}-imagepullsecret
- name: {{ include "traceability-foss-frontend.fullname" . }}-imagepullsecret
{{- else }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
serviceAccountName: {{ include "tx-traceability-foss-frontend.serviceAccountName" . }}
serviceAccountName: {{ include "traceability-foss-frontend.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down Expand Up @@ -76,4 +76,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
@@ -1,12 +1,12 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "tx-traceability-foss-frontend.fullname" . -}}
{{- $fullName := include "traceability-foss-frontend.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "tx-traceability-foss-frontend.labels" . | nindent 4 }}
{{- include "traceability-foss-frontend.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
@@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "tx-traceability-foss-frontend.fullname" . }}
name: {{ include "traceability-foss-frontend.fullname" . }}
labels:
{{- include "tx-traceability-foss-frontend.labels" . | nindent 4 }}
{{- include "traceability-foss-frontend.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
Expand All @@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
{{- include "tx-traceability-foss-frontend.selectorLabels" . | nindent 4 }}
{{- include "traceability-foss-frontend.selectorLabels" . | nindent 4 }}
Expand Up @@ -3,9 +3,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "tx-traceability-foss-frontend.serviceAccountName" . }}
name: {{ include "traceability-foss-frontend.serviceAccountName" . }}
labels:
{{- include "tx-traceability-foss-frontend.labels" . | nindent 4 }}
{{- include "traceability-foss-frontend.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
Expand Up @@ -6,11 +6,8 @@ image:
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

nameOverride: "tx-traceability-foss-test-frontend"
fullnameOverride: "tx-traceability-foss-test-frontend"

autoscaling:
enabled: false
nameOverride: "traceability-foss-test-frontend"
fullnameOverride: "traceability-foss-test-frontend"

ingress:
enabled: true
Expand Down
Expand Up @@ -5,9 +5,6 @@ image:
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

autoscaling:
enabled: false

ingress:
enabled: true
className: "nginx"
Expand Down
Expand Up @@ -5,11 +5,8 @@ image:
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

nameOverride: "tx-traceability-foss-test-frontend"
fullnameOverride: "tx-traceability-foss-test-frontend"

autoscaling:
enabled: false
nameOverride: "traceability-foss-test-frontend"
fullnameOverride: "traceability-foss-test-frontend"

ingress:
enabled: true
Expand Down
Expand Up @@ -5,9 +5,6 @@ image:
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

autoscaling:
enabled: false

ingress:
enabled: true
className: "nginx"
Expand Down
Expand Up @@ -8,11 +8,8 @@ image:
# important to not conflict with dev env (both use same ArgoCD instance)
namespace: product-traceability-foss-pen

nameOverride: "tx-traceability-foss-pen-frontend"
fullnameOverride: "tx-traceability-foss-pen-frontend"

autoscaling:
enabled: false
nameOverride: "traceability-foss-pen-frontend"
fullnameOverride: "traceability-foss-pen-frontend"

ingress:
enabled: true
Expand Down
21 changes: 21 additions & 0 deletions charts/traceability-foss-frontend/values-pre-prod.yaml
@@ -0,0 +1,21 @@
image:
tag: $ARGOCD_APP_REVISION
CATENAX_PORTAL_API_URL: 'https://traceability.pre-prod.demo.catena-x.net/api'
CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.pre-prod.demo.catena-x.net/auth'
CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part'
CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central'

ingress:
enabled: true
className: "nginx"
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: "traceability-portal.pre-prod.demo.catena-x.net"
paths:
- path: /
pathType: Prefix
tls:
- hosts:
- "traceability-portal.pre-prod.demo.catena-x.net"
secretName: "traceability-portal.pre-prod.demo.catena-x.net-tls"

0 comments on commit 798ff4e

Please sign in to comment.