cardano-foundation / cf-ledger-sync

An open-source Java application designed to facilitate access to indexed Cardano blockchain data
Apache License 2.0
17 stars 1 forks source link

Allow custom db configuration from secrets or parameters #183

Closed nemo83 closed 2 months ago

nemo83 commented 2 months ago

This PR introduces changes to LSv2 and Node charts

LSv2

Extended db configuration so to allow any combination of properties or secret injected values.

Some properties are not sensitive, like host in this case, user can specify either the vanilla hostname or the couple secret name + secret key. Plain values, like host in this case, have priority.

This allows LS to work w/

Example 1

In this case the POSTGRES_HOST env var can be either a plain text property set as part of the helm chart values via the host property, or kept null and set through the secretName/hostKey.

the SPRING_DATASOURCE_USERNAME is instead considered sensitive and must be set as secretName/userKey.

        - name: POSTGRES_HOST
          {{- if .host }}
          value: {{ .host }}
          {{- else }}
          valueFrom:
            secretKeyRef:
              name: postgres-secrets
              key: POSTGRES_HOST
              name: {{ .secretName }}
              key: {{ .hostKey }}
          {{- end }}
            - name: SPRING_DATASOURCE_USERNAME
              valueFrom:
                secretKeyRef:
                  name: postgres-secrets
                  key: POSTGRES_USER
                  name: {{ .secretName }}
                  key: {{ .userKey }}

Node

Added sleep flag to allow the container to restart with sleep infinity and allow for manual maintenance. This was used to manually fix mithril breaking change.

rcmorano commented 2 months ago

LGTM when conflicts are resolved and hyphens for aggregation schemas are replaced for underscores :))