Introduction

Aries VCX and Aries vcxagency-node require some development time dependencies to fully test the code against live implementation of the surrounding ecosystem.

This includes running an instance of Indy, a decentralized identity ledger and some regular databases for storage.

Setting up each of these separately can be hard. So these Aries projects include pre-built docker containers that you can bring up on your development workstation.

Here I describe how you can orchestrate a set of docker containers to get yourself set up for most things aries vcx needs.

Docker Compose files

The following docker files would assist in the procedure

Base Network

docker-compose.yml

version: '3.5'

networks:
  absadocker:
    name: absadocker
    driver: bridge

This is a simple docker file that describes a named network that we'd like all the containers to run in. Having all docker containers in same network allows them to communicate and make connections to resources within each other.

Databases

docker-compose.redis.yml

version: '3.5'

services:
  redis:
    container_name: redis
    image: ghcr.io/absaoss/vcxagencynode/vcxagency-redis:2.2.0
    networks:
      - absadocker
    ports:
      - "6379:6379"
    command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

docker-compose.mysql.yml

version: '3.5'

services:
  mysql:
    container_name: mysql
    image: mysql:5.7.35
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-mysecretpassword}
    networks:
      - absadocker
    ports:
      - "3306:3306"

docker-compose.postgres.yml

version: '3.5'

services:
  postgresql:
    image: postgres
    restart: always
    environment:
      - POSTGRES_PASSWORD=mysecretpassword
    networks:
      - absadocker
    ports:
      - '5432:5432'

docker-compose.mongo.yml

version: '3.5'

services:
  mongodb:
    image: mongo
    restart: always
    networks:
      - absadocker
    ports:
      - '27017:27017'

These provide storage facilities that will be used by services like Indy and vcxagencynode.

Indy

docker-compose.indypool.yml

  indylocalhost:
    image: pstas/indypool-localhost:1.15.0-localhost
    restart: always
    networks:
      - absadocker
    ports:
      - '9701-9708:9701-9708'

This runs an instance of the Indy distributed ledger that provides distributed identity document resolution to Aries.

VCXAgencyNode

version: '3.5'

x-standard-logging:
  &service-logging
  options:
    max-size: '500m'
    max-file: '3'
  driver: json-file

services:
  agency:
    image: ghcr.io/absaoss/vcxagencynode/vcxagency-node:2.6.0
    container_name: agency
    logging: *service-logging
    restart: always
    environment:
      - LOG_JSON_TO_CONSOLE=false
      - LOG_LEVEL=info
      - SERVER_PORT=8080
      - SERVER_MAX_REQUEST_SIZE_KB=300

      - PG_WALLET_MAX_CONNECTIONS=90
      - PG_WALLET_CONNECTION_TIMEOUT_MINS=30

      - AGENCY_WALLET_NAME=vcxagency-node-ea
      - AGENCY_DID=VsKV7grR1BUE29mG2Fm2kX
      - AGENCY_SEED_SECRET=0000000000000000000000000Forward
      - AGENCY_WALLET_KEY_SECRET=98765432109876543210

      - AGENCY_TYPE=client
      - REDIS_URL=redis://redis:6379/0
      - REDIS_URL_NOTIFICATIONS=redis://redis:6379/1

      - MYSQL_HOST=mysql
      - MYSQL_PORT=3306
      - MYSQL_ACCOUNT=root
      - MYSQL_PASSWORD_SECRET=mysecretpassword
      - MYSQL_DATABASE_APPLICATION=agency_application
      - MYSQL_DATABASE_WALLET=agency_wallets
      - MYSQL_DATABASE_WALLET_CONNECTION_LIMIT=50

      - SERVER_ENABLE_TLS=false
    networks:
      - absadocker
    ports:
      - "8080:8080"
    command: ["sh", "-c", "npm run dev:schema:migrate:all && npm run serve"]

This is an implementation of a mediator service written in Node. Helpful for testing Aries.

Orchestration / Setup

We can use docker-compose to bring up these containers. Since some of them depend on each other a proper sequence of starting them is beneficial to avoid errors or confusion.

The following is the sequence I recommend.

# databases
# run databases in the network defined in `docker-compose.yml` file
docker-compose -f docker-compose.yml -f docker-compose.mysql.yml -f docker-compose.redis.yml up -d
docker-compose -f docker-compose.yml -f docker-compose.mongo.yml -f docker-compose.postgres.yml up -d

# wait a bit for database to start up
sleep 10

# indypool
docker-compose -f docker-compose.yml -f docker-compose.indypool.yml up -d

# agency
docker-compose -f docker-compose.yml -f docker-compose.agency-ca.yml up -d

This is based on the CI @ vcxagency-node

Test

To test everything is set up and working run some tests in aries vcx repo

cargo test  --features "pool_tests" -- --test-threads=1

naian is participating in Linux Foundation's LFX 2023 mentorship program, working on the aries-vcx mediator project at Hyperledger Foundation.

Published

Category

Development

Tags

Contact