Skip to content

Commit

Permalink
Merge pull request #298 from MinaFoundation/pm-2072
Browse files Browse the repository at this point in the history
PM-2072 - Add pgt-web-app chart
  • Loading branch information
johnmarcou authored Nov 28, 2024
2 parents a1e18d0 + effff39 commit 5176420
Show file tree
Hide file tree
Showing 16 changed files with 654 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pgt-gov-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ helmfile status
| bot.deploymentAnnotations | object | `{}` | Annotations to add to the deployment |
| bot.image.pullPolicy | string | `"IfNotPresent"` | The pullPolicy used when pulling the image |
| bot.image.repository | string | `"673156464838.dkr.ecr.us-west-2.amazonaws.com/pgt-gov-bot"` | The repository of the image |
| bot.image.tag | string | `"0.0.15"` | |
| bot.image.tag | string | `"0.0.21"` | |
| bot.imagePullSecrets | list | `[]` | The secrets used to pull the image |
| bot.livenessProbe | string | `nil` | Liveness check configuration |
| bot.podAnnotations | object | `{}` | Annotations to add to the pods |
| bot.podLabels | object | `{}` | Labels to add to the pods |
| bot.readinessProbe | string | `nil` | Readiness check configuration |
| bot.replicaCount | int | `1` | The number of replicas |
| bot.resources | object | `{}` | Resource limitations for the pods |
| config.mef.frontend.baseUrl | string | `"https://example.minaprotocol.network"` | |
| config.privateKey | string | `"-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDCEKoQMfoxAoAx\nL9aNa2YP5EIy8dgqB/bcR6jaZwBUGaxqdeaA9ofYiIcEZyqPW5hL79i+tvHKfhU+\nTgh2VLAy2bpHyJZknwzLfC1lAyx67lZeIZpV1pqgvJL08rQZpddV+42Cucx2AglD\nT25X0W/FjsIwZKfq9eiRKIa0avrd8PUM9A5NmQcVg2lsxLDR4fCqaieQSm3u1gXf\nNO8H8wfyS5ZLgXWskzjAgeJgqg49SphziV/sr9+I4YSWQxAMYsVd6wwJVcMh25Hd\notjCHCS/HFxIVAvpt2YZf/xc9qZ0K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egB\nnKq9/lkRvQQQKczMekemZUr1kDyYvX5OrL1HapUCgYAM7VCohi1sFfDUov1lAc+d\na51R641gaZmlw2749k762+6J6vagu6hcWljPiHo4pA9drvVqeMsNdKcXfs1JXqnC\niTdqrpGobUM8bNVyPRXxryQIKOJ6ou8xt1pyenAhOoMTOSOllnU8/bM/VSPXXHrf\nGv61TwASbeDP/WPoCMnylw==\n"` | |
| config.publicKey | string | `"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwhCqEDH6MQKAMS/WjWtm\nD+RCMvHYKgf23Eeo2mcAVBmsanXmgPaH2IiHBGcqj1uYS+/Yvrbxyn4VPk4IdlSw\nMtm6R8iWZJ8My3wtZQMseu5WXiGaVdaaoLyS9PK0GaXXVfuNgrnMdgIJQ09uV9Fv\nxY7CMGSn6vXokSiGtGr63fD1DPQOTZkHFYNpbMSw0eHwqmonkEpt7tYF3zTvB/MH\n8kuWS4F1rJM4wIHiYKoOPUqYc4lf7K/fiOGElkMQDGLFXesMCVXDIduR3aLYwhwk\nvxxcSFQL6bdmGX/8XPamdCiguxAPAn47K80AF9UpTG2pl7uneSXsi3CPofD8yTlL\n1QIDAQAB\n-----END PUBLIC KEY-----\n"` | |
| fullnameOverride | string | `""` | The full release name override |
| ingress.annotations | object | `{}` | Annotations to add to the Ingress |
| ingress.className | string | `""` | Ingress class |
Expand Down
6 changes: 6 additions & 0 deletions pgt-gov-bot/templates/deployment-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ spec:
key: discordGuildId
- name: DB_STORAGE
value: /data/database.sqlite
- name: MEF_FE_BASE_URL
value: {{.Values.config.mef.frontend.baseUrl}}
- name: JWT_PRIVATE_KEY_RS512
value: {{.Values.config.privateKey | quote}}
- name: JWT_PUBLIC_KEY_RS512
value: {{.Values.config.publicKey | quote}}
livenessProbe:
{{- toYaml .Values.bot.livenessProbe | nindent 12 }}
readinessProbe:
Expand Down
46 changes: 45 additions & 1 deletion pgt-gov-bot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,58 @@ nameOverride: ""
# -- The full release name override
fullnameOverride: ""

config:
mef:
frontend:
baseUrl: https://example.minaprotocol.network
privateKey: |
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDCEKoQMfoxAoAx
L9aNa2YP5EIy8dgqB/bcR6jaZwBUGaxqdeaA9ofYiIcEZyqPW5hL79i+tvHKfhU+
Tgh2VLAy2bpHyJZknwzLfC1lAyx67lZeIZpV1pqgvJL08rQZpddV+42Cucx2AglD
T25X0W/FjsIwZKfq9eiRKIa0avrd8PUM9A5NmQcVg2lsxLDR4fCqaieQSm3u1gXf
NO8H8wfyS5ZLgXWskzjAgeJgqg49SphziV/sr9+I4YSWQxAMYsVd6wwJVcMh25Hd
otjCHCS/HFxIVAvpt2YZf/xc9qZ0KKC7EA8CfjsrzQAX1SlMbamXu6d5JeyLcI+h
8PzJOUvVAgMBAAECggEASL/mgNu7ZtQBKm88hxdT03FGP8LZvifuKvXSHs2uGdjm
AaLhHkdM9ad4tfXWxpcXqJ/pKNV8HuTVId4u3e0xgF6OropLlrzpFv8eJVfjPNJM
Hk2KhdNFdCw9CwZQ7ax15Q3AJtlwBG0O++SzAMjKlczGj02shTBaVtBSbyALm1co
fRLaWjHdOUgHprbm+OG6cplGiJHkdCIf4pyo/OBt9rA/8f8mSvSTG7p3YamOAWFU
pGup1mRQmvOPjX4No2pzpEofKsZmlCYNZigABfjrUY2+Rmj0kELnxVnhoowu/ben
NWGVeL5JhpWnfhYquzOf/N+qvGPVP0XUGM+roDGboQKBgQD96aCpkXcJMNAfevH3
OPffLmMwLKbDu3N6xpSMiDN7rFmfzp7yxMW1mTj9juTKsHa5v7F4RQ3I1N+RNCp6
OBgrqQC5uU7D+1P6f072xWjw5aV84JfBedkj78N97fblCVCdXXebf7TsKQAJJUWR
b0pT+yi2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aLYwhwk
vxxcSFQL6bdmGX/8XPamdCiguxAPAn47K80AF9UpTG2pl7uneSXsi3CPofD8yTlL
1QIDAQAB
-----END PUBLIC KEY-----
bot:
image:
# -- The repository of the image
repository: 673156464838.dkr.ecr.us-west-2.amazonaws.com/pgt-gov-bot
# -- The pullPolicy used when pulling the image
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "0.0.15"
tag: "0.0.21"
# -- The secrets used to pull the image
imagePullSecrets: []
# -- The number of replicas
Expand Down
23 changes: 23 additions & 0 deletions pgt-web-app/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions pgt-web-app/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 16.2.1
- name: pgadmin4
repository: https://helm.runix.net
version: 1.31.0
digest: sha256:77d37d51959216379e4ab916b97bb4f1c63ce205131c156e0b428fbfce99c8f7
generated: "2024-11-21T09:45:59.877738-05:00"
34 changes: 34 additions & 0 deletions pgt-web-app/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: v2
name: pgt-web-app
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

dependencies:
- name: postgresql
version: "*"
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
- name: pgadmin4
version: "*"
repository: "https://helm.runix.net"
condition: pgadmin4.enabled
101 changes: 101 additions & 0 deletions pgt-web-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# pgt-web-app

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

A Helm chart for Kubernetes

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | postgresql | * |
| https://helm.runix.net | pgadmin4 | * |

## Prerequisites

Before using this Helm chart, you should have the following prerequisites:

- Access to Kubernetes cluster (If needed contact your friendly neighbourhood DevOps engineer)
- Helm >= v3.14.3
- (**Optional**) helmfile >= v0.162.0 to install this chart

## Installation

> Note: **examples** can be found in the repository
To install this Helm chart, the easiest is to create a helmfile.yaml with needed values and run:

```
helmfile template
helmfile apply
```

Or use helmfile only to generate resources and apply them with kubectl like so:

```
helmfile template | kubectl -f -
```

Verify that the chart is deployed successfully:

> Note: `kubectl` is a better suited tool for this
```
helmfile status
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| autoscaling.enabled | bool | `false` | |
| autoscaling.maxReplicas | int | `100` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| config.privateKey | string | `"-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDCEKoQMfoxAoAx\nL9aNa2YP5EIy8dgqB/bcR6jaZwBUGax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t/eBk3J3d05YLM3ci/dL+Mkc3jB3/GRYVHdGia0E4K3xegC0Ms9Teb0WeFH6tFr\nt18g7/CqzADN57chGotSuB4tw6D73gdxFThew0DqBvAJcZ6EpVPozyPZAoGAcN6j\neZR5k2XNSu0s9b/HTwvw+MKr+Bb0PPiqK26M4hAl4Pe/KUHpQ9khBA0b5Skb2bo6\nNuGzqy8KZT9j4y2++VXcraM0tGRDOoQ2Jq+NSZ0qX37J7ddkN8exaSGTwyJWbegB\nnKq9/lkRvQQQKczMekemZUr1kDyYvX5OrL1HapUCgYAM7VCohi1sFfDUov1lAc+d\na51R641gaZmlw2749k762+6J6vagu6hcWljPiHo4pA9drvVqeMsNdKcXfs1JXqnC\niTdqrpGobUM8bNVyPRXxryQIKOJ6ou8xt1pyenAhOoMTOSOllnU8/bM/VSPXXHrf\nGv61TwASbeDP/WPoCMnylw==\n"` | |
| config.publicKey | string | `"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwhCqEDH6MQKAMS/WjWtm\nD+RCMvHYKgf23Eeo2mcAVBmsanXmgPaH2IiHBGcqj1uYS+/Yvrbxyn4VPk4IdlSw\nMtm6R8iWZJ8My3wtZQMseu5WXiGaVdaaoLyS9PK0GaXXVfuNgrnMdgIJQ09uV9Fv\nxY7CMGSn6vXokSiGtGr63fD1DPQOTZkHFYNpbMSw0eHwqmonkEpt7tYF3zTvB/MH\n8kuWS4F1rJM4wIHiYKoOPUqYc4lf7K/fiOGElkMQDGLFXesMCVXDIduR3aLYwhwk\nvxxcSFQL6bdmGX/8XPamdCiguxAPAn47K80AF9UpTG2pl7uneSXsi3CPofD8yTlL\n1QIDAQAB\n-----END PUBLIC KEY-----\n"` | |
| deploymentAnnotations | object | `{}` | Annotations to add to deployments |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"673156464838.dkr.ecr.us-west-2.amazonaws.com/pgt-web-app"` | |
| image.tag | string | `"0.1.0"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.className | string | `""` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths[0].path | string | `"/"` | |
| ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | |
| ingress.tls | list | `[]` | |
| livenessProbe.httpGet.path | string | `"/"` | |
| livenessProbe.httpGet.port | string | `"http"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| pgadmin4.enabled | bool | `false` | |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| postgresql.auth.enablePostgresUser | bool | `false` | Enable the default postgres user |
| postgresql.auth.password | string | `"mina123"` | Password for the database |
| postgresql.auth.username | string | `"govbot"` | Username for the database |
| postgresql.enabled | bool | `true` | Enable local postgresql database server |
| postgresql.primary.persistence.enabled | bool | `true` | Enable the persistence for the postgresql server |
| postgresql.primary.persistence.size | string | `"8Gi"` | Size of the postgresql server volume |
| postgresql.primary.persistence.storageClass | string | `""` | Storage class for the postgresql server volume |
| postgresql.primary.resourcesPreset | string | `"nano"` | Resources preset to set resource requests and limits |
| readinessProbe.httpGet.path | string | `"/"` | |
| readinessProbe.httpGet.port | string | `"http"` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| service.port | int | `3000` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.automount | bool | `true` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| tolerations | list | `[]` | |
| volumeMounts | list | `[]` | |
| volumes | list | `[]` | |

Binary file added pgt-web-app/charts/pgadmin4-1.31.0.tgz
Binary file not shown.
Binary file added pgt-web-app/charts/postgresql-16.2.1.tgz
Binary file not shown.
22 changes: 22 additions & 0 deletions pgt-web-app/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "pgt-web-app.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "pgt-web-app.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "pgt-web-app.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 "pgt-web-app.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
{{- end }}
62 changes: 62 additions & 0 deletions pgt-web-app/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "pgt-web-app.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
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 "pgt-web-app.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "pgt-web-app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "pgt-web-app.labels" -}}
helm.sh/chart: {{ include "pgt-web-app.chart" . }}
{{ include "pgt-web-app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "pgt-web-app.selectorLabels" -}}
app.kubernetes.io/name: {{ include "pgt-web-app.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "pgt-web-app.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "pgt-web-app.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading

0 comments on commit 5176420

Please sign in to comment.