Skip to content

Commit

Permalink
FORMS-1671: Connect to ESS via NATS protocol
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
  • Loading branch information
usingtechnology committed Dec 16, 2024
1 parent e8324f9 commit a5b2c00
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/chefs_local/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions app/config/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"eventStreamService": {
"servers": "EVENTSTREAMSERVICE_SERVERS",
"websockets": "EVENTSTREAMSERVICE_WEBSOCKETS",
"consumerservers": "EVENTSTREAMSERVICE_CONSUMERSERVERS",
"streamName": "EVENTSTREAMSERVICE_STREAMNAME",
"source": "EVENTSTREAMSERVICE_SOURCE",
"domain": "EVENTSTREAMSERVICE_DOMAIN",
Expand Down
1 change: 1 addition & 0 deletions app/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ defineExpose({
>{{ $t('trans.formSettings.serversLabel') }}:
</span>
<span class="ml-2">{{
appStore.config?.eventStreamService?.servers
appStore.config?.eventStreamService?.consumerservers
}}</span>
</span>
<br />
Expand Down
6 changes: 1 addition & 5 deletions openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<comma separated list of event stream servers>
export ess_websockets=<true/false - true if connection is made via websockets>
export ess_password=<chefs password from event stream service>

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
```
Expand Down
10 changes: 0 additions & 10 deletions openshift/app.dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions openshift/ess.cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion openshift/ess.dev.param
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ MAXBYTES="966367641"
MAXMSGS="1000"
MAXMSGSIZE="966367"
DUPLICATEWINDOW="60000"
NUMREPLICAS="3"
NUMREPLICAS="3"
SERVERS=ess-nats.a191b5-dev.svc.cluster.local
WEBSOCKETS=false
CONSUMERSERVERS=stream-dev.apps.silver.devops.gov.bc.ca
5 changes: 4 additions & 1 deletion openshift/ess.prod.param
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ MAXBYTES="966367641"
MAXMSGS="1000"
MAXMSGSIZE="966367"
DUPLICATEWINDOW="60000"
NUMREPLICAS="3"
NUMREPLICAS="3"
SERVERS=ess-nats.a191b5-prod.svc.cluster.local
WEBSOCKETS=false
CONSUMERSERVERS=stream.digital.gov.bc.ca
5 changes: 4 additions & 1 deletion openshift/ess.test.param
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ MAXBYTES="209715200"
MAXMSGS="500"
MAXMSGSIZE="419430"
DUPLICATEWINDOW="60000"
NUMREPLICAS="3"
NUMREPLICAS="3"
SERVERS=ess-nats.a191b5-test.svc.cluster.local
WEBSOCKETS=false
CONSUMERSERVERS=stream-test.apps.silver.devops.gov.bc.ca

0 comments on commit a5b2c00

Please sign in to comment.