Skip to content

Commit

Permalink
ci: default restore_type for full node docker-compose to snapshot ins…
Browse files Browse the repository at this point in the history
…tead of statesync for reliability. (#1867)

* ci: default restore_type for full node docker-compose to snapshot instead of statesync for reliability.
  • Loading branch information
gzukel authored Mar 11, 2024
1 parent 828529c commit 34c586b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 30 deletions.
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,23 @@ RUN make install
# Run Stage
FROM alpine:3.18

ENV COSMOVISOR_CHECKSUM="626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc"
ENV COSMOVISOR_VERSION="v1.5.0"
# Copy Start Script Helpers
COPY contrib/docker-scripts/* /scripts/

# Install runtime dependencies
RUN apk --no-cache add git jq bash curl python3 libusb-dev linux-headers make build-base wget py3-pip qemu-img qemu-system-x86_64 && \
RUN apk --no-cache add git jq bash curl nano vim tmux python3 libusb-dev linux-headers make build-base bind-tools psmisc coreutils wget py3-pip qemu-img qemu-system-x86_64 && \
pip install requests && \
chmod a+x -R /scripts && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk && \
apk add --force-overwrite --allow-untrusted glibc-2.31-r0.apk
apk add --force-overwrite --allow-untrusted glibc-2.31-r0.apk && \
curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz && \
mkdir -p /usr/local/gcloud && \
tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz && \
/usr/local/gcloud/google-cloud-sdk/install.sh --quiet && \
ln -s /usr/local/gcloud/google-cloud-sdk/bin/gcloud /usr/bin/gcloud && \
python /scripts/install_cosmovisor.py

# Copy the binaries from the build stage
COPY --from=builder /go/bin/zetaclientd /usr/local/bin/zetaclientd
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@

* [1814](https://github.com/zeta-chain/node/pull/1814) - fix code coverage ignore for protobuf generated files

### CI

* [1867](https://github.com/zeta-chain/node/pull/1867) - default restore_type for full node docker-compose to snapshot instead of statesync for reliability.

## Version: v14

- [1817](https://github.com/zeta-chain/node/pull/1817) - Add migration script to fix pending and chain nonces on testnet
Expand Down
4 changes: 1 addition & 3 deletions contrib/athens3/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ services:
DAEMON_HOME: "/root/.zetacored"
NETWORK: athens3
#RESTORE_TYPE=snapshot/snapshot-archive/statesync
RESTORE_TYPE: "statesync"
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
COSMOVISOR_VERSION: "v1.5.0"
CHAIN_ID: "athens_7001-1"
COSMOVISOR_CHECKSUM: "626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc"
VISOR_NAME: "cosmovisor"
DAEMON_NAME: "zetacored"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
Expand Down
27 changes: 5 additions & 22 deletions contrib/docker-scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function download_configs {

function setup_restore_type {
if [ "${RESTORE_TYPE}" == "statesync" ]; then
logt "Statesync restore. Download state sync rpc address from network-config."
logt "Statesync restore. Download state sync rpc address from network-config"
if [ "${NETWORK}" == "mainnet" ]; then
logt "MAINNET STATE SYNC"
logt "STATE_SYNC_RPC_NODE_FILE_MAINNET: ${STATE_SYNC_RPC_NODE_FILE_MAINNET}"
Expand Down Expand Up @@ -77,7 +77,7 @@ function setup_restore_type {
logt " Cleanup Snapshot"
rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME}
elif [ "${NETWORK}" == "athens3" ]; then
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-snapshot?network=athens3 | jq .latest_snapshot)
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-snapshot?network=athens3 | jq -r .latest_snapshot)
SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}")
SNAPSHOT_DIR=$(pwd)
logt "Download Snapshot from url: ${SNAPSHOT_URL}"
Expand All @@ -91,7 +91,7 @@ function setup_restore_type {
elif [ "${RESTORE_TYPE}" == "snapshot-archive" ]; then
if [ "${NETWORK}" == "mainnet" ]; then
logt "Get Latest Snapshot URL"
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=mainnet | jq .latest_snapshot)
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=mainnet | jq -r .latest_snapshot)
SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}")
SNAPSHOT_DIR=$(pwd)
logt "Download Snapshot from url: ${SNAPSHOT_URL}"
Expand All @@ -102,7 +102,7 @@ function setup_restore_type {
logt " Cleanup Snapshot"
rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME}
elif [ "${NETWORK}" == "athens3" ]; then
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=athens3 | jq .latest_snapshot)
SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=athens3 | jq -r .latest_snapshot)
SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}")
SNAPSHOT_DIR=$(pwd)
logt "Download Snapshot from url: ${SNAPSHOT_URL}"
Expand Down Expand Up @@ -148,6 +148,7 @@ function change_config_values {
logt "EXTERNAL_IP: ${EXTERNAL_IP}"
logt "SED Change Config Files."
sed -i -e "s/^enable = .*/enable = \"true\"/" ${DAEMON_HOME}/config/config.toml
sed '/^\[statesync\]/,/^\[/ s/enable = "true"/enable = "false"/' ${DAEMON_HOME}/config/config.toml
sed -i -e "s/^moniker = .*/moniker = \"${MONIKER}\"/" ${DAEMON_HOME}/config/config.toml
sed -i -e "s/^external_address = .*/external_address = \"${EXTERNAL_IP}:26656\"/" ${DAEMON_HOME}/config/config.toml
fi
Expand All @@ -162,18 +163,6 @@ function setup_basic_keyring {
fi
}

function install_dependencies {
apt-get update
apt-get install nano jq python3 -y
pip3 install requests
}

function download_cosmovisor {
mkdir -p ${DAEMON_HOME}/cosmovisor/
mkdir -p ${DAEMON_HOME}/cosmovisor/upgrades/
python3 /scripts/install_cosmovisor.py
}

function download_binary_version {
if [ "${NETWORK}" == "mainnet" ]; then
wget -q ${BINARY_LIST_MAINNET}
Expand Down Expand Up @@ -268,9 +257,6 @@ if [[ -f "${DAEMON_HOME}/start_sequence_status" ]] && grep -q "START_SEQUENCE_CO
logt "Modify Chain Configs"
change_config_values

logt "Download Cosmosvisor."
download_cosmovisor

logt "Move Zetacored Binaries."
move_zetacored_binaries

Expand All @@ -293,9 +279,6 @@ else
logt "Download Configs"
download_configs

logt "Download Cosmovisor"
download_cosmovisor

logt "Download Historical Binaries"
download_binary_version

Expand Down
4 changes: 1 addition & 3 deletions contrib/mainnet/zetacored/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ services:
DAEMON_HOME: "/root/.zetacored"
NETWORK: mainnet
#RESTORE_TYPE=snapshot/snapshot-archive/statesync
RESTORE_TYPE: "statesync"
RESTORE_TYPE: "snapshot"
SNAPSHOT_API: https://snapshots.zetachain.com
TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000
COSMOVISOR_VERSION: "v1.5.0"
CHAIN_ID: "zetachain_7000-1"
COSMOVISOR_CHECKSUM: "626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc"
VISOR_NAME: "cosmovisor"
DAEMON_NAME: "zetacored"
DAEMON_ALLOW_DOWNLOAD_BINARIES: "false"
Expand Down

0 comments on commit 34c586b

Please sign in to comment.