From 681b9d811fad6c839fced403654eaccb7549baa2 Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Fri, 4 Nov 2022 21:15:22 +0100 Subject: [PATCH 01/11] Changing wallet type to askar Signed-off-by: anwalker293 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0e37851..7d0d27d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,7 +26,7 @@ services: --log-level debug --webhook-url http://echo:3002/webhook --genesis-url https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_demonet_genesis - --wallet-type askar + --wallet-type indy --wallet-name alice --wallet-key insecure --auto-provision @@ -70,7 +70,7 @@ services: --log-level debug --webhook-url http://echo:3002/webhook --genesis-url https://raw.githubusercontent.com/Indicio-tech/indicio-network/main/genesis_files/pool_transactions_demonet_genesis - --wallet-type askar + --wallet-type indy --wallet-name bob --wallet-key insecure --auto-provision From 185c696fd55276b060599366851a43081a9e420b Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Mon, 7 Nov 2022 17:40:51 +0100 Subject: [PATCH 02/11] Adding tunnel_endpoint.sh Signed-off-by: anwalker293 --- docker-compose.yml | 22 +++++++++++++--------- tunnel_endpoint.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) create mode 100755 tunnel_endpoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index 7d0d27d..d24c3fa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,8 @@ version: "3" services: alice: - image: bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0 + image: bcgovimages/aries-cloudagent:py36-1.16-1_0.7.5 + #image: bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0 # image: acapy-test-image # build: # context: . @@ -11,11 +12,12 @@ services: ports: - "3001:3001" volumes: - - ./acapy-endpoint.sh:/acapy-endpoint.sh:ro,z + - ./tunnel-endpoint.sh:/tunnel-endpoint.sh:ro,z environment: - TUNNEL_ENDPOINT: http://tunnel-alice:4040 + AGENT_TUNNEL_ENDPOINT: http://tunnel-bob:4040 + TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 entrypoint: > - /bin/sh -c '/acapy-endpoint.sh aca-py "$$@"' -- + /bin/sh -c '/tunnel_endpoint.sh aca-py "$$@"' -- command: > start -it http 0.0.0.0 3000 --label Alice @@ -45,7 +47,8 @@ services: condition: service_started bob: - image: bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0 + image: bcgovimages/aries-cloudagent:py36-1.16-1_0.7.5 + #image: bcgovimages/aries-cloudagent:py36-1.16-1_1.0.0-rc0 # image: acapy-test-image # build: # context: . @@ -55,11 +58,12 @@ services: ports: - "3002:3001" volumes: - - ./acapy-endpoint.sh:/acapy-endpoint.sh:ro,z + - ./tunnel-endpoint.sh:/tunnel-endpoint.sh:ro,z environment: - TUNNEL_ENDPOINT: http://tunnel-bob:4040 - entrypoint: > - /bin/sh -c '/acapy-endpoint.sh aca-py "$$@"' -- + AGENT_TUNNEL_ENDPOINT: http://tunnel-alice:4040 + TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 + entrypoint: + /bin/sh -c '/tunnel_endpoint.sh aca-py "$$@"' -- command: > start -it http 0.0.0.0 3000 --label Bob diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh new file mode 100755 index 0000000..8e9b742 --- /dev/null +++ b/tunnel_endpoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +AGENT_TUNNEL_ENDPOINT=${AGENT_TUNNEL_ENDPOINT:-http://localhost:4040} +TAILS_TUNNEL_ENDPOINT=${TAILS_TUNNEL_ENDPOINT:-http://localhost:4040} + +WAIT_INTERVAL=${WAIT_INTERVAL:-3} +WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} + +retrieve_endpoint () { + for _ in $(seq 1 "$WAIT_ATTEMPTS"); do + #TODO If wait attempts exceeded and we still haven't successfully gotten an endpoint, exit with status 1 + if ! curl -s -o /dev/null -w '%{http_code}' "${1}/url" | grep "200" > /dev/null; then + echo "Waiting for tunnel..." 1>&2 + sleep "$WAIT_INTERVAL" & + wait $! + else + break + fi + done +} + + +retrieve_endpoint ${AGENT_TUNNEL_ENDPOINT} +retrieve_endpoint ${TAILS_TUNNEL_ENDPOINT} + +ACAPY_ENDPOINT=$(curl --silent "${AGENT_TUNNEL_ENDPOINT}/url" | python -c "import sys, json; print(json.load(sys.stdin)['url'])") +ACAPY_TAILS_SERVER_BASE_URL=$(curl --silent "${TAILS_TUNNEL_ENDPOINT}/api/tunnels" | python -c "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])") +export ACAPY_ENDPOINT=${ACAPY_ENDPOINT} +export ACAPY_TAILS_SERVER_BASE_URL=${ACAPY_TAILS_SERVER_BASE_URL} +exec "$@" From 97762a118b8b3e3cd7f7e17cd025f0f2b4a5464e Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Fri, 11 Nov 2022 15:42:42 +0100 Subject: [PATCH 03/11] fix-name/tunnel_endpoint vs tunnel-endpoint Signed-off-by: anwalker293 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d24c3fa..98c614d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: ports: - "3001:3001" volumes: - - ./tunnel-endpoint.sh:/tunnel-endpoint.sh:ro,z + - ./tunnel_endpoint.sh:/tunnel_endpoint.sh:ro,z environment: AGENT_TUNNEL_ENDPOINT: http://tunnel-bob:4040 TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 @@ -58,7 +58,7 @@ services: ports: - "3002:3001" volumes: - - ./tunnel-endpoint.sh:/tunnel-endpoint.sh:ro,z + - ./tunnel_endpoint.sh:/tunnel_endpoint.sh:ro,z environment: AGENT_TUNNEL_ENDPOINT: http://tunnel-alice:4040 TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 From 98e3eeda9cffb170e967df29bbd9eb3c5b0f9d03 Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 11:55:16 +0100 Subject: [PATCH 04/11] Change of function name and deletion of /url Signed-off-by: anwalker293 --- tunnel_endpoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index 8e9b742..58c4f46 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -6,10 +6,10 @@ TAILS_TUNNEL_ENDPOINT=${TAILS_TUNNEL_ENDPOINT:-http://localhost:4040} WAIT_INTERVAL=${WAIT_INTERVAL:-3} WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} -retrieve_endpoint () { +liveliness_check () { for _ in $(seq 1 "$WAIT_ATTEMPTS"); do #TODO If wait attempts exceeded and we still haven't successfully gotten an endpoint, exit with status 1 - if ! curl -s -o /dev/null -w '%{http_code}' "${1}/url" | grep "200" > /dev/null; then + if ! curl -s -o /dev/null -w '%{http_code}' "${1}" | grep "200" > /dev/null; then echo "Waiting for tunnel..." 1>&2 sleep "$WAIT_INTERVAL" & wait $! @@ -20,8 +20,8 @@ retrieve_endpoint () { } -retrieve_endpoint ${AGENT_TUNNEL_ENDPOINT} -retrieve_endpoint ${TAILS_TUNNEL_ENDPOINT} +liveliness_check ${AGENT_TUNNEL_ENDPOINT} +liveliness_check ${TAILS_TUNNEL_ENDPOINT} ACAPY_ENDPOINT=$(curl --silent "${AGENT_TUNNEL_ENDPOINT}/url" | python -c "import sys, json; print(json.load(sys.stdin)['url'])") ACAPY_TAILS_SERVER_BASE_URL=$(curl --silent "${TAILS_TUNNEL_ENDPOINT}/api/tunnels" | python -c "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])") From 9047483d775df9ec746dab79906a76305916c5e4 Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 12:02:56 +0100 Subject: [PATCH 05/11] Trying to set up max attempt exit (first try) Signed-off-by: anwalker293 --- tunnel_endpoint.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index 58c4f46..d46fd14 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -7,10 +7,18 @@ WAIT_INTERVAL=${WAIT_INTERVAL:-3} WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} liveliness_check () { + CURRENT_ATTEMPT=0 for _ in $(seq 1 "$WAIT_ATTEMPTS"); do #TODO If wait attempts exceeded and we still haven't successfully gotten an endpoint, exit with status 1 if ! curl -s -o /dev/null -w '%{http_code}' "${1}" | grep "200" > /dev/null; then - echo "Waiting for tunnel..." 1>&2 + CURRENT_ATTEMPT=$((CURRENT_ATTEMPT+1)) + if [[ $CURRENT_ATTEMPT -gt $WAIT_ATTEMPT ]] + then + echo "Still haven't been able to reach the server. Please check your configurations or try again later" + exit 1 + fi + + echo "Waiting for tunnel..." 1>&2 sleep "$WAIT_INTERVAL" & wait $! else From 73cb031f92e2fb48619fd81438abe5160a48b38d Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 20:34:40 +0100 Subject: [PATCH 06/11] feat/changing current attempt and making useful error message Signed-off-by: anwalker293 --- tunnel_endpoint.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index d46fd14..a02de81 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -7,14 +7,11 @@ WAIT_INTERVAL=${WAIT_INTERVAL:-3} WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} liveliness_check () { - CURRENT_ATTEMPT=0 - for _ in $(seq 1 "$WAIT_ATTEMPTS"); do - #TODO If wait attempts exceeded and we still haven't successfully gotten an endpoint, exit with status 1 + for CURRENT_ATTEMPT in $(seq 1 "$WAIT_ATTEMPTS"); do if ! curl -s -o /dev/null -w '%{http_code}' "${1}" | grep "200" > /dev/null; then - CURRENT_ATTEMPT=$((CURRENT_ATTEMPT+1)) if [[ $CURRENT_ATTEMPT -gt $WAIT_ATTEMPT ]] then - echo "Still haven't been able to reach the server. Please check your configurations or try again later" + echo "Failed while waiting for 200 status from ${1}" exit 1 fi From b8bfaf2939752cd633be080a790fe8bfd0f1b4ae Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 20:40:06 +0100 Subject: [PATCH 07/11] Increasing interval from 3s to 7s Signed-off-by: anwalker293 --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 98c614d..10b1e1a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: healthcheck: test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null start_period: 30s - interval: 3s + interval: 7s timeout: 5s retries: 5 depends_on: @@ -81,7 +81,7 @@ services: healthcheck: test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null start_period: 30s - interval: 3s + interval: 7s timeout: 5s retries: 5 depends_on: @@ -108,7 +108,7 @@ services: healthcheck: test: nc -z localhost 3002 start_period: 5s - interval: 1s + interval: 7s timeout: 5s retries: 5 From 67462cf4352152461b23ca2958b52e0373ddcf0f Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 20:43:13 +0100 Subject: [PATCH 08/11] Adding /api/tunnels Signed-off-by: anwalker293 --- tunnel_endpoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index a02de81..93c2f45 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -8,7 +8,7 @@ WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} liveliness_check () { for CURRENT_ATTEMPT in $(seq 1 "$WAIT_ATTEMPTS"); do - if ! curl -s -o /dev/null -w '%{http_code}' "${1}" | grep "200" > /dev/null; then + if ! curl -s -o /dev/null -w '%{http_code}' "${1}/api/tunnels" | grep "200" > /dev/null; then if [[ $CURRENT_ATTEMPT -gt $WAIT_ATTEMPT ]] then echo "Failed while waiting for 200 status from ${1}" From a32b39194caf11adf80caf93b0bf78d9df8581f8 Mon Sep 17 00:00:00 2001 From: anwalker293 Date: Wed, 16 Nov 2022 22:24:18 +0100 Subject: [PATCH 09/11] Adding /status and changing tunnel ends Signed-off-by: anwalker293 --- docker-compose.yml | 4 ++-- tunnel_endpoint.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 10b1e1a..787e6fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: volumes: - ./tunnel_endpoint.sh:/tunnel_endpoint.sh:ro,z environment: - AGENT_TUNNEL_ENDPOINT: http://tunnel-bob:4040 + AGENT_TUNNEL_ENDPOINT: http://tunnel-alice:4040 TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 entrypoint: > /bin/sh -c '/tunnel_endpoint.sh aca-py "$$@"' -- @@ -60,7 +60,7 @@ services: volumes: - ./tunnel_endpoint.sh:/tunnel_endpoint.sh:ro,z environment: - AGENT_TUNNEL_ENDPOINT: http://tunnel-alice:4040 + AGENT_TUNNEL_ENDPOINT: http://tunnel-bob:4040 TAILS_TUNNEL_ENDPOINT: http://tunnel-tails:4040 entrypoint: /bin/sh -c '/tunnel_endpoint.sh aca-py "$$@"' -- diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index 93c2f45..06e00e2 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -8,7 +8,7 @@ WAIT_ATTEMPTS=${WAIT_ATTEMPTS:-10} liveliness_check () { for CURRENT_ATTEMPT in $(seq 1 "$WAIT_ATTEMPTS"); do - if ! curl -s -o /dev/null -w '%{http_code}' "${1}/api/tunnels" | grep "200" > /dev/null; then + if ! curl -s -o /dev/null -w '%{http_code}' "${1}/status" | grep "200" > /dev/null; then if [[ $CURRENT_ATTEMPT -gt $WAIT_ATTEMPT ]] then echo "Failed while waiting for 200 status from ${1}" From 896a3fbba336464d840dfa9800d5c600da5396cc Mon Sep 17 00:00:00 2001 From: Alex Walker Date: Thu, 17 Nov 2022 04:03:59 -0800 Subject: [PATCH 10/11] fix/fixing-docker-compose-names-etc Signed-off-by: Alex Walker --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 787e6fd..dd7e465 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -157,8 +157,8 @@ services: args: install_flags: "" environment: - - ISSUER=http://alice:3001 - - HOLDER=http://bob:3001 + - ALICE=http://alice:3001 + - BOB=http://bob:3001 - ECHO_ENDPOINT=http://echo:3002 volumes: - ./controller:/usr/src/app/controller:z From 977ec4d01ccb2b8f68dd46bc8d8a2829a18bae2a Mon Sep 17 00:00:00 2001 From: Alex Walker Date: Thu, 17 Nov 2022 04:06:04 -0800 Subject: [PATCH 11/11] fix/adding /status to end of 200 check Also making requested changes Signed-off-by: Alex Walker --- tunnel_endpoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tunnel_endpoint.sh b/tunnel_endpoint.sh index 06e00e2..72a35d5 100755 --- a/tunnel_endpoint.sh +++ b/tunnel_endpoint.sh @@ -33,3 +33,4 @@ ACAPY_TAILS_SERVER_BASE_URL=$(curl --silent "${TAILS_TUNNEL_ENDPOINT}/api/tunnel export ACAPY_ENDPOINT=${ACAPY_ENDPOINT} export ACAPY_TAILS_SERVER_BASE_URL=${ACAPY_TAILS_SERVER_BASE_URL} exec "$@" +