hyperledger / aries-acapy-plugins

aries-acapy-plugins
https://hyperledger.github.io/aries-acapy-plugins/
Apache License 2.0
3 stars 24 forks source link
aca-py aries hyperledger trust-over-ip

Aries Cloud Agent Python Plugins

This repository contains approved and tested plugins for Aries Cloud Agent Python (ACA-Py). This is to encourage collaboration and sharing of useful features not directly included in ACA-Py.

Developer Notes

The easiest way to develop and test ACA-Py plugins is to use the DevContainer configured in this repository.

Repo Management Script

A script was developed to help with maintenance of the repo called repo_manager.py. To run it you need a current version of poetry and python available.

Run python repo_manager.py and you will be met with a number of options. Run the options as needed.

Lite plugins

Sometimes is desirable to have a plugin that doesn't need integration tests or extra scaffolding. However, we need a way to avoid these plugins running integration tests in the CI/CD pipeline. To do this, we can simply add the plugin name to the lite_plugins file, a line-separated list of plugin names.

Plugin Documentation

Plugin developers SHOULD describe what the plugin does, any limitations (ex only in multitenant mode), any known issues interacting with other plugins, etc. Full documentation including a plugin_config sample should be provided.

This documentation should be provided in your plugin root as a README.md file, with at least a Description and Configuration section.

Build and Run

Each plugin (that is not a Lite Plugin) MUST include a Dockerfile (such as Dockerfile) to run integration tests. This image is not intended for production as it copies the plugin source and loads its dependencies (including ACA-Py) along with a simplistic ACA-Py configuration file, (such as default.yml).

Run and Debug

In the devcontainer, we can run an ACA-Py instance with our plugin source loaded and set breakpoints for debug (see launch.json).

To run your ACA-Py code in debug mode, go to the Run and Debug view, select "Run/Debug Plugin" and click Start Debugging (F5). Using the default.yml for the plugin (such as default.yml), your agent swagger is available at http://localhost:3001/api/doc.

Testing

For the plugin to be accepted into this repo it must have adequate testing.

Unit Testing:

Integration Testing:

Deploy

For production use, plugins should be installed as libraries to an ACA-Py image.

This requires having a Dockerfile and a config file for your agent.

Example Dockerfile:


FROM ghcr.io/hyperledger/aries-cloudagent-python:py3.9-0.11.0

USER root

# install plugins as binaries
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@main#subdirectory=basicmessage_storage
RUN pip install git+https://github.com/hyperledger/aries-acapy-plugins@main#subdirectory=connection_update

USER $user
COPY ./configs configs

CMD ["ACA-Py"]

Example config file (local single tenant):


label: plugins-agent

admin-insecure-mode: true
admin: [0.0.0.0, 9061]

inbound-transport:
   - [http, 0.0.0.0, 9060]
outbound-transport: http
endpoint: http://host.docker.internal:9060

genesis-url: http://test.bcovrin.vonx.io/genesis

emit-new-didcomm-prefix: true
wallet-type: askar
wallet-storage-type: default

auto-provision: true
debug-connections: true
auto-accept-invites: true
auto-accept-requests: true
auto-ping-connection: true
auto-respond-messages: true

log-level: info

plugin:
  - basicmessage_storage.v1_0
  - connection_update.v1_0

Now you can deploy a agent with as many plugins as you want as long as they are declared in your build config file and installed.


docker build -f <Dockerfile> --tag acapy_plugins .
docker run -it -p 9060:9060 -p 9061:9061 --rm acapy_plugins start --arg-file=<config-file> -->