-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Allain Magyar <allain.magyar@iohk.io> Signed-off-by: Hyperledger Bot <hyperledger-bot@hyperledger.org> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hyperledger Bot <hyperledger-bot@hyperledger.org>
- Loading branch information
1 parent
05fdf26
commit 01f0eb7
Showing
9 changed files
with
233 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
services: | ||
########################## | ||
# Database | ||
########################## | ||
db: | ||
image: postgres:13 | ||
environment: | ||
POSTGRES_MULTIPLE_DATABASES: "castor,pollux,connect,agent,node_db" | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
volumes: | ||
- ./postgres/init-script.sh:/docker-entrypoint-initdb.d/init-script.sh | ||
- ./postgres/max_conns.sql:/docker-entrypoint-initdb.d/max_conns.sql | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "agent"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
########################## | ||
# Mediator | ||
########################## | ||
mongo: | ||
image: mongo:6.0 | ||
command: ["--auth"] | ||
environment: | ||
- MONGO_INITDB_ROOT_USERNAME=admin | ||
- MONGO_INITDB_ROOT_PASSWORD=admin | ||
- MONGO_INITDB_DATABASE=mediator | ||
volumes: | ||
- ./initdb.js:/docker-entrypoint-initdb.d/initdb.js | ||
|
||
mediator: | ||
network_mode: "container:didcomm-stack" | ||
image: ghcr.io/hyperledger/identus-mediator:1.0.0 | ||
environment: | ||
# Creates the identity: | ||
- KEY_AGREEMENT_D=Z6D8LduZgZ6LnrOHPrMTS6uU2u5Btsrk1SGs4fn8M7c | ||
- KEY_AGREEMENT_X=Sr4SkIskjN_VdKTn0zkjYbhGTWArdUNE4j_DmUpnQGw | ||
- KEY_AUTHENTICATION_D=INXCnxFEl0atLIIQYruHzGd5sUivMRyQOzu87qVerug | ||
- KEY_AUTHENTICATION_X=MBjnXZxkMcoQVVL21hahWAw43RuAG-i64ipbeKKqwoA | ||
- SERVICE_ENDPOINTS=http://localhost:8080;ws://localhost:8080/ws | ||
- MONGODB_USER=admin | ||
- MONGODB_PASSWORD=admin | ||
- MONGODB_PROTOCOL=mongodb | ||
- MONGODB_HOST=mongo | ||
- MONGODB_PORT=27017 | ||
- MONGODB_DB_NAME=mediator | ||
depends_on: | ||
- "mongo" | ||
- "agent" | ||
|
||
########################## | ||
# Building-blocks | ||
########################## | ||
prism-node: | ||
image: ghcr.io/input-output-hk/prism-node:2.5.0 | ||
environment: | ||
NODE_PSQL_HOST: db:5432 | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
|
||
agent: | ||
container_name: didcomm-stack | ||
image: ghcr.io/hyperledger/identus-cloud-agent:${CLOUD_AGENT_VERSION} | ||
ports: | ||
- "8080:8080" | ||
- "8090:8090" | ||
- "8091:8091" | ||
environment: | ||
CASTOR_DB_HOST: db | ||
CASTOR_DB_PORT: 5432 | ||
CASTOR_DB_NAME: castor | ||
CASTOR_DB_USER: postgres | ||
CASTOR_DB_PASSWORD: postgres | ||
POLLUX_DB_HOST: db | ||
POLLUX_DB_PORT: 5432 | ||
POLLUX_DB_NAME: pollux | ||
POLLUX_DB_USER: postgres | ||
POLLUX_DB_PASSWORD: postgres | ||
CONNECT_DB_HOST: db | ||
CONNECT_DB_PORT: 5432 | ||
CONNECT_DB_NAME: connect | ||
CONNECT_DB_USER: postgres | ||
CONNECT_DB_PASSWORD: postgres | ||
AGENT_DB_HOST: db | ||
AGENT_DB_PORT: 5432 | ||
AGENT_DB_NAME: agent | ||
AGENT_DB_USER: postgres | ||
AGENT_DB_PASSWORD: postgres | ||
AGENT_HTTP_PORT: 8090 | ||
REST_SERVICE_URL: http://localhost:8090 | ||
AGENT_DIDCOMM_PORT: 8091 | ||
DIDCOMM_SERVICE_URL: http://localhost:8091 | ||
PRISM_NODE_HOST: prism-node | ||
PRISM_NODE_PORT: 50053 | ||
SECRET_STORAGE_BACKEND: postgres | ||
DEV_MODE: true | ||
DEFAULT_WALLET_ENABLED: | ||
DEFAULT_WALLET_SEED: | ||
DEFAULT_WALLET_WEBHOOK_URL: | ||
DEFAULT_WALLET_WEBHOOK_API_KEY: | ||
DEFAULT_WALLET_AUTH_API_KEY: | ||
GLOBAL_WEBHOOK_URL: | ||
GLOBAL_WEBHOOK_API_KEY: | ||
WEBHOOK_PARALLELISM: | ||
ADMIN_TOKEN: | ||
API_KEY_SALT: | ||
API_KEY_ENABLED: false | ||
API_KEY_AUTHENTICATE_AS_DEFAULT_USER: | ||
API_KEY_AUTO_PROVISIONING: | ||
NODE_REFRESH_AND_SUBMIT_PERIOD: | ||
NODE_MOVE_SCHEDULED_TO_PENDING_PERIOD: | ||
NODE_WALLET_MAX_TPS: | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
prism-node: | ||
condition: service_started | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8090/_system/health"] | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
db.createUser({ | ||
user: 'admin', | ||
pwd: 'admin', | ||
roles: [ | ||
{ role: 'readWrite', db: 'mediator' } | ||
] | ||
}) | ||
|
||
const database = 'mediator' | ||
const collectionDidAccount = 'user.account' | ||
const collectionMessages = 'messages' | ||
const collectionMessagesSend = 'messages.outbound' | ||
|
||
// The current database to use. | ||
use(database) | ||
|
||
// Create collections. | ||
db.createCollection(collectionDidAccount) | ||
db.createCollection(collectionMessages) | ||
db.createCollection(collectionMessagesSend) | ||
|
||
// create index | ||
db.getCollection(collectionDidAccount).createIndex({ did: 1 }, { unique: true }) | ||
// Only enforce uniqueness on non-empty arrays | ||
db.getCollection(collectionDidAccount).createIndex({ alias: 1 }, { unique: true, partialFilterExpression: { 'alias.0': { $exists: true } } }) | ||
db.getCollection(collectionDidAccount).createIndex({ 'messagesRef.hash': 1, 'messagesRef.recipient': 1 }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -u | ||
|
||
function create_user_and_database() { | ||
local database=$1 | ||
local app_user=${database}-application-user | ||
echo " Creating user and database '$database'" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL | ||
CREATE USER "$app_user" WITH PASSWORD 'password'; | ||
CREATE DATABASE $database; | ||
\c $database | ||
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO "$app_user"; | ||
EOSQL | ||
} | ||
|
||
if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then | ||
echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" | ||
for db in $(echo "$POSTGRES_MULTIPLE_DATABASES" | tr ',' ' '); do | ||
create_user_and_database "$db" | ||
done | ||
echo "Multiple databases created" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
ALTER SYSTEM SET max_connections = 500; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CLOUD_AGENT_VERSION=$1 | ||
|
||
PORT="$PRISM_PORT" \ | ||
CLOUD_AGENT_VERSION="$CLOUD_AGENT_VERSION" \ | ||
docker compose \ | ||
-f "docker/docker-compose.yml" \ | ||
up -d --wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CLOUD_AGENT_VERSION="$CLOUD_AGENT_VERSION" \ | ||
docker compose \ | ||
-f "./docker/docker-compose.yml" \ | ||
down -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "didcomm-tests", | ||
"version": "1.0.0", | ||
"description": "Test suite for executing didcomm tests", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node node_modules/@amagyar-iohk/didcomm-test/dist/suite.spec.js" | ||
}, | ||
"author": "Allain Magyar", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@amagyar-iohk/didcomm-test": "^1.0.4" | ||
} | ||
} |