From a5b2c00a9a85618fbf4f0beba7616a77f18e5ae5 Mon Sep 17 00:00:00 2001 From: Jason Sherman Date: Mon, 16 Dec 2024 14:40:41 -0800 Subject: [PATCH] FORMS-1671: Connect to ESS via NATS protocol Signed-off-by: Jason Sherman --- .devcontainer/chefs_local/test.json | 2 ++ app/config/custom-environment-variables.json | 1 + app/config/default.json | 1 + .../designer/settings/FormEventStreamSettings.vue | 2 +- openshift/README.md | 6 +----- openshift/app.dc.yaml | 10 ---------- openshift/ess.cm.yaml | 15 +++++++++++++++ openshift/ess.dev.param | 5 ++++- openshift/ess.prod.param | 5 ++++- openshift/ess.test.param | 5 ++++- 10 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.devcontainer/chefs_local/test.json b/.devcontainer/chefs_local/test.json index bf781161d..b5472c4aa 100644 --- a/.devcontainer/chefs_local/test.json +++ b/.devcontainer/chefs_local/test.json @@ -63,6 +63,8 @@ }, "eventStreamService": { "servers": "localhost:4222,localhost:4223,localhost:4224", + "websockets": "false", + "consumerservers": "localhost:4222,localhost:4223,localhost:4224", "streamName": "CHEFS", "source": "chefs", "domain": "forms", diff --git a/app/config/custom-environment-variables.json b/app/config/custom-environment-variables.json index e9a8b34ab..17d6f23b1 100755 --- a/app/config/custom-environment-variables.json +++ b/app/config/custom-environment-variables.json @@ -61,6 +61,7 @@ "eventStreamService": { "servers": "EVENTSTREAMSERVICE_SERVERS", "websockets": "EVENTSTREAMSERVICE_WEBSOCKETS", + "consumerservers": "EVENTSTREAMSERVICE_CONSUMERSERVERS", "streamName": "EVENTSTREAMSERVICE_STREAMNAME", "source": "EVENTSTREAMSERVICE_SOURCE", "domain": "EVENTSTREAMSERVICE_DOMAIN", diff --git a/app/config/default.json b/app/config/default.json index 0cb75ba33..08606d032 100644 --- a/app/config/default.json +++ b/app/config/default.json @@ -65,6 +65,7 @@ "eventStreamService": { "servers": "localhost:4222,localhost:4223,localhost:4224", "websockets": "false", + "consumerservers": "localhost:4222,localhost:4223,localhost:4224", "streamName": "CHEFS", "source": "chefs-local", "domain": "forms", diff --git a/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue b/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue index 93051f4fb..6583e9972 100644 --- a/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue +++ b/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue @@ -127,7 +127,7 @@ defineExpose({ >{{ $t('trans.formSettings.serversLabel') }}: {{ - appStore.config?.eventStreamService?.servers + appStore.config?.eventStreamService?.consumerservers }}
diff --git a/openshift/README.md b/openshift/README.md index f8646e619..2d8d5b5d7 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -157,18 +157,14 @@ oc create -n $NAMESPACE secret generic $APP_NAME-encryption-keys \ --from-literal=proxy=$proxy_key ``` -We need to store a password for Event Stream Service client. Since the server(s) will change along with the password, we will store the server and credentials in a secret per environment (DEV, TEST, PROD) and whether we connect with WebSockets or NATS protocols Pull requests can use the same as DEV. +We need to store a username/password for Event Stream Service client. Additional configuration (Stream name, servers, stream limits) is in a Config Map: `chefs-XXX-event-stream-service`. ```sh -export ess_servers= -export ess_websockets= export ess_password= oc create -n $NAMESPACE secret generic $APP_NAME-event-stream-service \ --type=Opaque \ - --from-literal=servers=$ess_servers \ - --from-literal=websockets=$ess_websockets \ --from-literal=username=chefs \ --from-literal=password=$ess_password ``` diff --git a/openshift/app.dc.yaml b/openshift/app.dc.yaml index 7afebe3a7..df6d8a4d3 100644 --- a/openshift/app.dc.yaml +++ b/openshift/app.dc.yaml @@ -233,16 +233,6 @@ objects: secretKeyRef: key: mailapitoken name: "chefs-${JOB_NAME}-secret" - - name: EVENTSTREAMSERVICE_SERVERS - valueFrom: - secretKeyRef: - key: servers - name: "${APP_NAME}-event-stream-service" - - name: EVENTSTREAMSERVICE_WEBSOCKETS - valueFrom: - secretKeyRef: - key: websockets - name: "${APP_NAME}-event-stream-service" - name: EVENTSTREAMSERVICE_USERNAME valueFrom: secretKeyRef: diff --git a/openshift/ess.cm.yaml b/openshift/ess.cm.yaml index 845619b8d..935e51ad5 100644 --- a/openshift/ess.cm.yaml +++ b/openshift/ess.cm.yaml @@ -17,6 +17,9 @@ objects: metadata: name: "${APP_NAME}-${JOB_NAME}-event-stream-service" data: + EVENTSTREAMSERVICE_SERVERS: ${SERVERS} + EVENTSTREAMSERVICE_WEBSOCKETS: ${WEBSOCKETS} + EVENTSTREAMSERVICE_CONSUMERSERVERS: ${CONSUMERSERVERS} EVENTSTREAMSERVICE_STREAMNAME: ${STREAMNAME} EVENTSTREAMSERVICE_SOURCE: ${SOURCE} EVENTSTREAMSERVICE_DOMAIN: ${DOMAIN} @@ -35,6 +38,18 @@ parameters: description: Job identifier (i.e. 'pr-5' OR 'master') displayName: Job Branch Name required: true + - name: SERVERS + description: Comma separated list of NATS servers for Event Stream Service + displayName: Event Stream NATS servers + required: true + - name: WEBSOCKETS + description: Connect to ESS via websockets or NATS protocol + displayName: Connect with websockets + required: true + - name: CONSUMERSERVERS + description: ESS Servers for consumer configuration + displayName: ESS Servers (consumers) + required: true - name: STREAMNAME description: Name of the CHEFS Event Stream displayName: CHEFS Event Stream name diff --git a/openshift/ess.dev.param b/openshift/ess.dev.param index db79f8b97..26cfafc3b 100644 --- a/openshift/ess.dev.param +++ b/openshift/ess.dev.param @@ -6,4 +6,7 @@ MAXBYTES="966367641" MAXMSGS="1000" MAXMSGSIZE="966367" DUPLICATEWINDOW="60000" -NUMREPLICAS="3" \ No newline at end of file +NUMREPLICAS="3" +SERVERS=ess-nats.a191b5-dev.svc.cluster.local +WEBSOCKETS=false +CONSUMERSERVERS=stream-dev.apps.silver.devops.gov.bc.ca \ No newline at end of file diff --git a/openshift/ess.prod.param b/openshift/ess.prod.param index 7f45ab835..5043d8854 100644 --- a/openshift/ess.prod.param +++ b/openshift/ess.prod.param @@ -6,4 +6,7 @@ MAXBYTES="966367641" MAXMSGS="1000" MAXMSGSIZE="966367" DUPLICATEWINDOW="60000" -NUMREPLICAS="3" \ No newline at end of file +NUMREPLICAS="3" +SERVERS=ess-nats.a191b5-prod.svc.cluster.local +WEBSOCKETS=false +CONSUMERSERVERS=stream.digital.gov.bc.ca \ No newline at end of file diff --git a/openshift/ess.test.param b/openshift/ess.test.param index 1164c056d..b0d600591 100644 --- a/openshift/ess.test.param +++ b/openshift/ess.test.param @@ -6,4 +6,7 @@ MAXBYTES="209715200" MAXMSGS="500" MAXMSGSIZE="419430" DUPLICATEWINDOW="60000" -NUMREPLICAS="3" \ No newline at end of file +NUMREPLICAS="3" +SERVERS=ess-nats.a191b5-test.svc.cluster.local +WEBSOCKETS=false +CONSUMERSERVERS=stream-test.apps.silver.devops.gov.bc.ca \ No newline at end of file