Skip to content

Commit e434ac1

Browse files
nemo83rcmorano
andauthored
Chore/add new aggregation app (#166)
* 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]>
1 parent fbe080b commit e434ac1

File tree

4 files changed

+124
-5
lines changed

4 files changed

+124
-5
lines changed

deploy/cf-ledger-sync/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,27 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4242
app.kubernetes.io/managed-by: {{ .Release.Service }}
4343
{{- end }}
4444

45+
{{- define "cf-ledger-sync-aggregation.labels" -}}
46+
helm.sh/chart: {{ include "cf-ledger-sync.chart" . }}
47+
{{ include "cf-ledger-sync-aggregation.selectorLabels" . }}
48+
{{- if .Chart.AppVersion }}
49+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
50+
{{- end }}
51+
app.kubernetes.io/managed-by: {{ .Release.Service }}
52+
{{- end }}
53+
54+
4555
{{/*
4656
Selector labels
4757
*/}}
4858
{{- define "cf-ledger-sync.selectorLabels" -}}
4959
app.kubernetes.io/name: {{ include "cf-ledger-sync.name" . }}
5060
app.kubernetes.io/instance: {{ .Release.Name }}
5161
{{- end }}
62+
{{- define "cf-ledger-sync-aggregation.selectorLabels" -}}
63+
app.kubernetes.io/name: {{ include "cf-ledger-sync.name" . }}{{ print "-aggregation" }}
64+
app.kubernetes.io/instance: {{ .Release.Name }}
65+
{{- end }}
5266

5367
{{/*
5468
Create the name of the service account to use
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{{ if .Values.aggregation.enabled }}
2+
---
3+
apiVersion: apps/v1
4+
kind: Deployment
5+
metadata:
6+
name: {{ include "cf-ledger-sync.fullname" . }}{{ print "-aggregation" }}
7+
labels:
8+
{{- include "cf-ledger-sync-aggregation.labels" . | nindent 4 }}
9+
spec:
10+
replicas: {{ .Values.replicaCount }}
11+
selector:
12+
matchLabels:
13+
{{- include "cf-ledger-sync-aggregation.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
labels:
17+
{{- include "cf-ledger-sync-aggregation.selectorLabels" . | nindent 8 }}
18+
spec:
19+
{{- with .Values.imagePullSecrets }}
20+
imagePullSecrets:
21+
{{- toYaml . | nindent 8 }}
22+
{{- end }}
23+
containers:
24+
- name: "{{ .Chart.Name }}-aggregation"
25+
image: "{{ .Values.aggregation.image.repository }}:{{ .Values.aggregation.image.tag | default .Chart.AppVersion }}"
26+
imagePullPolicy: {{ .Values.image.pullPolicy }}
27+
env:
28+
- name: NETWORK
29+
value: {{ .Values.network | default "preprod" }}
30+
- name: DB_DIALECT
31+
value: {{ .Values.aggregation.dbDialect | default "org.hibernate.dialect.PostgreSQLDialect" }}
32+
33+
{{ if .Values.useLocalCardanoNode }}
34+
- name: STORE_CARDANO_HOST
35+
value: "cardano-node"
36+
- name: STORE_CARDANO_PORT
37+
value: "3001"
38+
{{ if eq .Values.localCardanoNode.network "preview" }}
39+
- name: STORE_CARDANO_PROTOCOL_MAGIC
40+
value: "2"
41+
{{- else if eq .Values.localCardanoNode.network "preprod" }}
42+
- name: STORE_CARDANO_PROTOCOL_MAGIC
43+
value: "1"
44+
{{- else if eq .Values.localCardanoNode.network "mainnet" }}
45+
- name: STORE_CARDANO_PROTOCOL_MAGIC
46+
value: "764824073"
47+
{{- else if eq .Values.localCardanoNode.network "sanchonet" }}
48+
- name: STORE_CARDANO_PROTOCOL_MAGIC
49+
value: "4"
50+
{{- end }}
51+
{{- else }}
52+
- name: STORE_CARDANO_HOST
53+
value: {{ .Values.storeCardanoHost | default "preprod-node.world.dev.cardano.org" }}
54+
- name: STORE_CARDANO_PORT
55+
value: {{ .Values.storeCardanoPort | default "30000" | quote }}
56+
- name: STORE_CARDANO_PROTOCOL_MAGIC
57+
value: {{ .Values.storeCardanoProtocolMagic | default "1" | quote }}
58+
{{- end }}
59+
60+
## Postgres
61+
- name: POSTGRES_HOST
62+
valueFrom:
63+
secretKeyRef:
64+
name: postgres-secrets
65+
key: POSTGRES_HOST
66+
- name: POSTGRES_PORT
67+
valueFrom:
68+
secretKeyRef:
69+
name: postgres-secrets
70+
key: POSTGRES_PORT
71+
- name: POSTGRES_DB
72+
valueFrom:
73+
secretKeyRef:
74+
name: postgres-secrets
75+
key: POSTGRES_DB
76+
- name: SPRING_DATASOURCE_URL
77+
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.aggregation.dbSchema | default "public" }}
78+
- name: SPRING_DATASOURCE_USERNAME
79+
valueFrom:
80+
secretKeyRef:
81+
name: postgres-secrets
82+
key: POSTGRES_USER
83+
- name: SPRING_DATASOURCE_PASSWORD
84+
valueFrom:
85+
secretKeyRef:
86+
name: postgres-secrets
87+
key: POSTGRES_PASSWORD
88+
89+
- name: STORE_ACCOUNT_HISTORYCLEANUPENABLED
90+
value: {{ .Values.aggregation.store.account.history_cleanup_enabled | quote }}
91+
resources:
92+
{{- toYaml .Values.aggregation.resources | nindent 12 }}
93+
{{{ end }}}

deploy/cf-ledger-sync/templates/deployment.yaml renamed to deploy/cf-ledger-sync/templates/ledger-sync-deployment.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ spec:
9292
secretKeyRef:
9393
name: postgres-secrets
9494
key: POSTGRES_DB
95-
- name: SCHEMA
96-
value: {{ .Values.dbSchema | default "public" }}
9795
- name: SPRING_DATASOURCE_URL
98-
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema=$(SCHEMA)
96+
value: jdbc:postgresql://$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB)?currentSchema={{ .Values.dbSchema | default "public" }}
9997
- name: SPRING_DATASOURCE_USERNAME
10098
valueFrom:
10199
secretKeyRef:

deploy/cf-ledger-sync/values.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ localCardanoNode:
88
enabled: false
99
image:
1010
repository: ghcr.io/blinklabs-io/cardano-node
11-
tag: 8.7.3-2
11+
tag: 8.9.0-1-amd64
1212
mithrilRestore: "true"
1313
tolerations: null
1414
affinity: null
1515

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

@@ -48,3 +48,17 @@ diagnosticMode:
4848
blocks:
4949
batchSize: "100"
5050
commitThreshold: "3000"
51+
52+
dbSchema: public
53+
54+
aggregation:
55+
enabled: false
56+
image:
57+
repository: cardanofoundation/cf-ledger-sync-aggregation
58+
tag: "7b05530"
59+
pullPolicy: Always
60+
dbSchema: public
61+
store:
62+
account:
63+
history_cleanup_enabled: "true"
64+
resources: {}

0 commit comments

Comments
 (0)