diff --git a/charts/chaingraph/templates/NOTES.txt b/charts/chaingraph/templates/NOTES.txt index 2e65975..88eaf10 100644 --- a/charts/chaingraph/templates/NOTES.txt +++ b/charts/chaingraph/templates/NOTES.txt @@ -43,10 +43,10 @@ kubectl port-forward postgres-0 5432:5432 ``` {{ if .Values.postgres.password }} You'll then be able to connect to the database locally: -postgresql://{{ .Values.postgres.username }}:{{ .Values.postgres.password }}@localhost:5432/chaingraph +postgres://{{ .Values.postgres.username }}:{{ .Values.postgres.password }}@localhost:5432/chaingraph {{ else }} You'll then be able to connect to the database locally: -postgresql://{{ .Values.postgres.username }}:POSTGRES_PASSWORD@localhost:5432/chaingraph +postgres://{{ .Values.postgres.username }}:POSTGRES_PASSWORD@localhost:5432/chaingraph To get the configured, randomly-generated POSTGRES_PASSWORD, inspect chaingraph-secrets: ``` diff --git a/charts/chaingraph/templates/_helpers.tpl b/charts/chaingraph/templates/_helpers.tpl index 4e3841a..a6337a4 100644 --- a/charts/chaingraph/templates/_helpers.tpl +++ b/charts/chaingraph/templates/_helpers.tpl @@ -36,7 +36,7 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- $secret.data.adminSecretKey -}} {{- else -}} {{/* Generate new key */}} - {{- (randAlphaNum 64) | b64enc | quote -}} + {{- (randAlphaNum 64) -}} {{- end -}} {{- end -}} {{- end -}} @@ -51,7 +51,7 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- $secret.data.postgresPassword -}} {{- else -}} {{/* Generate new password */}} - {{- (randAlphaNum 64) | b64enc | quote -}} + {{- (randAlphaNum 64) -}} {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/chaingraph/templates/bitcoin-cash-node-testnet.yaml b/charts/chaingraph/templates/bitcoin-cash-node-testnet.yaml index 7d6faea..5cfab17 100644 --- a/charts/chaingraph/templates/bitcoin-cash-node-testnet.yaml +++ b/charts/chaingraph/templates/bitcoin-cash-node-testnet.yaml @@ -32,7 +32,9 @@ spec: volumeMounts: - name: bitcoin-cash-node-testnet-volume mountPath: /data + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: bitcoin-cash-node-testnet + {{ end }} volumeClaimTemplates: - metadata: name: bitcoin-cash-node-testnet-volume diff --git a/charts/chaingraph/templates/bitcoin-cash-node.yaml b/charts/chaingraph/templates/bitcoin-cash-node.yaml index d7501b4..c2b19ca 100644 --- a/charts/chaingraph/templates/bitcoin-cash-node.yaml +++ b/charts/chaingraph/templates/bitcoin-cash-node.yaml @@ -30,7 +30,9 @@ spec: volumeMounts: - name: bitcoin-cash-node-volume mountPath: /data + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: bitcoin-cash-node + {{ end }} volumeClaimTemplates: - metadata: name: bitcoin-cash-node-volume diff --git a/charts/chaingraph/templates/chaingraph-secrets.yaml b/charts/chaingraph/templates/chaingraph-secrets.yaml index 941c474..208081f 100644 --- a/charts/chaingraph/templates/chaingraph-secrets.yaml +++ b/charts/chaingraph/templates/chaingraph-secrets.yaml @@ -8,6 +8,6 @@ metadata: name: chaingraph-secrets type: Opaque data: - adminSecretKey: {{ $chaingraphHasuraAdminSecretKey }} - postgresPassword: {{ $chaingraphPostgresPassword }} + adminSecretKey: {{ $chaingraphHasuraAdminSecretKey | b64enc | quote }} + postgresPassword: {{ $chaingraphPostgresPassword | b64enc | quote }} postgresConnectionString: {{ print "postgres://" .Values.postgres.username ":" $chaingraphPostgresPassword "@postgres-service." .Release.Namespace ".svc.cluster.local:5432/chaingraph" | b64enc | quote }} diff --git a/charts/chaingraph/templates/development-volumes.yaml b/charts/chaingraph/templates/development-volumes.yaml index e461141..69fa907 100644 --- a/charts/chaingraph/templates/development-volumes.yaml +++ b/charts/chaingraph/templates/development-volumes.yaml @@ -31,7 +31,7 @@ spec: accessModes: - ReadWriteOnce hostPath: - path: "/data/bitcoin-cash-node" + path: "/data/bitcoin-cash-node-testnet" {{- if not .Values.postgres.externalDbUrl }} --- apiVersion: v1 diff --git a/charts/chaingraph/templates/pgadmin.yaml b/charts/chaingraph/templates/pgadmin.yaml index c6ed61c..0a70268 100644 --- a/charts/chaingraph/templates/pgadmin.yaml +++ b/charts/chaingraph/templates/pgadmin.yaml @@ -26,7 +26,9 @@ spec: volumeMounts: - name: pgadmin-volume mountPath: /var/lib/pgadmin + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: pgadmin + {{ end }} securityContext: runAsUser: 0 containers: @@ -62,7 +64,9 @@ spec: volumeMounts: - name: pgadmin-volume mountPath: /var/lib/pgadmin + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: pgadmin + {{ end }} volumeClaimTemplates: - metadata: name: pgadmin-volume diff --git a/charts/chaingraph/templates/pghero.yaml b/charts/chaingraph/templates/pghero.yaml index 13628d3..c824589 100644 --- a/charts/chaingraph/templates/pghero.yaml +++ b/charts/chaingraph/templates/pghero.yaml @@ -49,7 +49,9 @@ spec: - name: pghero-configmap mountPath: /app/config/pghero.yml readOnly: true + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: pghero.yml + {{ end }} volumes: - name: pghero-configmap configMap: diff --git a/charts/chaingraph/templates/postgres.yaml b/charts/chaingraph/templates/postgres.yaml index 97e4c51..25c0336 100644 --- a/charts/chaingraph/templates/postgres.yaml +++ b/charts/chaingraph/templates/postgres.yaml @@ -76,7 +76,9 @@ spec: volumeMounts: - name: postgres-volume mountPath: /data + {{- if not .Values.useDevelopmentVolumes }} # https://github.com/rancher/k3d/issues/765 subPath: postgres + {{ end }} - name: postgres-dev-shm mountPath: /dev/shm - name: postgres-initdb-scripts diff --git a/charts/chaingraph/values.yaml b/charts/chaingraph/values.yaml index 90cbb08..3920a7e 100644 --- a/charts/chaingraph/values.yaml +++ b/charts/chaingraph/values.yaml @@ -35,7 +35,7 @@ bitcoinCashNode: # The precise Bitcoin Cash Node Docker image to use. image: chaingraph/bitcoin-cash-node@sha256:c0a8d24cdbd5d5f25b0793314a0a2a8336e51b4a0b4457f39c9c95cdae6b90bb # v23.1.0 # The size of the volume to provision for Bitcoin Cash Node. - volumeSize: 200Gi + volumeSize: 210Gi # Configuration settings for the built-in Bitcoin Cash Node (Testnet) bitcoinCashNodeTestnet: diff --git a/package.json b/package.json index 76f1c14..a8a74ca 100644 --- a/package.json +++ b/package.json @@ -19,13 +19,16 @@ "dev-cluster:reset": "yarn dev-cluster:destroy && yarn dev-cluster:init", "dev-cluster:reset:local-node": "yarn dev-cluster:destroy:local-node && yarn dev-cluster:init:local-node", "dev-cluster:reset:local": "yarn dev-cluster:destroy:local && yarn dev-cluster:init:local", + "dev-cluster:reset:prod-sim": "yarn dev-cluster:destroy:prod-sim && yarn dev-cluster:create && helm upgrade --install chaingraph-development charts/chaingraph --set useDevelopmentVolumes=true --set bitcoinCashNodeTestnet.enable=true", "dev-cluster:create": "k3d cluster create chaingraph-development-cluster --servers 1 --agents 2 --volume $PWD/data:/data --volume $PWD/images/hasura/hasura-data:/hasura", "dev-cluster:destroy": "yarn dev-cluster:spin-down:bchn && yarn dev-cluster:spin-down:postgres && echo 'pausing to allow pods to shutdown' && kubectl rollout status statefulset/bitcoin-cash-node && kubectl rollout status statefulset/postgres && k3d cluster delete chaingraph-development-cluster", "dev-cluster:destroy:local-node": "yarn dev-cluster:spin-down:postgres && echo 'pausing to allow pods to shutdown' && kubectl rollout status statefulset/postgres && k3d cluster delete chaingraph-development-cluster", "dev-cluster:destroy:local": "k3d cluster delete chaingraph-development-cluster", + "dev-cluster:destroy:prod-sim": "yarn dev-cluster:spin-down:bchn && yarn dev-cluster:spin-down:tbchn && yarn dev-cluster:spin-down:postgres && echo 'pausing to allow pods to shutdown' && kubectl rollout status statefulset/bitcoin-cash-node && kubectl rollout status statefulset/bitcoin-cash-node-testnet && kubectl rollout status statefulset/postgres && k3d cluster delete chaingraph-development-cluster", "dev-cluster:docker:stats": "docker stats", "dev-cluster:images:load:hasura": "k3d image import chaingraph/hasura:latest -c chaingraph-development-cluster", "dev-cluster:images:load:postgres-pldebugger": "k3d image import chaingraph/postgres-pldebugger:latest -c chaingraph-development-cluster", + "dev-cluster:upgrade:prod-sim": "helm upgrade --install chaingraph-development charts/chaingraph --set useDevelopmentVolumes=true --set bitcoinCashNodeTestnet.enable=true", "dev-cluster:upgrade": "helm upgrade --install chaingraph-development charts/chaingraph --set useDevelopmentVolumes=true --set hasura.image=chaingraph/hasura:latest --set hasura.adminSecretKey=very_insecure_hasura_admin_secret_key --set postgres.password=very_insecure_postgres_password --set agent.enable=false --set pgAdmin.enable=true --set pgHero.enable=true", "dev-cluster:upgrade:dry-run": "yarn dev-cluster:upgrade --dry-run", "dev-cluster:debug-chart": "helm template charts/chaingraph --debug", @@ -37,6 +40,8 @@ "dev-cluster:bounce:postgres": "yarn dev-cluster:spin-down:postgres && kubectl rollout status statefulset/postgres && yarn dev-cluster:spin-up:postgres", "dev-cluster:spin-down:bchn": "kubectl scale statefulsets bitcoin-cash-node --replicas=0", "dev-cluster:spin-up:bchn": "kubectl scale statefulsets bitcoin-cash-node --replicas=1", + "dev-cluster:spin-down:tbchn": "kubectl scale statefulsets bitcoin-cash-node-testnet --replicas=0", + "dev-cluster:spin-up:tbchn": "kubectl scale statefulsets bitcoin-cash-node-testnet --replicas=1", "dev-cluster:spin-down:hasura": "kubectl scale deployment hasura --replicas=0", "dev-cluster:spin-up:hasura": "kubectl scale deployment hasura --replicas=1", "dev-cluster:spin-down:postgres": "kubectl scale statefulsets postgres --replicas=0",