Skip to content
Snippets Groups Projects
Verified Commit 387942fd authored by Konstantin Tsabolov's avatar Konstantin Tsabolov
Browse files

chore: remove Aries Mediator Service

parent 45595e8d
No related branches found
No related tags found
No related merge requests found
export function sleep(ms: number): Promise<any> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
import assert from 'assert';
import { Server } from 'http';
import url from 'url';
import axios from 'axios';
import app from '../src/app';
const port = app.get('port') || 8998;
const getUrl = (pathname?: string): string =>
url.format({
hostname: app.get('host') || 'localhost',
protocol: 'http',
port,
pathname,
});
describe('Feathers application tests (with jest)', () => {
let server: Server;
beforeAll((done) => {
server = app.listen(port);
server.once('listening', () => done());
});
afterAll((done) => {
server.close(done);
});
it('starts and shows the index page', async () => {
expect.assertions(1);
const { data } = await axios.get(getUrl());
expect(data.indexOf('<html lang="en">')).not.toBe(-1);
});
describe('404', () => {
it('shows a 404 HTML page', async () => {
expect.assertions(2);
try {
await axios.get(getUrl('path/to/nowhere'), {
headers: {
Accept: 'text/html',
},
});
} catch (error) {
const { response } = error;
expect(response.status).toBe(404);
expect(response.data.indexOf('<html>')).not.toBe(-1);
}
});
it('shows a 404 JSON error without stack trace', async () => {
expect.assertions(4);
try {
await axios.get(getUrl('path/to/nowhere'));
} catch (error) {
const { response } = error;
expect(response.status).toBe(404);
expect(response.data.code).toBe(404);
expect(response.data.message).toBe('Page not found');
expect(response.data.name).toBe('NotFound');
}
});
});
});
import app from '../../src/app';
describe("'webhooks' service", () => {
it('registered the service', () => {
const service = app.service('webhooks/topic/:topic');
expect(service).toBeTruthy();
});
});
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./",
"strict": true,
"esModuleInterop": true,
"types": ["jest"]
}
}
# latest aca-py release:
#aries-cloudagent[indy,askar,bbs]
# aca-py main branch in github
git+https://github.com/hyperledger/aries-cloudagent-python.git#egg=aries-cloudagent[indy,askar,bbs]
#!/bin/bash
set -euxo pipefail
MEDIATOR_URL=${MEDIATOR_ENDPOINT_URL}
echo "Starting agent with endpoint(s): ${MEDIATOR_URL} wss://${MEDIATOR_URL#*://*}"
aca-py start \
--auto-provision \
--arg-file ${MEDIATOR_ARG_FILE} \
--label "${MEDIATOR_AGENT_LABEL}" \
--inbound-transport http 0.0.0.0 ${MEDIATOR_AGENT_HTTP_IN_PORT} \
--inbound-transport ws 0.0.0.0 ${MEDIATOR_AGENT_WS_IN_PORT} \
--outbound-transport ws \
--outbound-transport http \
--wallet-type indy \
--wallet-storage-type postgres_storage \
--admin 0.0.0.0 ${MEDIATOR_AGENT_HTTP_ADMIN_PORT} \
--admin-api-key ${MEDIATOR_AGENT_ADMIN_API_KEY} \
--endpoint ${MEDIATOR_URL} wss://${MEDIATOR_URL#*://*}
# Listen on all interfaces, default Caddy port
:2015 {
# This is the pattern that will be used to detect
# WebSockets
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
# Handle any traffic that matches the `@websockets` pattern
handle @websockets {
reverse_proxy http://mediator:3001
}
# Handle all other traffic.
handle {
reverse_proxy http://mediator:3000
}
# What logs should look like.
log {
output stdout
# format single_field common_log
level DEBUG
}
}
version: '3'
networks:
mediator-network:
volumes:
agency-wallet:
mediator-controller-data:
# x-env: &defaults
# MEDIATOR_CONTROLLER_PORT: ${MEDIATOR_CONTROLLER_PORT:-3010}
services:
caddy:
image: caddy
hostname: caddy
networks:
- mediator-network
ports: # Uncomment to access caddy outside of containers
- 8080:2015
# - 2019:2019
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
healthcheck:
# Port 2019 is an internal Caddy admin port.
test: nc -zv localhost:2019 || exit -1
interval: 3s
timeout: 3s
retries: 5
# ngrok:
# image: ngrok/ngrok
# # restart: unless-stopped
# hostname: ngrok
# depends_on:
# - caddy
# networks:
# - mediator-network
# environment:
# - NGROK_AUTHTOKEN=${NGROK_AUTHTOKEN}
# command: http caddy:2015 --log stdout
# # ports: # Uncomment to access ngrok outside of containers
# # - 4040:4040 # admin port
# healthcheck:
# test: /bin/bash -c "</dev/tcp/ngrok/4040"
# interval: 3s
# timeout: 3s
# retries: 5
# mediator-controller:
# image: node:fermium
# # restart: unless-stopped
# environment:
# - PORT=${MEDIATOR_CONTROLLER_PORT:-3010}
# - CONTROLLER_ADMIN_API_KEY=${MEDIATOR_CONTROLLER_ADMIN_API_KEY}
# - MEDIATOR_ADMIN_URL=${MEDIATOR_AGENT_ADMIN_URL-http://mediator:3002}
# - MEDIATOR_ADMIN_API_KEY=${MEDIATOR_AGENT_ADMIN_API_KEY}
# - MEDIATOR_ALIAS=${MEDIATOR_ALIAS}
# - LOG_LEVEL=${LOG_LEVEL}
# volumes:
# - ./acapy/controller:/usr/src/controller
# - mediator-controller-data:/usr/src/controller/node_modules
# # ports: # Uncomment to access controller outside of containers
# # - ${MEDIATOR_CONTROLLER_PORT:-3010}:${MEDIATOR_CONTROLLER_PORT:-3010}
# networks:
# - mediator-network
# working_dir: /usr/src/controller
# entrypoint: /bin/bash
# command: ["-c", "npm install; npm run dev"]
# healthcheck:
# test: /bin/bash -c "</dev/tcp/mediator-controller/3010"
# interval: 5s
# timeout: 5s
# retries: 5
mediator:
build:
context: .
dockerfile: acapy/Dockerfile.acapy
depends_on:
# mediator-controller:
# condition: service_healthy
- db
# ngrok:
# condition: service_healthy
restart: unless-stopped
environment:
- ENV=${ENV:-local}
- POSTGRESQL_HOST=${POSTGRESQL_HOST:-db}
- POSTGRESQL_PORT=${POSTGRESQL_PORT:-5435}
- ACAPY_WALLET_STORAGE_CONFIG={"url":"${POSTGRESQL_HOST:-db}:${POSTGRESQL_PORT:-5432}","wallet_scheme":"DatabasePerWallet"}
- ACAPY_WALLET_STORAGE_CREDS={"account":"${POSTGRESQL_USER:-postgres}","password":"${POSTGRESQL_PASSWORD:-development}","admin_account":"${POSTGRESQL_ADMIN_USER:-postgres}","admin_password":"${POSTGRESQL_ADMIN_PASSWORD:-development}"}
- ACAPY_WALLET_NAME=${MEDIATOR_WALLET_NAME:-mediator}
- ACAPY_WALLET_KEY=${MEDIATOR_WALLET_KEY:-testing}
- MEDIATOR_AGENT_HTTP_IN_PORT=${MEDIATOR_AGENT_HTTP_IN_PORT:-3000}
- MEDIATOR_AGENT_WS_IN_PORT=${MEDIATOR_AGENT_WS_IN_PORT:-3001}
- MEDIATOR_AGENT_HTTP_ADMIN_PORT=${MEDIATOR_AGENT_HTTP_ADMIN_PORT:-3002}
- MEDIATOR_AGENT_ADMIN_MODE=${MEDIATOR_AGENT_ADMIN_MODE:-admin-api-key 7gdmVBiJalMj52Oum50yD8neu/nxmv3/DTWcZPyKZ4K2UdNNwSPKgg==}
- MEDIATOR_AGENT_LABEL=${MEDIATOR_AGENT_LABEL:-Mediator}
- MEDIATOR_ENDPOINT_URL=${MEDIATOR_ENDPOINT_URL:-localhost}
- MEDIATOR_ARG_FILE=${MEDIATOR_ARG_FILE:-./configs/mediator-auto-accept.yml}
- MEDIATOR_CONTROLLER_WEBHOOK=${MEDIATOR_CONTROLLER_WEBHOOK:-http://mediator-controller:3010/webhooks}
- MEDIATOR_AGENT_ADMIN_API_KEY=${MEDIATOR_AGENT_ADMIN_API_KEY}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
# ports: # Uncomment to access mediator outside of containers
# - ${MEDIATOR_AGENT_HTTP_ADMIN_PORT:-3002}:${MEDIATOR_AGENT_HTTP_ADMIN_PORT:-3002}
# - ${MEDIATOR_AGENT_HTTP_IN_PORT:-3000}:${MEDIATOR_AGENT_HTTP_IN_PORT:-3000}
# - ${MEDIATOR_AGENT_WS_IN_PORT:-3001}:${MEDIATOR_AGENT_WS_IN_PORT:-3001}
networks:
- mediator-network
healthcheck:
test: /bin/bash -c "</dev/tcp/mediator/3000"
interval: 5s
timeout: 5s
retries: 5
db:
image: postgres:14.1-alpine
# restart: always
environment:
POSTGRES_PASSWORD: ${POSTGRESQL_ADMIN_PASSWORD:-development}
ports: # Uncomment to access postgres outside of containers
- '5435:5432'
networks:
- mediator-network
volumes:
- agency-wallet:/var/lib/pgsql/data
healthcheck:
test: pg_isready -U postgres
interval: 3s
timeout: 3s
retries: 5
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment