-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into issue_cred_2.1
- Loading branch information
Showing
8 changed files
with
153 additions
and
16 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
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,10 @@ | ||
FROM bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0 | ||
|
||
USER root | ||
|
||
ADD https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 ./jq | ||
RUN chmod +x ./jq | ||
COPY ngrok-wait.sh ngrok-wait.sh | ||
RUN chmod +x ./ngrok-wait.sh | ||
|
||
USER $user |
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,40 @@ | ||
# Running an Aca-Py Agent in Multitenant Mode | ||
|
||
This directory contains scripts to run an aca-py agent in multitenancy mode. | ||
|
||
## Running the Agent | ||
|
||
The docker-compose script runs ngrok to expose the agent's port publicly, and stores wallet data in a postgres database. | ||
|
||
To run the agent in this repo, open a command shell in this directory and run: | ||
|
||
- to build the containers: | ||
|
||
```bash | ||
docker-compose build | ||
``` | ||
|
||
- to run the agent: | ||
|
||
```bash | ||
docker-compose up | ||
``` | ||
|
||
You can connect to the [agent's api service here](http://localhost:8010). | ||
|
||
Note that all the configuration settings are hard-coded in the docker-compose file and ngrok-wait.sh script, so if you change any configs you need to rebuild the docker images. | ||
|
||
- to shut down the agent: | ||
|
||
```bash | ||
docker-compose stop | ||
docker-compose rm -f | ||
``` | ||
|
||
This will leave the agent's wallet data, so if you restart the agent it will maintain any created data. | ||
|
||
- to remove the agent's wallet: | ||
|
||
```bash | ||
docker volume rm multi-demo_wallet-db-data | ||
``` |
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,45 @@ | ||
# Sample docker-compose to start a local aca-py multitenancy agent | ||
# To start aca-py and the postgres database, just run `docker-compose up` | ||
# To shut down the services run `docker-compose rm` - this will retain the postgres database, so you can change aca-py startup parameters | ||
# and restart the docker containers without losing your wallet data | ||
# If you want to delete your wallet data just run `docker volume ls -q | xargs docker volume rm` | ||
version: "3" | ||
services: | ||
ngrok-agent: | ||
image: wernight/ngrok | ||
ports: | ||
- 4067:4040 | ||
command: ngrok http multi-agent:8001 --log stdout | ||
|
||
multi-agent: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.acapy | ||
environment: | ||
- NGROK_NAME=ngrok-agent | ||
ports: | ||
- 8010:8010 | ||
- 8001:8001 | ||
depends_on: | ||
- wallet-db | ||
entrypoint: /bin/bash | ||
command: [ | ||
"-c", | ||
"sleep 5; \ | ||
./ngrok-wait.sh" | ||
] | ||
volumes: | ||
- ./ngrok-wait.sh:/home/indy/ngrok-wait.sh | ||
|
||
wallet-db: | ||
image: postgres:12 | ||
environment: | ||
- POSTGRES_USER=DB_USER | ||
- POSTGRES_PASSWORD=DB_PASSWORD | ||
ports: | ||
- 5433:5432 | ||
volumes: | ||
- wallet-db-data:/var/lib/pgsql/data | ||
|
||
volumes: | ||
wallet-db-data: |
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,47 @@ | ||
#!/bin/bash | ||
|
||
# based on code developed by Sovrin: https://github.com/hyperledger/aries-acapy-plugin-toolbox | ||
|
||
echo "using ngrok end point [$NGROK_NAME]" | ||
|
||
NGROK_ENDPOINT=null | ||
while [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ] | ||
do | ||
echo "Fetching end point from ngrok service" | ||
NGROK_ENDPOINT=$(curl --silent $NGROK_NAME:4040/api/tunnels | ./jq -r '.tunnels[] | select(.proto=="https") | .public_url') | ||
|
||
if [ -z "$NGROK_ENDPOINT" ] || [ "$NGROK_ENDPOINT" = "null" ]; then | ||
echo "ngrok not ready, sleeping 5 seconds...." | ||
sleep 5 | ||
fi | ||
done | ||
|
||
export ACAPY_ENDPOINT=$NGROK_ENDPOINT | ||
|
||
echo "Starting aca-py agent with endpoint [$ACAPY_ENDPOINT]" | ||
|
||
# ... if you want to echo the aca-py startup command ... | ||
set -x | ||
|
||
exec aca-py start \ | ||
--auto-provision \ | ||
--inbound-transport http '0.0.0.0' 8001 \ | ||
--outbound-transport http \ | ||
--genesis-url "http://test.bcovrin.vonx.io/genesis" \ | ||
--endpoint "${ACAPY_ENDPOINT}" \ | ||
--auto-ping-connection \ | ||
--monitor-ping \ | ||
--public-invites \ | ||
--wallet-type "askar" \ | ||
--wallet-name "test_multi" \ | ||
--wallet-key "secret_key" \ | ||
--wallet-storage-type "postgres_storage" \ | ||
--wallet-storage-config "{\"url\":\"wallet-db:5432\",\"max_connections\":5,\"scheme\":\"MultiWalletSingleTable\"}" \ | ||
--wallet-storage-creds "{\"account\":\"DB_USER\",\"password\":\"DB_PASSWORD\",\"admin_account\":\"DB_USER\",\"admin_password\":\"DB_PASSWORD\"}" \ | ||
--admin '0.0.0.0' 8010 \ | ||
--label "test_multi" \ | ||
--admin-insecure-mode \ | ||
--multitenant \ | ||
--multitenant-admin \ | ||
--jwt-secret "very_secret_secret" \ | ||
--log-level "error" |