Skip to content

Commit

Permalink
Split docker compose for mainnet and preprod
Browse files Browse the repository at this point in the history
  • Loading branch information
Github Action committed Jul 2, 2024
1 parent b1401ed commit a6913d7
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 35 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,22 @@ else
curl -o - https://downloads.csnapshots.io/mainnet/$(curl -s https://downloads.csnapshots.io/mainnet/mainnet-db-snapshot.json| jq -r .[].file_name ) | lz4 -c -d - | tar -x -C $NODE_DB
mv $NODE_DB/db/* $NODE_DB/
rm -rf $NODE_DB/db
docker compose -f docker-compose-mainnet.yml up -d
elif [ $NETWORK == "preprod" ]
then
curl -o - https://downloads.csnapshots.io/testnet/$(curl -s https://downloads.csnapshots.io/testnet/testnet-db-snapshot.json| jq -r .[].file_name ) | lz4 -c -d - | tar -x -C $NODE_DB
mv $NODE_DB/db/* $NODE_DB/
rm -rf $NODE_DB/db
docker compose -f docker-compose-preprod.yml up -d
elif [ $NETWORK == "sanchonet" ]
then echo "no cache for sancho";
then
echo "no cache for sancho";
docker compose -f docker-compose-sanchonet.yml up -d
else
echo "NETWORK must be mainnet or preprod or sanchonet"
exit 1
fi
fi
# start the services
docker-compose up
```


Expand Down
26 changes: 3 additions & 23 deletions docker-compose.yml → docker-compose-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
services:
cardano-node:
container_name: cardano-node-on-${WALLET_PORT:-8090}
image: cardanofoundation/cardano-wallet:${WALLET_TAG}
environment:
CARDANO_NODE_SOCKET_PATH: /ipc/${NODE_SOCKET_NAME:-node.socket}
NETWORK: ${NETWORK:-preprod}
volumes:
- ${NODE_DB}:/data
- ${NODE_SOCKET_DIR}:/ipc
Expand All @@ -20,12 +16,6 @@ services:
max-file: "10"
max-size: "50m"
entrypoint: []
command: >
cardano-node run --topology /configs/${NETWORK}/topology.json
--database-path /data
--socket-path ${CARDANO_NODE_SOCKET_PATH}
--config /configs/${NETWORK}/config.json
+RTS -N3

cardano-wallet:
container_name: cardano-wallet-on-${WALLET_PORT}
Expand All @@ -37,19 +27,6 @@ services:
ports:
- ${WALLET_PORT}:8090
entrypoint: []
command: |
NETWORK_OPTION=$([[ $$NETWORK == \"mainnet\" ]] && echo --mainnet \
|| echo --testnet /configs/${NETWORK}/byron-genesis.json)
cardano-wallet serve \
--node-socket ${CARDANO_NODE_SOCKET_PATH} \
--database /wallet-db \
--listen-address 0.0.0.0 \
$$NETWORK_OPTION \
+RTS -N3
environment:
WALLET_PORT: ${WALLET_PORT:-8090}
CARDANO_NODE_SOCKET_PATH: /ipc/${NODE_SOCKET_NAME:-node.socket}
NETWORK: ${NETWORK:-preprod}
user: ${USER_ID}
restart: on-failure
logging:
Expand All @@ -58,6 +35,9 @@ services:
compress: "true"
max-file: "10"
max-size: "50m"
environment:
WALLET_PORT: ${WALLET_PORT:-8090}

icarus:
image: piotrstachyra/icarus:v2023-04-14
container_name: icarus-on-${WALLET_PORT}
Expand Down
34 changes: 34 additions & 0 deletions docker-compose-mainnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@



services:
cardano-node:
extends:
file: docker-compose-common.yml
service: cardano-node
image: ghcr.io/intersectmbo/cardano-node:8.9.3
command: >
cardano-node run --topology /configs/mainnet/topology.json
--database-path /data
--socket-path /ipc/${NODE_SOCKET_NAME:-node.socket}
--config /configs/mainnet/config.json
+RTS -N3
cardano-wallet:

extends:
file: docker-compose-common.yml
service: cardano-wallet

command: >
cardano-wallet serve
--node-socket /ipc/${NODE_SOCKET_NAME:-node.socket}
--database /wallet-db
--listen-address 0.0.0.0
--mainnet
+RTS -N3
icarus:
extends:
file: docker-compose-common.yml
service: icarus
34 changes: 34 additions & 0 deletions docker-compose-preprod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@



services:
cardano-node:
extends:
file: docker-compose-common.yml
service: cardano-node
image: cardanofoundation/cardano-wallet:${WALLET_TAG}
command: >
cardano-node run --topology /configs/preprod/topology.json
--database-path /data
--socket-path /ipc/${NODE_SOCKET_NAME:-node.socket}
--config /configs/preprod/config.json
+RTS -N3
cardano-wallet:

extends:
file: docker-compose-common.yml
service: cardano-wallet

command: >
cardano-wallet serve
--node-socket /ipc/${NODE_SOCKET_NAME:-node.socket}
--database /wallet-db
--listen-address 0.0.0.0
--testnet /configs/preprod/byron-genesis.json
+RTS -N3
icarus:
extends:
file: docker-compose-common.yml
service: icarus
35 changes: 35 additions & 0 deletions docker-compose-sanchonet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@



services:
cardano-node:

extends:
file: docker-compose-common.yml
service: cardano-node
image: ghcr.io/intersectmbo/cardano-node:8.11.0-pre
command: >
cardano-node run --topology /configs/sanchonet/topology.json
--database-path /data
--socket-path /ipc/${NODE_SOCKET_NAME:-node.socket}
--config /configs/sanchonet/config.json
+RTS -N3
cardano-wallet:

extends:
file: docker-compose-common.yml
service: cardano-wallet

command: >
cardano-wallet serve
--node-socket /ipc/${NODE_SOCKET_NAME:-node.socket}
--database /wallet-db
--listen-address 0.0.0.0
--testnet /configs/sanchonet/byron-genesis.json
+RTS -N3
icarus:
extends:
file: docker-compose-common.yml
service: icarus
7 changes: 4 additions & 3 deletions scripts/buildkite/release/docker-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ export NODE_SOCKET_NAME
COMPOSE_PROJECT_NAME="e2e-tests-$WALLET_PORT"
export COMPOSE_PROJECT_NAME

docker-compose down || true
dc="docker compose -f docker-compose-preprod.yml"

docker-compose up -d
${dc} down || true
${dc} up -d

mkdir -p "$(pwd)/logs"

Expand Down Expand Up @@ -88,6 +89,6 @@ nix develop -c rake wait_until_node_synced
nix develop -c rake secrets_decode
nix develop -c rake spec

docker-compose down
${dc} down

rm -rf "$NODE_SOCKET_DIR"
12 changes: 7 additions & 5 deletions scripts/buildkite/release/docker-smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ export NODE_SOCKET_NAME
COMPOSE_PROJECT_NAME="docker-smoke-test-$WALLET_PORT"
export COMPOSE_PROJECT_NAME

docker compose down || true
dc="docker compose -f docker-compose-preprod.yml"

docker-compose up -d
${dc} down || true
${dc} up -d

n=0
while :
Expand All @@ -62,15 +63,16 @@ do
sleep 4
n=$((n+1))
fi
if [ "$n" -ge 30 ]
if [ "$n" -ge 10 ]
then break
fi
done


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

${dc} logs > logs/docker-compose.log
${dc} down

rm -rf "$tmpfile"

Expand Down

0 comments on commit a6913d7

Please sign in to comment.