Skip to content

Commit

Permalink
[ANCHOR-708][PD] Add sep24-reference-ui helm charts (#1628)
Browse files Browse the repository at this point in the history
### Description

1. Add sep24-reference-ui helm charts
2. Add reference server ingress
3. Fix interactive url jwt secrets mismatch 
4. Update minikube scripts

### Testing

- `./gradlew test`
Test with demo wallet and transaction complete
  • Loading branch information
JiahuiWho authored Feb 13, 2025
1 parent 37fb58e commit 5996713
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 8 deletions.
15 changes: 12 additions & 3 deletions helm-charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ helm upgrade --install reference-server ./reference-server/ -f ./reference-serve
# Install the Anchor Platform
helm upgrade --install anchor-platform ./sep-service/ -f ./sep-service/values.yaml

# Install SEP-24 Reference UI
helm upgrade --install sep24-reference-ui ./sep24-reference-ui/ -f ./sep24-reference-ui/values.yaml

# Install the ingress controller
helm upgrade --install ingress-nginx ingress-nginx \
--repo https://kubernetes.github.io/ingress-nginx \
--namespace ingress-nginx --create-namespace

# Port forward the ingress controller
kubectl port-forward svc/ingress-nginx-controller 8080:80 -n ingress-nginx
# Port forward the ingress controller, reference server, and SEP-24 Reference UI
kubectl port-forward svc/ingress-nginx-controller 8080:80 -n ingress-nginx &
kubectl port-forward svc/reference-server-svc-reference-server 8091:8091 -n default &
kubectl port-forward svc/sep24-reference-ui-svc-sep24-reference-ui 3000:3000 -n default &

echo "Anchor Platform is running at http://localhost:8080"
echo "Reference Server is available at http://localhost:8091"
echo "SEP-24 Reference UI is available at http://localhost:3000"

# Now you can access the Anchor Platform at http://localhost:8080
wait
```
41 changes: 41 additions & 0 deletions helm-charts/reference-server/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.ingress.name }}
namespace: {{ .Values.namespace }}
annotations:
{{- $annotations := dict "nginx.ingress.kubernetes.io/custom-headers" (printf "%s/%s-configmap" .Values.namespace .Values.ingress.name) }}
{{- if .Values.ingress.annotations }}
{{- $annotations = merge $annotations .Values.ingress.annotations }}
{{- end }}
{{- range $key, $value := $annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.fullName }}-ingress
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
tls:
{{- if .Values.ingress.tls.host }}
- hosts:
- {{ .Values.ingress.tls.host }}
{{- end }}
{{- if .Values.ingress.tls.secretName }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.fullName }}-svc-{{ .Values.services.ref.name }}
port:
number: {{ .Values.services.ref.servicePort | default 8091 }}
4 changes: 4 additions & 0 deletions helm-charts/reference-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ metadata:
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end}}
app.kubernetes.io/name: {{ .Values.fullName }}-{{ .Values.services.ref.name }}
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.services.ref.type | default "ClusterIP" }}
ports:
Expand Down
8 changes: 7 additions & 1 deletion helm-charts/reference-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ services:
cpu: 500m
limits:
memory: 1Gi
cpu: 1
cpu: 1
ingress:
name: ingress-reference-server
host: reference-server.local
className: nginx
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
2 changes: 1 addition & 1 deletion helm-charts/secret-store/templates/secretstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "123456789",
"SEP6_SECRET": "SAJW2O2NH5QMMVWYAN352OEXS2RUY675A2HPK5HEG2FRR2NXPYA4OLYN",
"SEP24_INTERACTIVE_JWT_KEY": "0005686076237201446d93d2ea92d1419647283e2acddbc2fffbf8d53db36b7d",
"SEP24_INTERACTIVE_JWT_KEY": "c5457e3a349df9002117543efa7e316dd89e666a5ce6f33a0deb13e90f3f1e9d",
"SEP24_SECRET": "SAJ34AG5XC7BWGK3GGQGCXERSEP7LZYXBBDMD33NMBASZVNKACEMNEIY",
"PLATFORM_ANCHOR_SECRET": "myPlatformToAnchorSecret",
"ANCHOR_PLATFORM_SECRET": "myAnchorToPlatformSecret",
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/sep-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ config:
sep24:
enabled: true
interactive_url:
base_url: http://localhost:8091
base_url: http://localhost:3000
more_info_url:
base_url: http://localhost:8091
base_url: http://localhost:3000

ingress:
name: ingress-anchor-platform
Expand Down
10 changes: 10 additions & 0 deletions helm-charts/sep24-reference-ui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
appVersion: "1.0"
description: Anchor Platform SEP-24 Reference UI Helm Chart
maintainers:
- name: Jiahui Hu
email: [email protected]
sources:
- https://github.com/stellar/sep24-reference-ui
name: sep24-reference-ui
version: 0.1.0
42 changes: 42 additions & 0 deletions helm-charts/sep24-reference-ui/templates/_common.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- define "common.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "common.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 -}}

{{- define "common.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "common.addField" -}}
{{- $key := index . 0 }}
{{- $val := index . 1 }}
{{- $tp := typeOf $val }}
{{- if eq $tp "map[string]interface {}" }}{{ printf "%s:\n" $key }}
{{- range $mapKey, $mapValue := $val }}
{{- printf " %s: \"%v\"\n" $mapKey $mapValue }}
{{- end }}
{{- else }}
{{- if toString $val }}
{{- printf "%s: \"%v\"\n" $key $val -}}
{{- end }}
{{- end }}
{{- end }}

{{- define "common.addMultiline" -}}
{{- $key := index . 0 -}}
{{- $value := index . 1 -}}
{{ printf "%s: |" $key }}
{{ printf "%s" $value | indent 4 }}
{{- end }}
54 changes: 54 additions & 0 deletions helm-charts/sep24-reference-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
namespace: {{ .Values.namespace }}
labels:
app.kubernetes.io/name: {{ .Values.fullName }}-{{ .Values.services.ui.name }}
helm.sh/chart: {{ include "common.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.services.ui.deployment.replicas | default 1 }}
selector:
matchLabels:
app: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
template:
metadata:
{{- if .Values.services.ui.deployment.annotations }}
annotations:
{{- toYaml .Values.services.ui.deployment.annotations | nindent 8 }}
{{- end }}
namespace: {{ .Values.namespace }}
labels:
app: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
spec:
containers:
- name: {{ .Values.container.name }}
image: {{ .Values.container.image }}
imagePullPolicy: {{ .Values.container.imagePullPolicy | default "Always" }}
ports:
- name: http
containerPort: {{ .Values.services.ui.containerPort | default 3000 }}
protocol: TCP
env:
- name: BUSINESS_SERVER_ENDPOINT
valueFrom:
configMapKeyRef:
name: sep24-reference-ui-config
key: BUSINESS_SERVER_ENDPOINT
resources:
requests:
memory: {{ .Values.services.ui.deployment.resources.requests.memory }}
cpu: {{ .Values.services.ui.deployment.resources.requests.cpu }}
limits:
memory: {{ .Values.services.ui.deployment.resources.limits.memory }}
cpu: {{ .Values.services.ui.deployment.resources.limits.cpu }}
volumeMounts:
- name: config-volume
mountPath: /config
readOnly: true
volumes:
- name: config-volume
configMap:
name: sep24-reference-ui-config
41 changes: 41 additions & 0 deletions helm-charts/sep24-reference-ui/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.ingress.name }}
namespace: {{ .Values.namespace }}
annotations:
{{- $annotations := dict "nginx.ingress.kubernetes.io/custom-headers" (printf "%s/%s-configmap" .Values.namespace .Values.ingress.name) }}
{{- if .Values.ingress.annotations }}
{{- $annotations = merge $annotations .Values.ingress.annotations }}
{{- end }}
{{- range $key, $value := $annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Values.fullName }}-ingress
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
tls:
{{- if .Values.ingress.tls.host }}
- hosts:
- {{ .Values.ingress.tls.host }}
{{- end }}
{{- if .Values.ingress.tls.secretName }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
port:
number: {{ .Values.services.ui.servicePort | default 3000 }}
23 changes: 23 additions & 0 deletions helm-charts/sep24-reference-ui/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
namespace: {{ .Values.namespace }}
labels:
{{- if .Values.services.ui.lsabels }}
{{- range $key, $value := .Values.services.ui.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
app.kubernetes.io/name: {{ .Values.fullName }}-{{ .Values.services.ui.name }}
helm.sh/chart: {{ $.Chart.Name }}-{{ $.Chart.Version }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: {{ .Values.services.ui.type | default "ClusterIP"}}
ports:
- port: {{ .Values.services.ui.servicePort | default 3000 }}
targetPort: {{ .Values.services.ui.containerPort | default 3000 }}
protocol: TCP
selector:
app: {{ .Values.fullName }}-svc-{{ .Values.services.ui.name }}
32 changes: 32 additions & 0 deletions helm-charts/sep24-reference-ui/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
fullName: sep24-reference-ui
namespace: default

container:
name: sep24-reference-ui
image: stellar/sep24-reference-ui:latest
imagePullPolicy: IfNotPresent

config:
businessServerEndpoint: "http://localhost:8091"

services:
ui:
containerPort: 3000
servicePort: 3000
type: ClusterIP
name: sep24-reference-ui
deployment:
replicas: 1
resources:
requests:
memory: 512Mi
cpu: 500m
limits:
memory: 1Gi
cpu: 1
ingress:
name: ingress-sep24-reference-ui
host: sep24-reference-ui.local
className: nginx
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
sep24-reference-ui:
image: stellar/sep24-reference-ui
ports:
- "3000:80"
- "3000:3000"

kafka:
platform: linux
Expand Down

0 comments on commit 5996713

Please sign in to comment.