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(csi-334): updated proxyCache lib to use redis cluster #342

Merged
merged 2 commits into from
Jul 24, 2024
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 config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
"enabled": false,
"type": "redis",
"proxyConfig": {
"host": "localhost",
"port": 6379,
"db": 0
"cluster": [
{ "host": "localhost", "port": 6379 }
]
}
},
"LOG_LEVEL": "info",
Expand Down
41 changes: 32 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ x-quoting-service: &quotingServiceBase
# central-ledger:
# condition: service_healthy # to perform test dfsp onboarding

x-redis-node: &REDIS_NODE
image: docker.io/bitnami/redis-cluster:6.2.14
environment: &REDIS_ENVS
ALLOW_EMPTY_PASSWORD: yes
REDIS_NODES: redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
timeout: 2s

x-healthcheck-params: &healthcheckParams
interval: 30s
timeout: 20s
Expand Down Expand Up @@ -97,17 +106,31 @@ services:
healthcheck:
<<: *healthcheckParams
test: [ "CMD", "mysqladmin" ,"ping", "-h", "mysql" ]

redis:
image: "redis:6.2.4-alpine"
container_name: redis

redis-node-0:
<<: *REDIS_NODE
environment:
<<: *REDIS_ENVS
REDIS_CLUSTER_CREATOR: yes
depends_on:
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
- redis-node-5
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3

redis-node-1:
<<: *REDIS_NODE
redis-node-2:
<<: *REDIS_NODE
redis-node-3:
<<: *REDIS_NODE
redis-node-4:
<<: *REDIS_NODE
redis-node-5:
<<: *REDIS_NODE

# mockserver:
# image: jamesdbloom/mockserver
Expand Down
6 changes: 3 additions & 3 deletions docker/quoting-service/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
"enabled": true,
"type": "redis",
"proxyConfig": {
"host": "redis",
"port": 6379,
"db": 0
"cluster": [
{ "host": "redis-node-0", "port": 6379 }
]
}
},
"KAFKA": {
Expand Down
86 changes: 66 additions & 20 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "quoting-service",
"description": "Quoting Service hosted by a scheme",
"license": "Apache-2.0",
"version": "15.8.0-snapshot.32",
"version": "15.8.0-snapshot.33",
"author": "ModusBox",
"contributors": [
"Georgi Georgiev <georgi.georgiev@modusbox.com>",
Expand Down Expand Up @@ -107,15 +107,15 @@
"@hapi/vision": "7.0.3",
"@mojaloop/central-services-error-handling": "13.0.1",
"@mojaloop/central-services-health": "15.0.0",
"@mojaloop/central-services-logger": "11.3.1",
"@mojaloop/central-services-logger": "11.4.5",
"@mojaloop/central-services-metrics": "12.0.8",
"@mojaloop/central-services-shared": "18.5.0-snapshot.2",
"@mojaloop/central-services-stream": "11.3.1",
"@mojaloop/event-sdk": "14.1.1",
"@mojaloop/inter-scheme-proxy-cache-lib": "^1.4.0",
"@mojaloop/inter-scheme-proxy-cache-lib": "2.0.0-snapshot.1",
"@mojaloop/ml-number": "11.2.4",
"@mojaloop/sdk-standard-components": "18.1.0",
"ajv": "8.16.0",
"ajv": "8.17.1",
"ajv-keywords": "5.1.0",
"axios": "1.7.2",
"blipp": "4.0.2",
Expand Down
4 changes: 0 additions & 4 deletions src/lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
const { createProxyCache } = require('@mojaloop/inter-scheme-proxy-cache-lib')

const createProxyClient = ({ proxyCacheConfig }) => {
// Ensure lazyConnect is set to true
if (!proxyCacheConfig.proxyConfig.lazyConnect) {
proxyCacheConfig.proxyConfig.lazyConnect = true
}
return createProxyCache(proxyCacheConfig.type, proxyCacheConfig.proxyConfig)
}

Expand Down