Skip to content

Commit

Permalink
Merge branch 'main' into test/forms-1620
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot authored Jan 10, 2025
2 parents 3b07324 + 4b48a6c commit d426ad9
Show file tree
Hide file tree
Showing 21 changed files with 167 additions and 300 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down Expand Up @@ -44,15 +44,15 @@ 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`
2. start CHEFS
- 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`
Expand Down
File renamed without changes.
64 changes: 64 additions & 0 deletions .devcontainer/chefs_local/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
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
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions .vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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
201 changes: 0 additions & 201 deletions app/frontend/LICENSE

This file was deleted.

17 changes: 14 additions & 3 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/frontend/src/components/admin/AdminAPIsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ async function saveItem() {
>
<template #label>
<span :class="{ 'mr-2': isRTL }" :lang="lang">
{{ $t('trans.externalAPI.formSendApiKeynpm run migrate') }}
{{ $t('trans.externalAPI.formSendApiKey') }}
</span>
</template>
</v-checkbox>
Expand Down
Loading

0 comments on commit d426ad9

Please sign in to comment.