From cad2d912d6c126b8bca2aea9f58541170dbb1ed1 Mon Sep 17 00:00:00 2001 From: Walter Moar Date: Thu, 9 Jan 2025 10:56:15 -0800 Subject: [PATCH 1/5] build: FORMS-1699 dompurify vulnerability fix (#1572) --- app/frontend/package-lock.json | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/frontend/package-lock.json b/app/frontend/package-lock.json index 130934a0c..3f00a137c 100644 --- a/app/frontend/package-lock.json +++ b/app/frontend/package-lock.json @@ -1232,6 +1232,13 @@ "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==", "devOptional": true }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, "node_modules/@types/web-bluetooth": { "version": "0.0.20", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", @@ -2454,9 +2461,13 @@ } }, "node_modules/dompurify": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.6.tgz", - "integrity": "sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w==" + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.3.tgz", + "integrity": "sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } }, "node_modules/downloadjs": { "version": "1.4.7", From 3e67c1cee979135756789f82c9c3f2a9eb606bdb Mon Sep 17 00:00:00 2001 From: Walter Moar Date: Thu, 9 Jan 2025 11:05:03 -0800 Subject: [PATCH 2/5] docs: FORMS-1700 remove extra license template (#1573) --- app/frontend/LICENSE | 201 ------------------------------------------- 1 file changed, 201 deletions(-) delete mode 100755 app/frontend/LICENSE diff --git a/app/frontend/LICENSE b/app/frontend/LICENSE deleted file mode 100755 index 261eeb9e9..000000000 --- a/app/frontend/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. From 678e5e6e496aaa1a99246aed969e0bbf65707ada Mon Sep 17 00:00:00 2001 From: usingtechnology <39388115+usingtechnology@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:40:32 -0800 Subject: [PATCH 3/5] FORMS-1693: add nats to chefs_local docker compose (#1567) * FORMS-1693: add nats to chefs_local docker compose Include nats infrastructure with db for local development. Signed-off-by: Jason Sherman * mention nats in start up documentation Signed-off-by: Jason Sherman --------- Signed-off-by: Jason Sherman --- .devcontainer/README.md | 6 +- .../chefs_local}/config/jetstream.conf | 0 .devcontainer/chefs_local/docker-compose.yml | 64 ++++++++++++++++++ .devcontainer/devcontainer.json | 5 +- .vscode/README.md | 4 +- event-stream-service/README.md | 12 +++- event-stream-service/docker-compose.yml | 65 ------------------- 7 files changed, 84 insertions(+), 72 deletions(-) rename {event-stream-service => .devcontainer/chefs_local}/config/jetstream.conf (100%) delete mode 100644 event-stream-service/docker-compose.yml diff --git a/.devcontainer/README.md b/.devcontainer/README.md index d5e130caa..114ba82d7 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -15,7 +15,7 @@ There are limitations running this devcontainer, such as all networking is withi The `.devcontainer` folder contains the `devcontainer.json` file which defines this container. We are using a `Dockerfile` and `post-install.sh` to build and configure the container run image. The `Dockerfile` is simple but in place for simplifying image enhancements. The `post-install.sh` will install the required node libraries for CHEFS including the frontend and formio components. -In order to run CHEFS you require Postgresql (seeded) and the CHEFS backend/API and frontend/UX. Previously, this was a series of downloads and configuration updates and numerous commands to run. See `.devcontainer/chefs_local` files. +In order to run CHEFS you require Postgresql (seeded) and the CHEFS backend/API and frontend/UX - optionally you will use a [NATS](https://nats.io/) server for event streaming. Previously, this was a series of downloads and configuration updates and numerous commands to run. See `.devcontainer/chefs_local` files. **NODE_CONFIG_DIR** to simplify loading a default configuration to the CHEFS infrastructure (Postgresql, etc), we set an environment variable [`NODE_CONFIG_DIR`](https://github.com/node-config/node-config/wiki/Environment-Variables#node_config_dir). This supercedes the files found under `app/config`. Running node apps and commands (ex. knex, launch configurations) will use this environment variable and load configuration from `.devcontainer/chefs_local`. @@ -44,7 +44,7 @@ When the devcontainer is built, it copies `.devcontainer/chefs_local/local.sampl ### Run/Debug -1. start Postgresql. Many ways to start... +1. start Postgresql and NATS. Many ways to start... - right click on `.devcontainer/chefs_local/docker-compose.yml` and select `Compose up` - or use command palette `Docker: Compose Up` then select `.devcontainer/chefs_local/docker-compose.yml` - or `Terminal | Run Task...|chefs_local up` @@ -52,7 +52,7 @@ When the devcontainer is built, it copies `.devcontainer/chefs_local/local.sampl - Run and Debug, select 'CHEFS' which will start both the API and the frontend. 3. debug Frontend with Chrome - Run and Debug, select 'CHEFS Frontend - chrome' which will start a Chrome browser against the frontend, will allow breakpoints in `/app/frontend/src` -4. stop Postgresql. Many ways to stop... +4. stop Postgresql and NATS. Many ways to stop... - right click on `.devcontainer/chefs_local/docker-compose.yml` and select `Compose down` - or use command palette `Docker: Compose Down` then select `.devcontainer/chefs_local/docker-compose.yml` - or `Terminal | Run Task...|chefs_local down` diff --git a/event-stream-service/config/jetstream.conf b/.devcontainer/chefs_local/config/jetstream.conf similarity index 100% rename from event-stream-service/config/jetstream.conf rename to .devcontainer/chefs_local/config/jetstream.conf diff --git a/.devcontainer/chefs_local/docker-compose.yml b/.devcontainer/chefs_local/docker-compose.yml index 13e56614e..ea03d2dca 100644 --- a/.devcontainer/chefs_local/docker-compose.yml +++ b/.devcontainer/chefs_local/docker-compose.yml @@ -1,6 +1,22 @@ volumes: postgres_kc_data: driver: local + n1-data: + driver: local + n2-data: + driver: local + n3-data: + driver: local + +networks: + nats: + driver: bridge + ipam: + driver: default + config: + - subnet: "192.168.0.0/24" + gateway: "192.168.0.1" + services: postgres: image: postgres:14.2 @@ -13,3 +29,51 @@ services: - POSTGRES_USER=app - POSTGRES_PASSWORD=admin - POSTGRES_DB=chefs + + n1: + container_name: n1 + image: nats:2.10.12 + entrypoint: /nats-server + command: "--config /config/jetstream.conf --server_name S1" + networks: + - nats + ports: + - 4222:4222 + volumes: + - ./config:/config + - n1-data:/data/nats-server/jetstream + + n2: + container_name: n2 + image: nats:2.10.12 + entrypoint: /nats-server + command: "--config /config/jetstream.conf --server_name S2" + networks: + - nats + ports: + - 4223:4222 + volumes: + - ./config:/config + - n2-data:/data/nats-server/jetstream + + n3: + container_name: n3 + image: nats:2.10.12 + entrypoint: /nats-server + command: "--config /config/jetstream.conf --server_name S3" + networks: + - nats + ports: + - 4224:4222 + volumes: + - ./config:/config + - n3-data:/data/nats-server/jetstream + + natsbox: + container_name: natsbox + image: natsio/nats-box:latest + tty: true + stdin_open: true + command: sh + networks: + - nats diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 07caa6d53..f0f89f5af 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,7 +24,10 @@ 5173, // CHEFS Frontend 5432, // PostgreSQL 8080, // CHEFS Backend - 8081 + 8081, + 4222, //nats + 4223, //nats + 4224 // nats ], // Use 'postCreateCommand' to run commands after the container is created. diff --git a/.vscode/README.md b/.vscode/README.md index ed1b857da..61e302c05 100644 --- a/.vscode/README.md +++ b/.vscode/README.md @@ -19,8 +19,8 @@ Tasks can be run from the `Terminal` > `Run Task...` menu item. The `tasks.json` - `Unit Tests - Frontend`: run the unit tests for the Frontend - `Components Build`: build the formio components - `Components Deploy`: deploy the formio components. Build and deploy before serving the frontend will save lots of time. -- `chefs_local up`: when inside the devcontainer, will bring up postgresql for local CHEFS deployment. -- `chefs_local down`: when inside the devcontainer, will tear down running postgresql for local CHEFS deployment. +- `chefs_local up`: when inside the devcontainer, will bring up postgresql and nats for local CHEFS deployment. +- `chefs_local down`: when inside the devcontainer, will tear down running postgresql and nats for local CHEFS deployment. Tip: You can run the builtin `All Tests` task to run both of the unit tests at the same time. This is possible since they're both configured to be in the `test` group. diff --git a/event-stream-service/README.md b/event-stream-service/README.md index cbe74d929..f763e4931 100644 --- a/event-stream-service/README.md +++ b/event-stream-service/README.md @@ -2,11 +2,21 @@ To use `natsbox` in the devcontainer: +In one terminal (project root): + +- run `docker compose -f .devcontainer/chefs_local/docker-compose.yml up` + +Start natsbox and login + - terminal into `natsbox` -- run `nats context add nats --server nats://n1:4222 --description "N1" --select`. +- Under Docker tab, right click natsio/nats-box:latest and "Attach Shell" +- run `nats context add admin --server nats://n1:4222 --description "admin" --user=admin --password=password --select`. This will allow you to run `nats` command line commands against the local nats server. Get information about the `CHEFS` stream: - run `nats stream info CHEFS` +- run `nats s report` + +- run `exit` to leave shell diff --git a/event-stream-service/docker-compose.yml b/event-stream-service/docker-compose.yml deleted file mode 100644 index f9e8af2a5..000000000 --- a/event-stream-service/docker-compose.yml +++ /dev/null @@ -1,65 +0,0 @@ -services: - n1: - container_name: n1 - image: nats:2.10.12 - entrypoint: /nats-server - command: "--config /config/jetstream.conf --server_name S1" - networks: - - nats - ports: - - 4222:4222 - volumes: - - ./config:/config - - n1-data:/data/nats-server/jetstream - - n2: - container_name: n2 - image: nats:2.10.12 - entrypoint: /nats-server - command: "--config /config/jetstream.conf --server_name S2" - networks: - - nats - ports: - - 4223:4222 - volumes: - - ./config:/config - - n2-data:/data/nats-server/jetstream - - n3: - container_name: n3 - image: nats:2.10.12 - entrypoint: /nats-server - command: "--config /config/jetstream.conf --server_name S3" - networks: - - nats - ports: - - 4224:4222 - volumes: - - ./config:/config - - n3-data:/data/nats-server/jetstream - - natsbox: - container_name: natsbox - image: natsio/nats-box:latest - tty: true - stdin_open: true - command: sh - networks: - - nats - -networks: - nats: - driver: bridge - ipam: - driver: default - config: - - subnet: "192.168.0.0/24" - gateway: "192.168.0.1" - -volumes: - n1-data: - driver: local - n2-data: - driver: local - n3-data: - driver: local From 0ef43943f2055b853d8c94eea27c28cde408e9cc Mon Sep 17 00:00:00 2001 From: usingtechnology <39388115+usingtechnology@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:01:57 -0800 Subject: [PATCH 4/5] FORMS-1671: Connect to ESS via NATS protocol (#1547) * FORMS-1671: Connect to ESS via NATS protocol Signed-off-by: Jason Sherman * add some ux tests Signed-off-by: Jason Sherman --------- Signed-off-by: Jason Sherman --- .devcontainer/chefs_local/test.json | 2 ++ app/config/custom-environment-variables.json | 1 + app/config/default.json | 1 + .../settings/FormEventStreamSettings.vue | 10 +++--- .../settings/FormEventStreamSettings.spec.js | 31 +++++++++++++++++++ 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 ++- 11 files changed, 68 insertions(+), 23 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..f26075d73 100644 --- a/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue +++ b/app/frontend/src/components/designer/settings/FormEventStreamSettings.vue @@ -126,8 +126,8 @@ defineExpose({ {{ $t('trans.formSettings.serversLabel') }}: - {{ - appStore.config?.eventStreamService?.servers + {{ + appStore.config?.eventStreamService?.consumerservers }}
@@ -135,7 +135,7 @@ defineExpose({ {{ $t('trans.formSettings.streamNameLabel') }}: - {{ + {{ appStore.config?.eventStreamService?.streamName }} @@ -144,7 +144,7 @@ defineExpose({ {{ $t('trans.formSettings.sourceLabel') }}: - {{ + {{ appStore.config?.eventStreamService?.source }} @@ -153,7 +153,7 @@ defineExpose({ {{ $t('trans.formSettings.domainLabel') }}: - {{ + {{ appStore.config?.eventStreamService?.domain }} diff --git a/app/frontend/tests/unit/components/designer/settings/FormEventStreamSettings.spec.js b/app/frontend/tests/unit/components/designer/settings/FormEventStreamSettings.spec.js index 1993ffd76..27d8e1d6c 100644 --- a/app/frontend/tests/unit/components/designer/settings/FormEventStreamSettings.spec.js +++ b/app/frontend/tests/unit/components/designer/settings/FormEventStreamSettings.spec.js @@ -4,6 +4,7 @@ import { setActivePinia } from 'pinia'; import { beforeEach, describe, expect, it } from 'vitest'; import { ref } from 'vue'; +import { useAppStore } from '~/store/app'; import { useFormStore } from '~/store/form'; import FormEventStreamSettings from '~/components/designer/settings/FormEventStreamSettings.vue'; @@ -12,11 +13,41 @@ describe('FormEventStreamSettings.vue', () => { setActivePinia(pinia); const formStore = useFormStore(pinia); + const appStore = useAppStore(pinia); beforeEach(() => { + appStore.$reset(); formStore.$reset(); }); + it('renders eventStreamService configuration', async () => { + appStore.config = ref({ + eventStreamService: { + consumerservers: 'http://consumerservers.com', + streamName: 'stream', + source: 'src', + domain: 'domain', + }, + }); + const wrapper = mount(FormEventStreamSettings, { + global: { + plugins: [pinia], + stubs: { + BasePanel: { + name: 'BasePanel', + template: '
', + }, + }, + }, + }); + expect(wrapper.find('[data-test="consumerservers"]').text()).toContain( + 'http://consumerservers.com' + ); + expect(wrapper.find('[data-test="streamName"]').text()).toContain('stream'); + expect(wrapper.find('[data-test="source"]').text()).toContain('src'); + expect(wrapper.find('[data-test="domain"]').text()).toContain('domain'); + }); + it('generates an encryption key when it has an algorithm', async () => { formStore.form = ref({ eventStreamConfig: { diff --git a/openshift/README.md b/openshift/README.md index 9df6351cf..47d20d586 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -148,18 +148,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 From 4b48a6c4fc8629fa950dd73ab5051b471eed484e Mon Sep 17 00:00:00 2001 From: usingtechnology <39388115+usingtechnology@users.noreply.github.com> Date: Fri, 10 Jan 2025 07:51:22 -0800 Subject: [PATCH 5/5] FORMS-1701: resource key typo (#1574) Admin / External API Send API Key i18n key typo Signed-off-by: Jason Sherman --- app/frontend/src/components/admin/AdminAPIsTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/src/components/admin/AdminAPIsTable.vue b/app/frontend/src/components/admin/AdminAPIsTable.vue index fd427de1b..8ab973433 100644 --- a/app/frontend/src/components/admin/AdminAPIsTable.vue +++ b/app/frontend/src/components/admin/AdminAPIsTable.vue @@ -301,7 +301,7 @@ async function saveItem() { >