Skip to content

Commit

Permalink
chore(cf-idw): refactor witness service to use a different script dir
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmorano committed Jul 17, 2024
1 parent 7b38618 commit 684294b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions charts/cf-idw/templates/witness-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ metadata:
data:
witness-init.sh: |
#!/bin/bash
if [ ! -e ${KERI_SCRIPT_DIR}/db/witness/data.mdb ]; then
mkdir -p ${KERI_SCRIPT_DIR}/data
if [ ! -e ${KERI_VAR_DIR}/db/witness/data.mdb ]; then
mkdir -p ${KERI_VAR_DIR}/data
mkdir -p ${KERI_SCRIPT_DIR}/keri/cf
set -e
export KERIA_RENDERED_CURLS=$(for keria_curl in ${KERIA_CURLS}; do echo $keria_curl; done | jq -cRn '[inputs]')
envsubst < /configmap/witness.json.tpl > ${KERI_SCRIPT_DIR}/witness.json
envsubst < /configmap/witness.json.tpl > ${KERI_SCRIPT_DIR}/keri/cf/witness.json
kli init --name witness --nopasscode --config-dir ${KERI_SCRIPT_DIR} --config-file witness
kli incept --name witness --alias witness --config ${KERI_SCRIPT_DIR} --file /configmap/wil-witness-sample.json
fi
Expand Down
8 changes: 6 additions & 2 deletions charts/cf-idw/templates/witness-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ spec:
image: "{{ .image.repository }}:{{ .image.tag }}"
command: ["bash", "-x", "/configmap/witness-init.sh"]
env:
- name: KERI_SCRIPT_DIR
- name: KERI_VAR_DIR
value: /usr/local/var/keri
- name: KERI_SCRIPT_DIR
value: $(KERI_VAR_DIR)/scripts
- name: KERIA_CURLS
value: {{ .keriaCurls | default "http://keria:3901" | quote }}
volumeMounts:
Expand All @@ -50,8 +52,10 @@ spec:
image: "{{ .image.repository }}:{{ .image.tag }}"
command: ["bash", "-c", "exec kli witness start --name witness --alias witness"]
env:
- name: KERI_SCRIPT_DIR
- name: KERI_VAR_DIR
value: /usr/local/var/keri
- name: KERI_SCRIPT_DIR
value: $(KERI_VAR_DIR)/scripts
ports:
- containerPort: {{ .port | default 5631 }}
protocol: TCP
Expand Down

0 comments on commit 684294b

Please sign in to comment.