Skip to content

Commit

Permalink
Mostly cosmetic changes for ccf related scripts
Browse files Browse the repository at this point in the history
Fixed spelling issue, removed commented code, and
(only functional change) added one more check for
port availability before starting the CCF services.

Signed-off-by: Mic Bowman <[email protected]>
  • Loading branch information
cmickeyb committed Jul 6, 2023
1 parent 1a853c5 commit 041784e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docker/ccf_base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
network_mode: "host"
volumes:
- ./xfer/:/project/pdo/xfer/
# entrypoint: /project/pdo/tools/start_ccf.sh
entrypoint: /project/pdo/tools/start_ccf.sh
healthcheck:
test: ["CMD", "test", "-r", "/project/pdo/xfer/ccf/keys/networkcert.pem"]
start_period: 10s
Expand Down
7 changes: 0 additions & 7 deletions docker/tools/run_ccf_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ export NO_PROXY=$PDO_HOSTNAME,$PDO_LEDGER_ADDRESS,$NO_PROXY
# hierarchy. future PR.
mkdir -p ${PDO_LEDGER_KEY_ROOT}

# # -----------------------------------------------------------------
# yell configure services for host $PDO_HOSTNAME and ledger $PDO_LEDGER_URL
# # -----------------------------------------------------------------
# rm -f ${PDO_HOME}/ccf/etc/cchost.toml ${PDO_HOME}/ccf/etc/constitution.js
# try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf keys
# try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf config

# -----------------------------------------------------------------
yell start the ccf service
# -----------------------------------------------------------------
Expand Down
20 changes: 0 additions & 20 deletions docker/tools/start_ccf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,6 @@ export NO_PROXY=$PDO_HOSTNAME,$PDO_LEDGER_ADDRESS,$NO_PROXY
# hierarchy. future PR.
mkdir -p ${PDO_LEDGER_KEY_ROOT}

# -----------------------------------------------------------------
# Handle the configuration of the services
#
# Note the environment should have been created during the build
# process for the ccf image
# -----------------------------------------------------------------
# if [ "${F_MODE,,}" == "build" ]; then
# yell configure services for host $PDO_HOSTNAME and ledger $PDO_LEDGER_URL
# try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf keys
# try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf config
# elif [ "${F_MODE,,}" == "copy" ]; then
# yell copy the configuration from xfer/ccf/etc and xfer/ccf/keys
# try cp ${XFER_DIR}/ccf/etc/* ${PDO_HOME}/ccf/etc/
# try cp ${XFER_DIR}/ccf/keys/* ${PDO_LEDGER_KEY_ROOT}/
# elif [ "${F_MODE,,}" == "skip" ]; then
# yell restart with existing configuration
# else
# die "invalid restart mode; ${F_MODE}"
# fi

# -----------------------------------------------------------------
say start the ccf network
# -----------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions ledgers/ccf/scripts/start_ccf_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ if [ -f ${PDO_HOME}/ccf/workspace/sandbox_0/node.pid ]; then
fi
fi

if lsof -Pi "@${F_INTERFACE}:${F_PORT}" -sTCP:LISTEN -t > /dev/null
then
yell interface "local:${F_INTERFACE}:${F_PORT}" appears to be in use
exit -1
fi

rm -f ${PDO_LEDGER_KEY_ROOT}/networkcert.pem
rm -f ${PDO_LEDGER_KEY_ROOT}/ledger_authority_pub.pem

Expand Down
2 changes: 1 addition & 1 deletion ledgers/ccf/scripts/stop_cchost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source ${PDO_HOME}/bin/lib/common.sh

if [ -f ${PDO_HOME}/ccf/workspace/sandbox_0/node.pid ]; then
kill $(cat ${PDO_HOME}/ccf/workspace/sandbox_0/node.pid)
#Kill the parent as well. Otherwise cchost continues to liger as a defunct process
#Kill the parent as well. Otherwise cchost continues to linger as a defunct process
CCHOST_PID=$(cat ${PDO_HOME}/ccf/workspace/sandbox_0/node.pid)
kill $(cat /proc/${CCHOST_PID}/status | grep PPid | cut -f2) > /dev/null
fi

0 comments on commit 041784e

Please sign in to comment.