github.com/hyperledger/aries-framework-go@v0.3.2/scripts/start_edv_test_docker_images.sh (about) 1 #!/bin/bash 2 # 3 # Copyright SecureKey Technologies Inc. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 # First argument is the exit code. 9 # Second argument is the command that was run. 10 check_exit_code () { 11 if [ "$1" -ne 0 ] && [ "$1" -ne 1 ]; then 12 echo "error: '${2}' returned ${1}, but either 0 or 1 was expected." 13 14 # There's no easy way to print the error message on the screen without temporary files, 15 # so we ask the user to check manually 16 echo "Try running '${2}' manually to see the full error message." 17 18 exit 1 19 fi 20 } 21 22 # docker rm returns 1 if the container isn't found. This is OK and expected, so we suppress it. 23 # Any return status other than 0 or 1 is unusual and so we exit. 24 remove_docker_containers () { 25 DOCKER_KILL_EXIT_CODE=0 26 docker kill AriesMongoDBStorageTest >/dev/null 2>&1 || DOCKER_KILL_EXIT_CODE=$? 27 docker kill AriesEDVStorageTest >/dev/null 2>&1 || DOCKER_KILL_EXIT_CODE=$? 28 29 check_exit_code $DOCKER_KILL_EXIT_CODE "docker kill AriesMongoDBStorageTest" 30 check_exit_code $DOCKER_KILL_EXIT_CODE "docker kill AriesEDVStorageTest" 31 32 DOCKER_RM_EXIT_CODE=0 33 docker rm AriesMongoDBStorageTest >/dev/null 2>&1 || DOCKER_RM_EXIT_CODE=$? 34 docker rm AriesEDVStorageTest >/dev/null 2>&1 || DOCKER_RM_EXIT_CODE=$? 35 36 check_exit_code $DOCKER_RM_EXIT_CODE "docker rm AriesMongoDBStorageTest" 37 check_exit_code $DOCKER_RM_EXIT_CODE "docker rm AriesEDVStorageTest" 38 } 39 40 DOCKER_CREATE_NETWORK_EXIT_CODE=0 41 docker network create AriesTestNetwork >/dev/null 2>&1 || DOCKER_CREATE_NETWORK_EXIT_CODE=$? 42 check_exit_code $DOCKER_CREATE_NETWORK_EXIT_CODE "docker network create AriesTestNetwork" 43 44 remove_docker_containers 45 46 PWD=$(pwd) 47 48 docker run -p 27017:27017 -d --network AriesTestNetwork --name AriesMongoDBStorageTest mongo:4.0.0 >/dev/null 49 50 docker run -p 8071:8071 -d --network AriesTestNetwork --name AriesEDVStorageTest ghcr.io/trustbloc-cicd/edv:0.1.9-snapshot-894c500 start --host-url 0.0.0.0:8071 --database-prefix edv_db_ --database-type mongodb --database-url mongodb://AriesMongoDBStorageTest:27017 --with-extensions Batch --log-level=debug >/dev/null