diff --git a/demo/Dockerfile.demo b/demo/Dockerfile.demo index 4de1f06b..b02d9489 100644 --- a/demo/Dockerfile.demo +++ b/demo/Dockerfile.demo @@ -5,14 +5,13 @@ RUN pip3 install --no-cache-dir poetry ADD --chown=indy https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 ./jq RUN chmod +x ./jq -COPY --chown=indy demo/ngrok-wait.sh ./ngrok-wait.sh -RUN chmod +x ngrok-wait.sh +COPY --chown=indy demo/agent-tunnel-wait.sh ./agent-tunnel-wait.sh +RUN chmod +x agent-tunnel-wait.sh -COPY acapy_plugin_toolbox acapy_plugin_toolbox +RUN mkdir acapy_plugin_toolbox && touch acapy_plugin_toolbox/__init__.py COPY pyproject.toml . COPY poetry.lock . COPY README.md . -COPY demo/configs ./configs/ USER root RUN chown indy:indy -R . USER indy @@ -22,5 +21,9 @@ RUN poetry install --no-dev # Make site packages location more accessible (for use with volumes) RUN ln -s $(poetry env info -p)/lib/python3.6/site-packages site-packages -ENTRYPOINT ["/bin/bash", "-c", "./ngrok-wait.sh \"$@\"", "--"] +COPY demo/configs ./configs/ +COPY acapy_plugin_toolbox acapy_plugin_toolbox + + +ENTRYPOINT ["/bin/bash", "-c", "./agent-tunnel-wait.sh \"$@\"", "--"] CMD ["poetry", "run", "aca-py", "start", "--plugin", "acapy_plugin_toolbox", "--arg-file", "configs/default.yml"] diff --git a/demo/agent-tunnel-wait.sh b/demo/agent-tunnel-wait.sh new file mode 100644 index 00000000..51d1b1c4 --- /dev/null +++ b/demo/agent-tunnel-wait.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +TUNNEL_HOST=${TUNNEL_HOST:-tunnel} +TUNNEL_PORT=${TUNNEL_PORT:-4040} + +echo "tunnel end point [$TUNNEL_HOST:$TUNNEL_PORT]" + +while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "${TUNNEL_HOST}:${TUNNEL_PORT}/status")" != "200" ]]; do + echo "Waiting for tunnel..." + sleep 1 +done +ACAPY_ENDPOINT=$(curl --silent "${TUNNEL_HOST}:${TUNNEL_PORT}/start" | ./jq -r '.url') +echo "fetched end point [$ACAPY_ENDPOINT]" + +export ACAPY_ENDPOINT="[$ACAPY_ENDPOINT, ${ACAPY_ENDPOINT/http/ws}]" +#export ACAPY_ENDPOINT="$ACAPY_ENDPOINT" +exec "$@" diff --git a/demo/configs/mediator.yml b/demo/configs/mediator.yml index d3904e4e..a24dd90a 100644 --- a/demo/configs/mediator.yml +++ b/demo/configs/mediator.yml @@ -9,7 +9,7 @@ plugin: label: Mindy Mediator endpoint: http://localhost:3004 inbound-transport: - - [http, 0.0.0.0, 3004] + - [acapy_plugin_toolbox.http_ws, 0.0.0.0, 3004] outbound-transport: http # Mediator does not use ledger diff --git a/demo/docker-compose.alice-bob.yml b/demo/docker-compose.alice-bob.yml index f891f397..f4b681c5 100644 --- a/demo/docker-compose.alice-bob.yml +++ b/demo/docker-compose.alice-bob.yml @@ -1,28 +1,33 @@ version: "3" services: - ngrok-alice: - image: wernight/ngrok - command: ngrok http agent-alice:3000 --log stdout + tunnel-alice: + image: reflectivedevelopment/agent-tunnel + command: agent-alice:3000 -p 4040 --host ${AGENT_TUNNEL_HOST} agent-alice: - image: acapy-toolbox-ngrok + image: acapy-toolbox-tunnel build: context: ../ dockerfile: ./demo/Dockerfile.demo environment: - NGROK_NAME: ngrok-alice + TUNNEL_HOST: tunnel-alice + TUNNEL_PORT: 4040 # Modify for more log output ACAPY_TOOLBOX_LOG_LEVEL: WARNING ports: - "3001:3001" command: poetry run aca-py start --arg-file ./configs/alice.yml - ngrok-bob: - image: wernight/ngrok - command: ngrok http agent-bob:3002 --log stdout + tunnel-bob: + image: reflectivedevelopment/agent-tunnel + command: agent-bob:3002 -p 4040 --host ${AGENT_TUNNEL_HOST} agent-bob: - image: acapy-toolbox-ngrok + image: acapy-toolbox-tunnel + build: + context: ../ + dockerfile: ./demo/Dockerfile.demo environment: - NGROK_NAME: ngrok-bob + TUNNEL_HOST: tunnel-bob + TUNNEL_PORT: 4040 # Modify for more log output ACAPY_TOOLBOX_LOG_LEVEL: WARNING ports: diff --git a/demo/docker-compose.mediator.yml b/demo/docker-compose.mediator.yml index e825137b..8fd2eff3 100644 --- a/demo/docker-compose.mediator.yml +++ b/demo/docker-compose.mediator.yml @@ -1,15 +1,16 @@ version: "3" services: - ngrok-mediator: - image: wernight/ngrok - command: ngrok http agent-mediator:3004 --log stdout + tunnel-mediator: + image: reflectivedevelopment/agent-tunnel + command: agent-mediator:3004 -p 4040 --host ${AGENT_TUNNEL_HOST} agent-mediator: - image: acapy-toolbox-ngrok + image: acapy-toolbox-tunnel build: context: ../ dockerfile: ./demo/Dockerfile.demo environment: - NGROK_NAME: ngrok-mediator + TUNNEL_HOST: tunnel-mediator + TUNNEL_PORT: 4040 ports: - "3005:3005" command: poetry run aca-py start --arg-file ./configs/mediator.yml diff --git a/demo/docker-compose.yml b/demo/docker-compose.yml index 79443e6f..2c001813 100644 --- a/demo/docker-compose.yml +++ b/demo/docker-compose.yml @@ -1,14 +1,17 @@ version: "3" services: - ngrok: - image: wernight/ngrok - command: ngrok http agent:3000 --log stdout + tunnel: + image: reflectivedevelopment/agent-tunnel + command: agent:3000 -p 4040 --host ${AGENT_TUNNEL_HOST} + ports: + - 4040:4040 agent: - image: acapy-toolbox-ngrok + image: acapy-toolbox-tunnel build: context: ../ dockerfile: ./demo/Dockerfile.demo environment: - NGROK_NAME: ngrok + TUNNEL_HOST: tunnel + TUNNEL_PORT: 4040 ports: - "3001:3001" diff --git a/demo/ngrok-wait.sh b/demo/ngrok-wait.sh deleted file mode 100644 index 0de36d93..00000000 --- a/demo/ngrok-wait.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -NGROK_NAME=${NGROK_NAME:-ngrok} - -echo "ngrok end point [$NGROK_NAME]" - -ACAPY_ENDPOINT=null -while [ -z "$ACAPY_ENDPOINT" ] || [ "$ACAPY_ENDPOINT" = "null" ] -do - echo "Fetching end point from ngrok service" - ACAPY_ENDPOINT=$(curl --silent "$NGROK_NAME:4040/api/tunnels" | ./jq -r '.tunnels[0].public_url') - - if [ -z "$ACAPY_ENDPOINT" ] || [ "$ACAPY_ENDPOINT" = "null" ]; then - echo "ngrok not ready, sleeping 5 seconds...." - sleep 5 - fi -done - -echo "fetched end point [$ACAPY_ENDPOINT]" - -export ACAPY_ENDPOINT="[$ACAPY_ENDPOINT, ${ACAPY_ENDPOINT/http/ws}]" -exec "$@"