From f553332fae88385a37d054b20ce9fe9cf81aac64 Mon Sep 17 00:00:00 2001 From: Jacob Kopczynski Date: Thu, 12 May 2022 07:51:33 -0700 Subject: [PATCH] Make port 8080 parameterized (#301) * add PORT to start.sh and .env Signed-off-by: Jacob Kopczynski * Pull in .env when using quick start Principally to set PORT but it makes the rest of the docker-compose work more smoothly as well. Signed-off-by: Jacob Kopczynski * Make docker-compose.yaml sufficient Allow PORT to be set as envvar, but default to 8080 Signed-off-by: Jacob Kopczynski --- .env | 1 + README.md | 1 + docker-compose.yaml | 6 +++--- start.sh | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 0d82721a7..983cadf28 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ +PORT=8080 EXPLORER_CONFIG_FILE_PATH=./examples/net1/config.json EXPLORER_PROFILE_DIR_PATH=./examples/net1/connection-profile FABRIC_CRYPTO_PATH=/fabric-path/fabric-samples/test-network/organizations \ No newline at end of file diff --git a/README.md b/README.md index 2f9e1eaa6..b0442b676 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ This guide assumes that you've already started the test network by following [Hy * Copy the following files from the repository + - [.env](https://github.com/hyperledger/blockchain-explorer/blob/main/.env) - [docker-compose.yaml](https://github.com/hyperledger/blockchain-explorer/blob/main/docker-compose.yaml) - [examples/net1/connection-profile/test-network.json](https://github.com/hyperledger/blockchain-explorer/blob/main/examples/net1/connection-profile/test-network.json) - [examples/net1/config.json](https://github.com/hyperledger/blockchain-explorer/blob/main/examples/net1/config.json) diff --git a/docker-compose.yaml b/docker-compose.yaml index 25f14457c..a688aec46 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,8 +8,7 @@ volumes: networks: mynetwork.com: - external: - name: fabric_test + name: fabric_test services: @@ -45,13 +44,14 @@ services: - LOG_LEVEL_CONSOLE=debug - LOG_CONSOLE_STDOUT=true - DISCOVERY_AS_LOCALHOST=false + - PORT=${PORT:-8080} volumes: - ${EXPLORER_CONFIG_FILE_PATH}:/opt/explorer/app/platform/fabric/config.json - ${EXPLORER_PROFILE_DIR_PATH}:/opt/explorer/app/platform/fabric/connection-profile - ${FABRIC_CRYPTO_PATH}:/tmp/crypto - walletstore:/opt/explorer/wallet ports: - - 8080:8080 + - ${PORT:-8080}:${PORT:-8080} depends_on: explorerdb.mynetwork.com: condition: service_healthy diff --git a/start.sh b/start.sh index 485434bf3..6a04d9ffa 100755 --- a/start.sh +++ b/start.sh @@ -19,6 +19,7 @@ export LOG_CONSOLE_STDOUT=${LOG_CONSOLE_STDOUT:-false} export DISCOVERY_AS_LOCALHOST=${DISCOVERY_AS_LOCALHOST:-true} export EXPLORER_APP_ROOT=${EXPLORER_APP_ROOT:-dist} +export PORT=${PORT:-8080} function log_exit() { echo "Server stopped"