Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: added local development testing node sync docker compose #2070

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ RUN go mod download
# Copy the rest of the source code and build the application
COPY . .

RUN make install
RUN EXPECTED_MAJOR_VERSION=$(grep 'const releaseVersion = ' app/setup_handlers.go | awk -F'"' '{print $2}') && \
make install VERSION="${EXPECTED_MAJOR_VERSION}" && \
echo -n "${EXPECTED_MAJOR_VERSION}" > /go/delivery/zeta-node/EXPECTED_MAJOR_VERSION
gzukel marked this conversation as resolved.
Show resolved Hide resolved

# Run Stage
FROM alpine:3.18
Expand All @@ -46,6 +48,7 @@ RUN apk --no-cache add git jq bash curl nano vim tmux python3 libusb-dev linux-h
# Copy the binaries from the build stage
COPY --from=builder /go/bin/zetaclientd /usr/local/bin/zetaclientd
COPY --from=builder /go/bin/zetacored /usr/local/bin/zetacored
COPY --from=builder /go/delivery/zeta-node/EXPECTED_MAJOR_VERSION /scripts/EXPECTED_MAJOR_VERSION

# Set the working directory
WORKDIR /usr/local/bin
Expand Down
46 changes: 41 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,51 @@ release:
### Local Mainnet Development ###
###############################################################################

mainnet-zetarpc-node:
cd contrib/mainnet/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

mainnet-bitcoind-node:
start-bitcoin-node-mainnet:
cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

athens3-zetarpc-node:
start-zetacored-rpc-mainnet:
cd contrib/mainnet/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

start-zetacored-rpc-testnet:
cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose up

stop-bitcoin-node-mainnet:
cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose down

stop-zetacored-rpc-testnet:
cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose down

stop-zetacored-rpc-mainnet:
cd contrib/mainnet/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose down

clean-bitcoin-node-mainnet:
cd contrib/mainnet/bitcoind && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v

clean-zetacored-rpc-testnet:
cd contrib/athens3/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v

clean-zetacored-rpc-mainnet:
cd contrib/mainnet/zetacored && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v

start-zetacored-rpc-mainnet-localbuild:
cd contrib/mainnet/zetacored-localbuild && docker-compose up --build

start-zetacored-rpc-testnet-localbuild:
cd contrib/athens3/zetacored-localbuild && docker-compose up --build

stop-zetacored-rpc-mainnet-localbuild:
cd contrib/mainnet/zetacored-localbuild && docker-compose down

stop-zetacored-rpc-testnet-localbuild:
cd contrib/athens3/zetacored-localbuild && docker-compose down

zetacored-rpc-mainnet-localbuild:
cd contrib/mainnet/zetacored-localbuild && docker-compose down -v

zetacored-rpc-testnet-localbuild:
cd contrib/athens3/zetacored-localbuild && docker-compose down -v

gzukel marked this conversation as resolved.
Show resolved Hide resolved
###############################################################################
### Debug Tools ###
###############################################################################
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@

### CI

* [2070](https://github.com/zeta-chain/node/pull/2070) - Added commands to build binaries from the working branch as a live full node rpc to test non-governance changes.
lumtis marked this conversation as resolved.
Show resolved Hide resolved
* [1958](https://github.com/zeta-chain/node/pull/1958) - Fix e2e advanced test debug checkbox.
* [1945](https://github.com/zeta-chain/node/pull/1945) - update advanced testing pipeline to not execute tests that weren't selected so they show skipped instead of skipping steps.
* [1940](https://github.com/zeta-chain/node/pull/1940) - adjust release pipeline to be created as pre-release instead of latest
Expand Down
43 changes: 43 additions & 0 deletions contrib/athens3/zetacored-localbuild/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.8'
services:
zetachain_athens3_rpc:
platform: linux/amd64
build:
context: ../../..
dockerfile: Dockerfile
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: athens3
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
CHAIN_ID: "athens_7001-1"
VISOR_NAME: "cosmovisor"
DAEMON_NAME: "zetacored"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
DAEMON_RESTART_AFTER_UPGRADE: "false"
UNSAFE_SKIP_BACKUP: "true"
CLIENT_DAEMON_NAME: "zetaclientd"
CLIENT_DAEMON_ARGS: ""
CLIENT_SKIP_UPGRADE: "true"
CLIENT_START_PROCESS: "false"
gzukel marked this conversation as resolved.
Show resolved Hide resolved
MONIKER: testnet-docker-rpc
#If this is true it will erase everything and start over from scratch.
RE_DO_START_SEQUENCE: "false"
#If this is true it will build the dockerfile and use binary from built docker file instead of remote docker image for local development testing on non-governance upgrades.
IS_LOCAL_DEVELOPMENT: "true"
ports:
- "26656:26656"
- "1317:1317"
- "8545:8545"
- "8546:8546"
- "26657:26657"
- "9090:9090"
- "9091:9091"
volumes:
- zetacored_data_athens3:/root/.zetacored/
- ../../../contrib/docker-scripts/start.sh:/scripts/start.sh
entrypoint: bash /scripts/start.sh

volumes:
zetacored_data_athens3:
15 changes: 6 additions & 9 deletions contrib/athens3/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
version: '3.8'
services:
zetachain_mainnet_rpc:
zetachain_athens3_rpc:
platform: linux/amd64
#This will build the binary from the GIT_REF you are locally on.
# build:
# context: ../../..
# dockerfile: Dockerfile
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1}
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1.0}
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: athens3
#RESTORE_TYPE=snapshot/snapshot-archive/statesync
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
Expand All @@ -24,8 +19,11 @@ services:
CLIENT_DAEMON_ARGS: ""
CLIENT_SKIP_UPGRADE: "true"
CLIENT_START_PROCESS: "false"
MONIKER: local-test
MONIKER: testnet-docker-rpc
#If this is true it will erase everything and start over from scratch.
RE_DO_START_SEQUENCE: "false"
#If this is true it will build the dockerfile and use binary from built docker file instead of remote docker image for local development testing on non-governance upgrades.
IS_LOCAL_DEVELOPMENT: "false"
ports:
- "26656:26656"
- "1317:1317"
Expand All @@ -37,6 +35,5 @@ services:
volumes:
- zetacored_data_athens3:/root/.zetacored/
entrypoint: bash /scripts/start.sh

volumes:
zetacored_data_athens3:
31 changes: 30 additions & 1 deletion contrib/docker-scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,36 @@ function move_zetacored_binaries {
}

function start_network {
${VISOR_NAME} version
if [ "${IS_LOCAL_DEVELOPMENT}" == "true" ]; then
cp /usr/local/bin/zetacored ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored
mkdir -p ${DAEMON_HOME}/cosmovisor/current/bin
rm -rf ${DAEMON_HOME}/cosmovisor/current/bin/zetacored || echo "Doesn't Exist"
ln -s ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored ${DAEMON_HOME}/cosmovisor/current/bin/zetacored
fi
EXPECTED_MAJOR_VERSION=$(cat /scripts/EXPECTED_MAJOR_VERSION)
VISOR_VERSION=v$(${VISOR_NAME} version | tail -n 1 | tr -d '(devel)' | tr -d '\n')
DAEMON_VERSION=$(${DAEMON_NAME} version)
VISOR_MAJOR_VERSION=$(echo $VISOR_VERSION | grep -o '^v[0-9]*')
DAEMON_MAJOR_VERSION=$(echo $DAEMON_VERSION | grep -o '^v[0-9]*')

logt "EXPECTED_MAJOR_VERSION: ${EXPECTED_MAJOR_VERSION}"
logt "VISOR_VERSION: ${VISOR_VERSION}"
logt "DAEMON_VERSION: ${DAEMON_VERSION}"
logt "VISOR_MAJOR_VERSION: ${VISOR_MAJOR_VERSION}"
logt "DAEMON_MAJOR_VERSION: ${DAEMON_MAJOR_VERSION}"

if [ "$VISOR_MAJOR_VERSION" != "$EXPECTED_MAJOR_VERSION" ] || [ "$DAEMON_MAJOR_VERSION" != "$EXPECTED_MAJOR_VERSION" ]; then
logt "One or both versions don't match the expected major release version: $EXPECTED_MAJOR_VERSION"
else
logt "Both versions match the expected major release version: $EXPECTED_MAJOR_VERSION"
fi

if [ "$VISOR_VERSION" != "$DAEMON_VERSION" ]; then
logt "cosmovisor version doesn't appear to match your daemon version. Start ${DAEMON_NAME}"
else
logt "cosmovisor version match your daemon version. Start ${VISOR_NAME}"
fi

${VISOR_NAME} run start --home ${DAEMON_HOME} \
--log_level info \
--moniker ${MONIKER} \
Expand Down
46 changes: 46 additions & 0 deletions contrib/mainnet/zetacored-localbuild/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3.8'
services:
zetachain_mainnet_rpc:
platform: linux/amd64
build:
context: ../../..
dockerfile: Dockerfile
container_name: zetachain_mainnet_rpc
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: mainnet
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
CHAIN_ID: "zetachain_7000-1"
VISOR_NAME: "cosmovisor"
DAEMON_NAME: "zetacored"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
DAEMON_RESTART_AFTER_UPGRADE: "false"
UNSAFE_SKIP_BACKUP: "true"
CLIENT_DAEMON_NAME: "zetaclientd"
CLIENT_DAEMON_ARGS: ""
CLIENT_SKIP_UPGRADE: "true"
CLIENT_START_PROCESS: "false"
MONIKER: mainnet-docker-rpc
#If this is true it will erase everything and start over from scratch.
RE_DO_START_SEQUENCE: "false"
#If this is true it will build the dockerfile and use binary from built docker file instead of remote docker image for local development testing on non-governance upgrades.
IS_LOCAL_DEVELOPMENT: "true"
ports:
- "26656:26656"
- "1317:1317"
- "8545:8545"
- "8546:8546"
- "26657:26657"
- "9090:9090"
- "9091:9091"
volumes:
- zetacored_data_mainnet:/root/.zetacored/
- ../../../contrib/docker-scripts/start.sh:/scripts/start.sh
entrypoint: bash /scripts/start.sh
#for debugging
gzukel marked this conversation as resolved.
Show resolved Hide resolved
#entrypoint: ["/bin/sh", "-c"]
#command: ["while true; do sleep 86400; done"]
volumes:
zetacored_data_mainnet:
15 changes: 5 additions & 10 deletions contrib/mainnet/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ version: '3.8'
services:
zetachain_mainnet_rpc:
platform: linux/amd64
#This will build the binary from the GIT_REF you are locally on.
# build:
# context: ../../..
# dockerfile: Dockerfile
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1}
image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1.0}
container_name: zetachain_mainnet_rpc
environment:
DAEMON_HOME: "/root/.zetacored"
NETWORK: mainnet
#RESTORE_TYPE=snapshot/snapshot-archive/statesync
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
Expand All @@ -25,8 +20,11 @@ services:
CLIENT_DAEMON_ARGS: ""
CLIENT_SKIP_UPGRADE: "true"
CLIENT_START_PROCESS: "false"
MONIKER: local-test
MONIKER: mainnet-docker-rpc
#If this is true it will erase everything and start over from scratch.
RE_DO_START_SEQUENCE: "false"
#If this is true it will build the dockerfile and use binary from built docker file instead of remote docker image for local development testing on non-governance upgrades.
IS_LOCAL_DEVELOPMENT: "false"
ports:
- "26656:26656"
- "1317:1317"
Expand All @@ -38,8 +36,5 @@ services:
volumes:
- zetacored_data_mainnet:/root/.zetacored/
entrypoint: bash /scripts/start.sh
#for debugging
#entrypoint: ["/bin/sh", "-c"]
#command: ["while true; do sleep 86400; done"]
volumes:
zetacored_data_mainnet:
Loading
Loading