Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Subscribe to new parcel notifications in PoWeb via Redis PubSub #1069

Merged
merged 14 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions chart/dev-backing-services/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ dependencies:
- name: stan
version: 0.7.2
repository: https://nats-io.github.io/k8s/helm/charts
- name: redis
version: 16.12.2
repository: https://charts.bitnami.com/bitnami

# Pong app
- name: relaynet-pong
version: 3.0.37
repository: https://h.cfcr.io/relaycorp/public
alias: pong
- name: redis
version: 16.12.2
repository: https://charts.bitnami.com/bitnami
19 changes: 10 additions & 9 deletions chart/dev-backing-services/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ stan:
store:
type: memory

# Relaynet Pong dependencies
redis:
fullnameOverride: redis
auth:
enabled: false
architecture: standalone
master:
persistence:
enabled: false

# Awala Pong dependencies
pong:
fullnameOverride: pong
pohttp_tls_required: false
Expand All @@ -54,11 +63,3 @@ pong:
session_keys_mount_path: pong-keys
redis:
host: redis-headless
redis:
fullnameOverride: redis
auth:
enabled: false
architecture: standalone
master:
persistence:
enabled: false
2 changes: 2 additions & 0 deletions chart/templates/global-cm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ data:
NATS_SERVER_URL: {{ .Values.nats.serverUrl }}
NATS_CLUSTER_ID: {{ .Values.nats.clusterId }}

REDIS_URL: {{ .Values.redis.url }}

OBJECT_STORE_BACKEND: {{ .Values.objectStore.backend }}
OBJECT_STORE_BUCKET: {{ .Values.objectStore.bucket }}
{{- if .Values.objectStore.endpoint }}
Expand Down
3 changes: 3 additions & 0 deletions chart/values.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ nats:
serverUrl: nats://nats:4222
clusterId: stan

redis:
url: redis://redis-headless:6379

objectStore:
backend: minio
endpoint: minio:9000
Expand Down
11 changes: 11 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"pdcQueue",
"mongo",
"nats",
"redis",
"keystore"
],
"properties": {
Expand Down Expand Up @@ -132,6 +133,16 @@
}
}
},
"redis": {
"type": "object",
"required": ["url"],
"properties": {
"url": {
"type": "string",
"format": "uri"
}
}
},
"objectStore": {
"type": "object",
"required": ["backend", "bucket"],
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ crcQueue:
mongo: {}

nats: {}
redis: {}

objectStore:
tlsEnabled: true
Expand Down
9 changes: 7 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ This server is used to store parcels and cargoes under the following object key

### NATS Streaming

[NAT Streaming](https://docs.nats.io/nats-streaming-concepts/intro) is used for inter-component communication using asynchronous messaging. The following channels are used:
[NAT Streaming](https://docs.nats.io/nats-streaming-concepts/intro) is used for inter-component communication using asynchronous messaging, when we need messages to be persisted until a subscriber processes them. The following channels are used:

- `pdc-parcel.${privateGatewayId}` where `${privateGatewayId}` is the id of the private gateway. Parcels received via Internet-based PDCs (e.g., PoHTTP) are published on these channels.
- `internet-parcels`. Parcels bound for an internet.
- `crc-cargo`. Cargo received via CRC (e.g., CogRPC) are published here.

### Redis

[Redis PubSub](https://redis.io/docs/interact/pubsub/) is used for inter-component communication using asynchronous messaging, when we don't need messages to be persisted. The following channels are used:

- `pdc-parcel.${privateGatewayId}` where `${privateGatewayId}` is the id of the private gateway. Parcels received via Internet-based PDCs (e.g., PoHTTP) are published on these channels.

### HashiCorp Vault

[HashiCorp Vault](https://www.vaultproject.io/) is used to store the key pairs for identity and session keys.
Expand Down
3 changes: 3 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ mongo:
nats:
serverUrl: nats://nats.example.com:4222
clusterId: example-stan
redis:
url: redis://redis.example.com:6379
objectStore:
endpoint: minio.example.com:9000
bucket: public-gateway
Expand Down Expand Up @@ -101,6 +103,7 @@ Each gateway component has the following options:
| `mongo.password` | string | | MongoDB user password |
| `nats.serverUrl` | string | | Connection URI for NATS Streaming |
| `nats.clusterId` | string | | NATS Streaming cluster id |
| `redis.url` | string | | Connection URI for Redis |
| `objectStore.endpoint` | string | | Host name and port number for the object store server |
| `objectStore.bucket` | string | | Bucket name |
| `objectStore.accessKeyId` | string | | Access key id to the object store |
Expand Down
50 changes: 50 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@grpc/grpc-js": "^1.8.21",
"@redis/client": "^1.5.11",
"@relaycorp/awala-keystore-cloud": "^2.1.17",
"@relaycorp/awala-keystore-mongodb": "^1.1.19",
"@relaycorp/cogrpc": "^1.3.75",
Expand Down
Loading