Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Add endorser controller #16

Merged
merged 4 commits into from
May 5, 2021
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"logLevel": "LOG_LEVEL"
},
"defaultWebhookHosts": [
"AGENCY_WEBHOOK_URL",
"ENDORSER_WEBHOOK_URL"
"AGENCY_WEBHOOK_URL"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 32 additions & 7 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ services:
volumes:
- agency-wallet:/var/lib/pgsql/data

controller-dev:
agency-controller-dev:
image: node:fermium
environment:
- PORT=${CONTROLLER_PORT}
- CONTROLLER_ADMIN_API_KEY=${CONTROLLER_ADMIN_API_KEY}
- PORT=${AGENCY_CONTROLLER_PORT}
- CONTROLLER_ADMIN_API_KEY=${AGENCY_CONTROLLER_ADMIN_API_KEY}
- AGENCY_ADMIN_URL=${AGENCY_ADMIN_URL}
- AGENCY_ADMIN_API_KEY=${AGENCY_ADMIN_API_KEY}
- AGENCY_WEBHOOK_URL=${AGENCY_WEBHOOK_URL}
Expand All @@ -149,10 +149,10 @@ services:
- ENDORSER_ALIAS=${ENDORSER_ALIAS}
- LOG_LEVEL=${LOG_LEVEL}
volumes:
- ../controller:/usr/src/controller
- controller-data:/usr/src/controller/node_modules
- ../agency:/usr/src/controller
- agency-controller-data:/usr/src/controller/node_modules
ports:
- ${CONTROLLER_PORT}:${CONTROLLER_PORT}
- ${AGENCY_CONTROLLER_PORT}:${AGENCY_CONTROLLER_PORT}
networks:
- vcr-issuer-agency
- vcr
Expand All @@ -164,6 +164,30 @@ services:
entrypoint: /bin/bash
command: ["-c", "npm install; npm run dev"]

endorser-controller-dev:
image: node:fermium
environment:
- PORT=${ENDORSER_CONTROLLER_PORT}
- CONTROLLER_ADMIN_API_KEY=${ENDORSER_CONTROLLER_ADMIN_API_KEY}
- ENDORSER_ADMIN_URL=${ENDORSER_ADMIN_URL}
- ENDORSER_ADMIN_API_KEY=${ENDORSER_ADMIN_API_KEY}
- ENDORSER_WEBHOOK_URL=${ENDORSER_WEBHOOK_URL}
- ENDORSER_ALIAS=${ENDORSER_ALIAS}
- LOG_LEVEL=${LOG_LEVEL}
volumes:
- ../endorser:/usr/src/controller
- endorser-controller-data:/usr/src/controller/node_modules
ports:
- ${ENDORSER_CONTROLLER_PORT}:${ENDORSER_CONTROLLER_PORT}
networks:
- vcr-issuer-agency
- vcr
working_dir: /usr/src/controller
depends_on:
- endorser
entrypoint: /bin/bash
command: ["-c", "npm install; npm run dev"]

db:
image: centos/mongodb-36-centos7
environment:
Expand All @@ -187,4 +211,5 @@ networks:
volumes:
agency-wallet:
db-data:
controller-data:
agency-controller-data:
endorser-controller-data:
22 changes: 14 additions & 8 deletions docker/manage
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,26 @@ configureEnvironment () {
export POSTGRESQL_ADMIN_PASSWORD="mysecretpassword"
export WALLET_SEED_VONX=${WALLET_SEED_VONX:-"vcr-issuer_000000000000000000000"}

# controller
export CONTROLLER_PORT=3030
# endorser controller
export ENDORSER_CONTROLLER_PORT=3040
export ENDORSER_ADMIN_URL=${ENDORSER_ADMIN_URL:-http://endorser:$ENDORSER_ADMIN_PORT}
export ENDORSER_WEBHOOK_URL=${ENDORSER_WEBHOOK_URL:-http://$DOCKERHOST:$ENDORSER_CONTROLLER_PORT/webhooks}
export ENDORSER_CONTROLLER_ADMIN_API_KEY=${ENDORSER_CONTROLLER_ADMIN_API_KEY:-"controller-api-key"}
export ENDORSER_ADMIN_URL=${ENDORSER_ADMIN_URL:-http://endorser:$ENDORSER_ADMIN_PORT}
export ENDORSER_WEBHOOK_URL=${ENDORSER_WEBHOOK_URL:-http://$DOCKERHOST:$ENDORSER_CONTROLLER_PORT/webhooks}
export ENDORSER_ALIAS=${ENDORSER_ALIAS:-"vcr-endorser"}

# agency controller
export AGENCY_CONTROLLER_PORT=3030
export AGENCY_ADMIN_URL=${AGENCY_ADMIN_URL:-http://agency:$AGENCY_ADMIN_PORT}
export AGENCY_WEBHOOK_URL=${AGENCY_WEBHOOK_URL:-http://$DOCKERHOST:$CONTROLLER_PORT/webhooks}
export DB_SERVICE="db"
export CONTROLLER_ADMIN_API_KEY=${CONTROLLER_ADMIN_API_KEY:-"controller-api-key"}
export AGENCY_WEBHOOK_URL=${AGENCY_WEBHOOK_URL:-http://$DOCKERHOST:$AGENCY_CONTROLLER_PORT/webhooks}
export AGENCY_CONTROLLER_ADMIN_API_KEY=${CONTROLLER_ADMIN_API_KEY:-"controller-api-key"}
export REGISTRY_ADMIN_URL=${REGISTRY_ADMIN_URL:-http://vcr-agent:8024}
export REGISTRY_ADMIN_API_KEY=${REGISTRY_ADMIN_API_KEY}
export REGISTRY_ALIAS=${REGISTRY_ALIAS:-"aries-vcr"}
export ENDORSER_ADMIN_URL=${ENDORSER_ADMIN_URL:-http://endorser:$ENDORSER_ADMIN_PORT}
export ENDORSER_WEBHOOK_URL=${ENDORSER_WEBHOOK_URL:-http://$DOCKERHOST:$CONTROLLER_PORT/webhooks}
export ENDORSER_ALIAS=${ENDORSER_ALIAS:-"vcr-endorser"}

# db
export DB_SERVICE="db"
export MONGODB_ADMIN_PASSWORD="admin"
export MONGODB_USER="mongouser"
export MONGODB_PASSWORD="mongopwd"
Expand Down
13 changes: 13 additions & 0 deletions endorser/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
40 changes: 40 additions & 0 deletions endorser/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"env": {
"es6": true,
"node": true,
"jest": true
},
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended"
],
"rules": {
"indent": [
"error",
2,
{ "SwitchCase": 1 }
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{"avoidEscape": true}
],
"semi": [
"error",
"always"
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off"
}
}
112 changes: 112 additions & 0 deletions endorser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript

# IDEs and editors (shamelessly copied from @angular/cli's .gitignore)
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# Others
lib/
data/
3 changes: 3 additions & 0 deletions endorser/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
45 changes: 45 additions & 0 deletions endorser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# endorser-controller

> A controller for an instance of Aries Cloud Agent Python with endorser privileges

## About

This project uses [Feathers](http://feathersjs.com). An open source web framework for building modern real-time applications.

## Getting Started

Getting up and running is as easy as 1, 2, 3.

1. Make sure you have [NodeJS](https://nodejs.org/) and [npm](https://www.npmjs.com/) installed.
2. Install your dependencies

```
cd path/to/endorser-controller
npm install
```

3. Start your app

```
npm start
```

## Testing

Simply run `npm test` and all your tests in the `test/` directory will be run.

## Scaffolding

Feathers has a powerful command line interface. Here are a few things it can do:

```
$ npm install -g @feathersjs/cli # Install Feathers CLI

$ feathers generate service # Generate a new Service
$ feathers generate hook # Generate a new Hook
$ feathers help # Show all commands
```

## Help

For more information on all the things you can do with Feathers visit [docs.feathersjs.com](http://docs.feathersjs.com).
22 changes: 22 additions & 0 deletions endorser/config/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"host": "localhost",
"port": "PORT",
"public": "../public/",
"paginate": {
"default": 10,
"max": 50
},
"authentication": {
"adminApiKey": "CONTROLLER_ADMIN_API_KEY"
},
"agent": {
"adminUrl": "ENDORSER_ADMIN_URL",
"headers": {
"x-api-key": "ENDORSER_ADMIN_API_KEY"
},
"alias": "ENDORSER_ALIAS"
},
"logging": {
"logLevel": "LOG_LEVEL"
}
}
4 changes: 4 additions & 0 deletions endorser/config/production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"host": "endorser-controller-app.feathersjs.com",
"port": "PORT"
}
1 change: 1 addition & 0 deletions endorser/config/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
9 changes: 9 additions & 0 deletions endorser/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
globals: {
'ts-jest': {
diagnostics: false
}
}
};
Loading