From bd1f8cfe563adcc49ebdbfc5e58f6a0f4e01acad Mon Sep 17 00:00:00 2001 From: Jason Sherman Date: Wed, 4 Sep 2024 15:40:20 -0700 Subject: [PATCH] add cicd param files for dev/test/prod Signed-off-by: Jason Sherman --- .github/actions/deploy-to-environment/action.yaml | 2 +- event-stream-service/pullConsumer.js | 12 +++++++++--- openshift/ess.dev.param | 4 ++++ openshift/ess.prod.param | 4 ++++ openshift/ess.test.param | 4 ++++ 5 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 openshift/ess.dev.param create mode 100644 openshift/ess.prod.param create mode 100644 openshift/ess.test.param diff --git a/.github/actions/deploy-to-environment/action.yaml b/.github/actions/deploy-to-environment/action.yaml index 0c6bf5c49..cf72c8751 100644 --- a/.github/actions/deploy-to-environment/action.yaml +++ b/.github/actions/deploy-to-environment/action.yaml @@ -96,7 +96,7 @@ runs: if [[ "${{ inputs.job_name }}" == pr-* ]]; then oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/ess.cm.yaml -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} -p SOURCE=${{ inputs.job_name }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f - else - oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/ess.cm.yaml -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} -p SOURCE=${{ inputs.acronym }} -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f - + oc process --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f openshift/ess.cm.yaml -p APP_NAME=${{ inputs.acronym }} -p JOB_NAME=${{ inputs.job_name }} --param-file=openshift/ess.${{ inputs.namespace_environment }}.param -o yaml | oc apply --namespace ${{ inputs.namespace_prefix }}-${{ inputs.namespace_environment }} -f - fi - name: Deploy App diff --git a/event-stream-service/pullConsumer.js b/event-stream-service/pullConsumer.js index c23984be4..775b0f11e 100644 --- a/event-stream-service/pullConsumer.js +++ b/event-stream-service/pullConsumer.js @@ -6,7 +6,13 @@ globalThis.WebSocket = require("websocket").w3cwebsocket; const { connect } = require("nats.ws"); // connection info -const servers = ["ess-a191b5-dev.apps.silver.devops.gov.bc.ca"]; //["localhost:4222", "localhost:4223", "localhost:4224"]; +let servers = []; +if (process.env.SERVERS) { + servers = process.env.SERVERS.split(","); +} else { + // running locally + servers = ["localhost:4222", "localhost:4223", "localhost:4224"]; +} let nc = undefined; // nats connection let js = undefined; // jet stream @@ -18,8 +24,7 @@ const STREAM_NAME = "CHEFS"; const FILTER_SUBJECTS = ["PUBLIC.forms.>", "PRIVATE.forms.>"]; const MAX_MESSAGES = 2; const DURABLE_NAME = "pullConsumer"; -const ENCRYPTION_KEY = - "ad5520469720325d1694c87511afda28a0432dd974cb77b5b4b9f946a5af6985"; +const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY || undefined; const printMsg = (m) => { // illustrate grabbing the sequence and timestamp from the nats message... @@ -64,6 +69,7 @@ const init = async () => { console.log(`connect to nats server(s) ${servers} as 'anonymous'...`); nc = await connect({ servers: servers, + reconnectTimeWait: 10 * 1000, // 10s }); console.log("access jetstream..."); diff --git a/openshift/ess.dev.param b/openshift/ess.dev.param new file mode 100644 index 000000000..d55eeefa0 --- /dev/null +++ b/openshift/ess.dev.param @@ -0,0 +1,4 @@ +FEATURE=false +STREAMNAME=CHEFS +SOURCE=chefs-dev +DOMAIN=forms \ No newline at end of file diff --git a/openshift/ess.prod.param b/openshift/ess.prod.param new file mode 100644 index 000000000..1c7619386 --- /dev/null +++ b/openshift/ess.prod.param @@ -0,0 +1,4 @@ +FEATURE=false +STREAMNAME=CHEFS +SOURCE=chefs +DOMAIN=forms diff --git a/openshift/ess.test.param b/openshift/ess.test.param new file mode 100644 index 000000000..1874d4f90 --- /dev/null +++ b/openshift/ess.test.param @@ -0,0 +1,4 @@ +FEATURE=false +STREAMNAME=CHEFS +SOURCE=chefs-test +DOMAIN=forms \ No newline at end of file