Skip to content

Commit

Permalink
Add node socket control to docker-compose.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Action committed Jul 3, 2024
1 parent caa1079 commit ebbd3ba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export WALLET_PORT=8090
# set your user id
export USER_ID=$(id -u)
# set a node socket dir path
export NODE_SOCKET_DIR=`pwd`/node_socket
# set a node socket name
export NODE_SOCKET_NAME=node.socket
if [ "$(ls -A "${NODE_DB}")" ]
then
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ services:
image: cardanofoundation/cardano-wallet:${WALLET_TAG}
environment:
NETWORK:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
CARDANO_NODE_SOCKET_PATH: /ipc/${NODE_SOCKET_NAME}
volumes:
- ${NODE_DB}:/data
- node-ipc:/ipc
- ${NODE_SOCKET_DIR}:/ipc
- ./configs/cardano:/configs
restart: on-failure
user: ${USER_ID}
Expand All @@ -29,7 +29,7 @@ services:
image: cardanofoundation/cardano-wallet:${WALLET_TAG}
volumes:
- ${WALLET_DB}:/wallet-db
- node-ipc:/ipc
- ${NODE_SOCKET_DIR}:/ipc
- ./configs/cardano:/configs
ports:
- ${WALLET_PORT}:8090
Expand All @@ -39,7 +39,7 @@ services:
($$CMD --testnet /configs/${NETWORK}/byron-genesis.json)
"
environment:
CMD: "cardano-wallet serve --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0"
CMD: "cardano-wallet serve --node-socket /ipc/${NODE_SOCKET_NAME} --database /wallet-db --listen-address 0.0.0.0"
NETWORK:
user: ${USER_ID}
restart: on-failure
Expand Down
28 changes: 26 additions & 2 deletions scripts/buildkite/release/docker-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ NETWORK=preprod
export NETWORK

TESTS_NODE_DB="$(pwd)/state/node_db"

mkdir -p "$TESTS_NODE_DB"
export TESTS_NODE_DB

Expand All @@ -32,6 +33,20 @@ export WALLET_PORT
USER_ID=$(id -u)
export USER_ID

tmpfile=$(mktemp -d /tmp/node-preprod.XXXXXX)

# set the node socket path
NODE_SOCKET_DIR="$tmpfile"
export NODE_SOCKET_DIR

NODE_SOCKET_NAME="node.socket"
export NODE_SOCKET_NAME

COMPOSE_PROJECT_NAME="docker-smoke-test-$WALLET_PORT"
export COMPOSE_PROJECT_NAME

docker compose down || true

docker-compose up -d

n=0
Expand All @@ -44,14 +59,23 @@ do
echo "$result" | jq
break
else
sleep 1
sleep 4
n=$((n+1))
fi
if [ "$n" -ge 20 ]
if [ "$n" -ge 30 ]
then break
fi
done


mkdir -p logs
docker-compose logs > logs/docker-compose.log
docker-compose down

rm -rf "$tmpfile"

if [ "$result" == "wait" ];
then
echo "Failed to start the wallet server"
exit 1
fi

0 comments on commit ebbd3ba

Please sign in to comment.