Skip to content

Commit d71e9e2

Browse files
committed
Demo of an author-configured agent via docker
Signed-off-by: Ian Costanzo <ian@anon-solutions.ca>
1 parent 9dc2fa3 commit d71e9e2

3 files changed

Lines changed: 106 additions & 0 deletions

File tree

demo/docker-agent/Dockerfile.acapy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0
2+
3+
USER root
4+
5+
ADD https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 ./jq
6+
RUN chmod +x ./jq
7+
COPY ngrok-wait.sh ngrok-wait.sh
8+
RUN chmod +x ./ngrok-wait.sh
9+
10+
USER $user
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Sample docker-compose to start a local aca-py author agent
2+
# To start aca-py and the postgres database, just run `docker-compose up`
3+
# To shut down the services run `docker-compose rm` - this will retain the postgres database, so you can change aca-py startup parameters
4+
# and restart the docker containers without losing your wallet data
5+
# If you want to delete your wallet data just run `docker volume ls -q | xargs docker volume rm`
6+
version: "3"
7+
services:
8+
ngrok-agent:
9+
image: wernight/ngrok
10+
ports:
11+
- 4057:4040
12+
command: ngrok http author-agent:8001 --log stdout
13+
14+
author-agent:
15+
build:
16+
context: .
17+
dockerfile: Dockerfile.acapy
18+
environment:
19+
- NGROK_NAME=ngrok-agent
20+
ports:
21+
- 8010:8010
22+
- 8001:8001
23+
depends_on:
24+
- wallet-db
25+
entrypoint: /bin/bash
26+
command: [
27+
"-c",
28+
"sleep 5; \
29+
./ngrok-wait.sh"
30+
]
31+
volumes:
32+
- ./ngrok-wait.sh:/home/indy/ngrok-wait.sh
33+
34+
wallet-db:
35+
image: vcr-postgresql
36+
environment:
37+
- POSTGRESQL_USER=DB_USER
38+
- POSTGRESQL_PASSWORD=DB_PASSWORD
39+
- POSTGRESQL_DATABASE=DB_USER
40+
- POSTGRESQL_ADMIN_PASSWORD=mysecretpassword
41+
ports:
42+
- 5433:5432
43+
volumes:
44+
- wallet-db-data:/var/lib/pgsql/data
45+
46+
volumes:
47+
wallet-db-data:

demo/docker-agent/ngrok-wait.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
# based on code developed by Sovrin: https://github.com/hyperledger/aries-acapy-plugin-toolbox
4+
5+
echo "using ngrok end point [$NGROK_NAME]"
6+
7+
NGROK_ENDPOINT=null
8+
while [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ]
9+
do
10+
echo "Fetching end point from ngrok service"
11+
NGROK_ENDPOINT=$(curl --silent $NGROK_NAME:4040/api/tunnels | ./jq -r '.tunnels[] | select(.proto=="https") | .public_url')
12+
13+
if [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ]; then
14+
echo "ngrok not ready, sleeping 5 seconds...."
15+
sleep 5
16+
fi
17+
done
18+
19+
export ACAPY_ENDPOINT=$NGROK_ENDPOINT
20+
21+
echo "Starting aca-py agent with endpoint [$ACAPY_ENDPOINT]"
22+
23+
# ... if you want to echo the aca-py startup command ...
24+
set -x
25+
26+
exec aca-py start \
27+
--auto-provision \
28+
--inbound-transport http '0.0.0.0' 8001 \
29+
--outbound-transport http \
30+
--genesis-url "https://raw.githubusercontent.com/ICCS-ISAC/dtrust-reconu/main/CANdy/dev/pool_transactions_genesis" \
31+
--endpoint "${ACAPY_ENDPOINT}" \
32+
--auto-ping-connection \
33+
--monitor-ping \
34+
--public-invites \
35+
--wallet-type "askar" \
36+
--wallet-name "test_author" \
37+
--wallet-key "secret_key" \
38+
--wallet-storage-type "postgres_storage" \
39+
--wallet-storage-config "{\"url\":\"wallet-db:5432\",\"max_connections\":5}" \
40+
--wallet-storage-creds "{\"account\":\"DB_USER\",\"password\":\"DB_PASSWORD\",\"admin_account\":\"postgres\",\"admin_password\":\"mysecretpassword\"}" \
41+
--admin '0.0.0.0' 8010 \
42+
--label "test_author" \
43+
--admin-insecure-mode \
44+
--endorser-protocol-role author \
45+
--endorser-alias 'Endorser' \
46+
--auto-request-endorsement \
47+
--auto-write-transactions \
48+
--auto-create-revocation-transactions \
49+
--log-level "error"

0 commit comments

Comments
 (0)