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(mojaloop/#3412): extend callback handler to mock oracle and central admin apis #12

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
7 changes: 6 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
ML_API_ADAPTER_VERSION=v14.0.0
ACCOUNT_LOOKUP_SERVICE_VERSION=v14.2.2
QUOTING_SERVICE_VERSION=v15.0.2
CENTRAL_LEDGER_VERSION=v17.0.3
CENTRAL_LEDGER_VERSION=v17.0.3

# Callback Handler SVC Env Vars
FSPIOP_ALS_ENDPOINT_URL=http://account-lookup-service:4002
FSPIOP_FSP_ID=perffsp2
FSPIOP_CALLBACK_URL=http://callback-handler-svc:3001
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,23 @@ cat ttk-tests-console.log
ls reports/ttk-func-tests-report.html reports/ttk-provisioning-report.html
```

## Monitoring
## Performance Characterization

### Running ALS with dependencies

```bash
docker compose --project-name ml-core -f docker-compose-perf.yml --profile all-services --profile ttk-provisioning up -d
```

Stop Services

```bash
docker compose --project-name ml-core -f docker-compose-perf.yml --profile all-services down -v
```

> NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose

### Monitoring

Start Monitoring Services stack which uses:
- [Prometheus](https://prometheus.io) for time series data store
Expand All @@ -176,21 +192,21 @@ Start Monitoring Services stack which uses:
- [CAdviser](https://github.com/google/cadvisor) to instrument the Docker containers running on Host machine

```bash
docker-compose --project-name monitoring -f docker-compose-monitoring.yml up -d
docker compose --project-name monitoring -f docker-compose-monitoring.yml up -d
```

Stop Monitoring Services

```bash
docker-compose --project-name monitoring -f docker-compose-monitoring.yml down -v
docker compose --project-name monitoring -f docker-compose-monitoring.yml down -v
```

> NOTE: `-v` argument is optional, and it will delete any volume data created by the monitoring docker compose

TODO:
- add note about network being created by main docker-compose, or it can be done manually.
- add note about network being created by docker-compose-perf.yml, or it can be done manually.

## Performance Characterization
### Load Tests

[K6](https://k6.io) is being used to execute performance tests, with metrics being captured by [Prometheus](https://k6.io/docs/results-output/real-time/prometheus-remote-write) and displayed using [Grafana](https://k6.io/docs/results-output/real-time/prometheus-remote-write/#time-series-visualization).

Expand Down
23 changes: 0 additions & 23 deletions docker-compose-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,3 @@ services:
- mojaloop-net
- monitoring-net
restart: always

callback-handler-svc:
container_name: callback-handler-svc
image: mojaloop/callback-handler-svc:local
build:
context: ./packages/callback-handler-svc
cache_from:
- mojaloop/callback-handler-svc:local
ports:
- "3001:3001"
networks:
- monitoring-net
- mojaloop-net
volumes:
- ./packages/callback-handler-svc/config:/opt/app/dist/config
environment:
- LOG_LEVEL=info
healthcheck:
test: wget -q http://localhost:3001/health -O /dev/null || exit 1
timeout: 20s
retries: 30
interval: 15s
user: root
156 changes: 156 additions & 0 deletions docker-compose-perf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
version: "3.7"

networks:
mojaloop-net:
name: mojaloop-net

services:

account-lookup-service:
image: mojaloop/account-lookup-service:${ACCOUNT_LOOKUP_SERVICE_VERSION}
scale: 1
command: sh -c "/opt/app/config-modifier/run.js /opt/app/config/default.json /opt/app/config-modifier/configs/account-lookup-service.js /opt/app/config/default.json && /opt/app/wait4/wait4.js account-lookup-service && npm run migrate && node src/index.js server"
# ports:
# - "4001:4001"
# - "4002:4002"
environment:
- LOG_LEVEL=info
- ALS_DISPLAY_ROUTES=false
- ALS_SWITCH_ENDPOINT=http://callback-handler-svc:3001/admin
- WAIT4_CONFIG=./wait4.config.perf-als.js
- EVENT_SDK_TRACEID_PER_VENDOR=false
networks:
- mojaloop-net
depends_on:
mysql-als:
condition: service_started
volumes:
- ./docker/wait4:/opt/app/wait4
- ./docker/config-modifier:/opt/app/config-modifier
healthcheck:
test: wget -q http://localhost:4001/health -O /dev/null || exit 1
timeout: 20s
retries: 10
start_period: 40s
interval: 30s
user: root
profiles:
- account-lookup-service
- discovery
- all-services

mysql-als:
image: mysql/mysql-server
container_name: mysql-als
ports:
- "3307:3306"
volumes:
- ./docker/sql-als-init/:/docker-entrypoint-initdb.d/
environment:
- MYSQL_USER=${DBUSER:-account_lookup}
- MYSQL_PASSWORD=${DBPASS:-password}
- MYSQL_DATABASE=${DBUSER:-account_lookup}
- MYSQL_ALLOW_EMPTY_PASSWORD=true
networks:
- mojaloop-net
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "mysql-als"]
timeout: 20s
retries: 10
start_period: 40s
interval: 30s
profiles:
- account-lookup-service
- discovery
- all-services

## Testing Toolkit
mojaloop-testing-toolkit:
image: mojaloop/ml-testing-toolkit:v16.1.1
volumes:
- "./docker/ml-testing-toolkit/spec_files:/opt/app/spec_files"
- "./docker/ml-testing-toolkit/test-cases:/opt/app/examples"
ports:
- "4040:4040"
- "5050:5050"
user: root
command:
- sh
- -c
- "npm start"
networks:
- mojaloop-net
healthcheck:
test: ["CMD-SHELL", "nc -z -v localhost 4040"]
interval: 5s
timeout: 10s
start_period: 10s
retries: 10
profiles:
- testing-toolkit
- all-services

mojaloop-testing-toolkit-ui:
image: mojaloop/ml-testing-toolkit-ui:v15.3.0
ports:
- "6060:6060"
environment:
# - API_BASE_URL=http://localhost:5050
- AUTH_ENABLED=FALSE
command:
- sh
- /usr/share/nginx/start.sh
networks:
- mojaloop-net
profiles:
- testing-toolkit
- all-services

ttk-provisioning:
image: mojaloop/ml-testing-toolkit-client-lib:v1.2.0
volumes:
- "./docker/ml-testing-toolkit/test-cases/collections:/opt/app/collections"
- "./docker/ml-testing-toolkit/test-cases/environments:/opt/app/environments"
- "./reports:/opt/app/reports"
depends_on:
mojaloop-testing-toolkit:
condition: service_healthy
account-lookup-service:
condition: service_healthy
networks:
- mojaloop-net
command:
- sh
- -c
- "npm run cli -- -u http://mojaloop-testing-toolkit:5050 -l 2 -i collections/provisioning-perf-als -e environments/default-env.json --save-report --report-format html --report-target file://reports/ttk-provisioning-report.html"
user: root
profiles:
- ttk-provisioning

callback-handler-svc:
scale: 1
image: mojaloop/callback-handler-svc:local
env_file:
- .env
build:
context: ./packages/callback-handler-svc
cache_from:
- mojaloop/callback-handler-svc:local
ports:
- "3001:3001"
networks:
- mojaloop-net
volumes:
- ./packages/callback-handler-svc/config:/opt/app/config
- ./packages/callback-handler-svc/handlers:/opt/app/handlers
environment:
- LOG_LEVEL=info
healthcheck:
test: wget -q http://localhost:3001/health -O /dev/null || exit 1
timeout: 20s
retries: 30
interval: 15s
user: root
profiles:
- callback-handler
- all-services
Loading