Skip to content

Commit

Permalink
Chore/add new aggregation app (#166)
Browse files Browse the repository at this point in the history
* chore(helm): add aggregation service

* chore(helm): re-added cardano-node env vars for aggregation app as they are needed as well

* chore(helm): bump cardano-node to 8.9.0-1

* chore: added flag for history cleanup enabled for LS2 aggregations

* chore: replaces dash w/ underscors

* chore: maybe still need to quote a boolean quoted string?

* chore: parameterised aggregation, updated docker hub image path

---------

Co-authored-by: Roberto C. Morano <[email protected]>
  • Loading branch information
nemo83 and rcmorano authored Apr 18, 2024
1 parent fbe080b commit e434ac1
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 5 deletions.
14 changes: 14 additions & 0 deletions deploy/cf-ledger-sync/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,27 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "cf-ledger-sync-aggregation.labels" -}}
helm.sh/chart: {{ include "cf-ledger-sync.chart" . }}
{{ include "cf-ledger-sync-aggregation.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}


{{/*
Selector labels
*/}}
{{- define "cf-ledger-sync.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cf-ledger-sync.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- define "cf-ledger-sync-aggregation.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cf-ledger-sync.name" . }}{{ print "-aggregation" }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{{ if .Values.aggregation.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cf-ledger-sync.fullname" . }}{{ print "-aggregation" }}
labels:
{{- include "cf-ledger-sync-aggregation.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "cf-ledger-sync-aggregation.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "cf-ledger-sync-aggregation.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: "{{ .Chart.Name }}-aggregation"
image: "{{ .Values.aggregation.image.repository }}:{{ .Values.aggregation.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: NETWORK
value: {{ .Values.network | default "preprod" }}
- name: DB_DIALECT
value: {{ .Values.aggregation.dbDialect | default "org.hibernate.dialect.PostgreSQLDialect" }}

{{ if .Values.useLocalCardanoNode }}
- name: STORE_CARDANO_HOST
value: "cardano-node"
- name: STORE_CARDANO_PORT
value: "3001"
{{ if eq .Values.localCardanoNode.network "preview" }}
- name: STORE_CARDANO_PROTOCOL_MAGIC
value: "2"
{{- else if eq .Values.localCardanoNode.network "preprod" }}
- name: STORE_CARDANO_PROTOCOL_MAGIC
value: "1"
{{- else if eq .Values.localCardanoNode.network "mainnet" }}
- name: STORE_CARDANO_PROTOCOL_MAGIC
value: "764824073"
{{- else if eq .Values.localCardanoNode.network "sanchonet" }}
- name: STORE_CARDANO_PROTOCOL_MAGIC
value: "4"
{{- end }}
{{- else }}
- name: STORE_CARDANO_HOST
value: {{ .Values.storeCardanoHost | default "preprod-node.world.dev.cardano.org" }}
- name: STORE_CARDANO_PORT
value: {{ .Values.storeCardanoPort | default "30000" | quote }}
- name: STORE_CARDANO_PROTOCOL_MAGIC
value: {{ .Values.storeCardanoProtocolMagic | default "1" | quote }}
{{- end }}

## Postgres
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_HOST
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PORT
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_DB
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.aggregation.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_USER
- name: SPRING_DATASOURCE_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_PASSWORD

- name: STORE_ACCOUNT_HISTORYCLEANUPENABLED
value: {{ .Values.aggregation.store.account.history_cleanup_enabled | quote }}
resources:
{{- toYaml .Values.aggregation.resources | nindent 12 }}
{{{ end }}}
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ spec:
secretKeyRef:
name: postgres-secrets
key: POSTGRES_DB
- name: SCHEMA
value: {{ .Values.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_URL
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema=$(SCHEMA)
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.dbSchema | default "public" }}
- name: SPRING_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
Expand Down
18 changes: 16 additions & 2 deletions deploy/cf-ledger-sync/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ localCardanoNode:
enabled: false
image:
repository: ghcr.io/blinklabs-io/cardano-node
tag: 8.7.3-2
tag: 8.9.0-1-amd64
mithrilRestore: "true"
tolerations: null
affinity: null

image:
repository: pro.registry.gitlab.metadata.dev.cf-deployments.org/base-infrastructure/docker-registry/cf-ledger-sync
repository: cardanofoundation/cf-ledger-sync
tag: "d5f1455"
pullPolicy: Always

Expand Down Expand Up @@ -48,3 +48,17 @@ diagnosticMode:
blocks:
batchSize: "100"
commitThreshold: "3000"

dbSchema: public

aggregation:
enabled: false
image:
repository: cardanofoundation/cf-ledger-sync-aggregation
tag: "7b05530"
pullPolicy: Always
dbSchema: public
store:
account:
history_cleanup_enabled: "true"
resources: {}

0 comments on commit e434ac1

Please sign in to comment.