Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

fix: replace ngrok with localtunnel #82

Merged
merged 5 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions demo/Dockerfile.demo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
17 changes: 17 additions & 0 deletions demo/agent-tunnel-wait.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion demo/configs/mediator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 15 additions & 10 deletions demo/docker-compose.alice-bob.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 6 additions & 5 deletions demo/docker-compose.mediator.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 8 additions & 5 deletions demo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"
22 changes: 0 additions & 22 deletions demo/ngrok-wait.sh

This file was deleted.