From 5e0a957dbf4778fd6cef57600940b22fffd7d142 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 2 Jan 2025 14:18:28 -0800 Subject: [PATCH] chore: remove main Dockerfile --- .../build-docker-images-generic/action.yml | 71 ---- .../actions/build-docker-images/action.yml | 54 --- .github/workflows/docker-build-and-push.yml | 86 ----- Dockerfile | 66 ---- Makefile | 43 --- contrib/docker-scripts/download_binaries.py | 58 --- contrib/docker-scripts/install_cosmovisor.py | 69 ---- contrib/docker-scripts/start.sh | 335 ------------------ contrib/rpc/zetacored/docker-compose.yml | 36 -- contrib/rpc/zetacored/init_docker_compose.sh | 65 ---- contrib/rpc/zetacored/kill_docker_compose.sh | 14 - contrib/rpc/zetacored/networks/.athens3 | 14 - .../zetacored/networks/.athens3-localbuild | 14 - contrib/rpc/zetacored/networks/.mainnet | 14 - .../zetacored/networks/.mainnet-localbuild | 14 - 15 files changed, 953 deletions(-) delete mode 100644 .github/actions/build-docker-images-generic/action.yml delete mode 100644 .github/actions/build-docker-images/action.yml delete mode 100644 .github/workflows/docker-build-and-push.yml delete mode 100644 Dockerfile delete mode 100644 contrib/docker-scripts/download_binaries.py delete mode 100644 contrib/docker-scripts/install_cosmovisor.py delete mode 100644 contrib/docker-scripts/start.sh delete mode 100644 contrib/rpc/zetacored/docker-compose.yml delete mode 100644 contrib/rpc/zetacored/init_docker_compose.sh delete mode 100644 contrib/rpc/zetacored/kill_docker_compose.sh delete mode 100644 contrib/rpc/zetacored/networks/.athens3 delete mode 100644 contrib/rpc/zetacored/networks/.athens3-localbuild delete mode 100644 contrib/rpc/zetacored/networks/.mainnet delete mode 100644 contrib/rpc/zetacored/networks/.mainnet-localbuild diff --git a/.github/actions/build-docker-images-generic/action.yml b/.github/actions/build-docker-images-generic/action.yml deleted file mode 100644 index 245ac8a631..0000000000 --- a/.github/actions/build-docker-images-generic/action.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: 'Build Docker Images' -description: 'Builds Docker images and pushes them to any repository.' -inputs: - DOCKER_FILENAME: - description: 'Name of the docker file to use for the build' - required: true - REPOSITORY_NAME: - description: 'Name of the Repository' - required: true - IMAGE_TAG: - description: 'Image Tag' - required: true - REGISTRY: - description: 'Docker or ORG you want to push to.' - required: true - DOCKER_ORG: - description: 'Docker ORG you want to push to.' - required: false - USERNAME: - description: 'Username for GitHub Container Registry' - required: true - TOKEN: - description: 'Token for GitHub Container Registry' - required: true - DOCKER_FILE_DIRECTORY: - description: 'Directory for your Dockerfile' - required: true - DOCKER_BUILD_KIT: - description: "whether or not to use docker build kit." - required: true - TAG_LATEST: - description: "should the pipeline tag latest" - required: true -runs: - using: "composite" - - steps: - - name: Set Environment Variables" - run: | - echo "DOCKER_BUILDKIT=${{ inputs.DOCKER_BUILD_KIT }}" >> $GITHUB_ENV - shell: bash - - - name: Log in to the Docker Registry - uses: docker/login-action@v2 - with: - registry: ${{ inputs.REGISTRY }} - username: ${{ inputs.USERNAME }} - password: ${{ inputs.TOKEN }} - - - name: Build, tag, and push images - shell: bash - working-directory: ${{ inputs.DOCKER_FILE_DIRECTORY }} - run: | - if [ ! -z "${{ inputs.DOCKER_ORG }}" ]; then - echo "DOCKER ORG SPECIFIED SO USE DOCKER HUB" - docker build -f ${{ inputs.DOCKER_FILENAME }} -t ${{ inputs.DOCKER_ORG }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} . - docker push ${{ inputs.DOCKER_ORG }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} - - if [ "${{ inputs.TAG_LATEST }}" == "true" ]; then - docker tag ${{ inputs.DOCKER_ORG }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} ${{ inputs.DOCKER_ORG }}/${{ inputs.REPOSITORY_NAME }}:latest - docker push ${{ inputs.DOCKER_ORG }}/${{ inputs.REPOSITORY_NAME }}:latest - fi - else - echo "DOCKER REGISTRY SPECIFIED WITH NO DOCKER_ORG USE NON ORG REGISTRIES" - docker build -f ${{ inputs.DOCKER_FILENAME }} -t ${{ inputs.REGISTRY }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} . - docker push ${{ inputs.REGISTRY }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} - if [ "${{ inputs.TAG_LATEST }}" == "true" ]; then - docker tag ${{ inputs.REGISTRY }}/${{ inputs.REPOSITORY_NAME }}:${{ inputs.IMAGE_TAG }} ${{ inputs.REGISTRY }}/${{ inputs.REPOSITORY_NAME }}:latest - docker push ${{ inputs.REGISTRY }}/${{ inputs.REPOSITORY_NAME }}:latest - fi - fi diff --git a/.github/actions/build-docker-images/action.yml b/.github/actions/build-docker-images/action.yml deleted file mode 100644 index b68efe7cbb..0000000000 --- a/.github/actions/build-docker-images/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: 'Build Docker Images' -description: 'Builds Docker images and pushes them to ECR and GHCR' -inputs: - DOCKER_FILENAME: - description: 'Name of the docker file to use for the build' - required: true - REPOSITORY_NAME: - description: 'Name of the Repository' - required: true - IMAGE_TAG: - description: 'Image Tag' - required: true - GHCR_USERNAME: - description: 'Username for GitHub Container Registry' - required: true - GHCR_TOKEN: - description: 'Token for GitHub Container Registry' - required: true - -runs: - using: "composite" - - steps: - - name: Set Environment Variables" - run: | - echo "DOCKER_FILENAME=${{ inputs.DOCKER_FILENAME }}" >> $GITHUB_ENV - echo "REPOSITORY_NAME=${{ inputs.REPOSITORY_NAME }}" >> $GITHUB_ENV - echo "IMAGE_TAG=${{ inputs.IMAGE_TAG }}" >> $GITHUB_ENV - echo "GHCR_USERNAME=${{ inputs.GHCR_USERNAME }}" >> $GITHUB_ENV - echo "GHCR_TOKEN=${{ inputs.GHCR_TOKEN }}" >> $GITHUB_ENV - echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV - shell: bash - - - name: Log in to the GitHub Container Registry - id: login-ghcr - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ env.GHCR_USERNAME }} - password: ${{ env.GHCR_TOKEN }} - - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - - name: Build, tag, and push images - shell: bash - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - GHCR_REGISTRY: ghcr.io/zeta-chain - run: | - docker build -f $DOCKER_FILENAME -t $ECR_REGISTRY/$REPOSITORY_NAME:$IMAGE_TAG -t $GHCR_REGISTRY/$REPOSITORY_NAME:$IMAGE_TAG . - # docker push $ECR_REGISTRY/$REPOSITORY_NAME:$IMAGE_TAG - docker push $GHCR_REGISTRY/$REPOSITORY_NAME:$IMAGE_TAG \ No newline at end of file diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml deleted file mode 100644 index c2def3200d..0000000000 --- a/.github/workflows/docker-build-and-push.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Zetacored-Docker-Build - -on: - release: - types: - - created - workflow_dispatch: - inputs: - version: - description: 'Docker Tag Version For Manual Execution' - required: false - default: '' - -concurrency: - group: Zetacored-Docker-Build - cancel-in-progress: false - -env: - DOCKER_REPO: "zetacored" - DOCKER_ORG: "zetachain" - DOCKER_REGISTRY: "https://index.docker.io/v1/" - -jobs: - docker_build_ubuntu: - runs-on: ubuntu-22.04 - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set Version from the release title. - if: github.event_name == 'workflow_dispatch' - run: | - echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV - - - name: Set Version for Hotfix Release from Input. - if: github.event_name == 'workflow_dispatch' - run: | - echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.inputs.version }}" >> ${GITHUB_ENV} - - - name: "BUILD:PUSH:MONITORING:DOCKER:IMAGE" - uses: ./.github/actions/build-docker-images-generic - with: - DOCKER_FILENAME: "Dockerfile" - REPOSITORY_NAME: "${{ env.DOCKER_REPO }}" - IMAGE_TAG: "ubuntu-${{ env.GITHUB_TAG_MAJOR_VERSION }}" - REGISTRY: "${{ env.DOCKER_REGISTRY }}" - DOCKER_ORG: "${{ env.DOCKER_ORG }}" - USERNAME: "${{ secrets.DOCKER_HUB_USERNAME }}" - TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" - DOCKER_FILE_DIRECTORY: "./" - DOCKER_BUILD_KIT: "0" - TAG_LATEST: "true" - - docker_build_arm: - runs-on: buildjet-4vcpu-ubuntu-2204-arm - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set Version from the release title. - if: github.event_name == 'workflow_dispatch' - run: | - echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV - - - name: Set Version for Hotfix Release from Input. - if: github.event_name == 'workflow_dispatch' - run: | - echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.inputs.version }}" >> ${GITHUB_ENV} - - - name: "BUILD:PUSH:MONITORING:DOCKER:IMAGE" - uses: ./.github/actions/build-docker-images-generic - with: - DOCKER_FILENAME: "Dockerfile" - REPOSITORY_NAME: "${{ env.DOCKER_REPO }}" - IMAGE_TAG: "arm-${{ env.GITHUB_TAG_MAJOR_VERSION }}" - REGISTRY: "${{ env.DOCKER_REGISTRY }}" - DOCKER_ORG: "${{ env.DOCKER_ORG }}" - USERNAME: "${{ secrets.DOCKER_HUB_USERNAME }}" - TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" - DOCKER_FILE_DIRECTORY: "./" - DOCKER_BUILD_KIT: "0" - TAG_LATEST: "false" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 0f9804d087..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -# Build Stage -FROM golang:1.22-alpine3.18 AS builder - -ENV GOPATH /go -ENV GOOS=linux -ENV CGO_ENABLED=1 - -# Install build dependencies -RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl python3 py3-pip - -# Set the working directory -WORKDIR /go/delivery/zeta-node - -# Copy module files and download dependencies -COPY go.mod . -COPY go.sum . - -RUN go mod download - -# Copy the rest of the source code and build the application -COPY . . - -RUN expected_major_version=$(grep 'const releaseVersion = ' app/setup_handlers.go | awk -F'"' '{print $2}') && \ - make install VERSION="${expected_major_version}" && \ - git_hash=$(git rev-parse --short HEAD) && \ - echo -n "${expected_major_version}-${git_hash}" > /go/delivery/zeta-node/expected_major_version - -# 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 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 && \ - 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 -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 - -# Set the default shell -ENV SHELL /bin/bash - -EXPOSE 26656 -EXPOSE 1317 -EXPOSE 8545 -EXPOSE 8546 -EXPOSE 9090 -EXPOSE 26657 -EXPOSE 9091 \ No newline at end of file diff --git a/Makefile b/Makefile index 1ecd3bc599..344ae150e4 100644 --- a/Makefile +++ b/Makefile @@ -482,49 +482,6 @@ stop-eth-node-mainnet: clean-eth-node-mainnet: cd contrib/rpc/ethereum && DOCKER_TAG=$(DOCKER_TAG) docker-compose down -v -#ZETA - -#FULL-NODE-RPC-FROM-BUILT-IMAGE -start-zetacored-rpc-mainnet: - cd contrib/rpc/zetacored && bash init_docker_compose.sh mainnet image $(DOCKER_TAG) - -stop-zetacored-rpc-mainnet: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet false - -clean-zetacored-rpc-mainnet: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet true - -#FULL-NODE-RPC-FROM-BUILT-IMAGE -start-zetacored-rpc-testnet: - cd contrib/rpc/zetacored && bash init_docker_compose.sh athens3 image $(DOCKER_TAG) - -stop-zetacored-rpc-testnet: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 false - -clean-zetacored-rpc-testnet: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 true - -#FULL-NODE-RPC-FROM-LOCAL-BUILD -start-zetacored-rpc-mainnet-localbuild: - cd contrib/rpc/zetacored && bash init_docker_compose.sh mainnet localbuild $(DOCKER_TAG) - -stop-zetacored-rpc-mainnet-localbuild: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet false - -clean-zetacored-rpc-mainnet-localbuild: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh mainnet true - -#FULL-NODE-RPC-FROM-LOCAL-BUILD -start-zetacored-rpc-testnet-localbuild: - cd contrib/rpc/zetacored && bash init_docker_compose.sh athens3 localbuild $(DOCKER_TAG) - -stop-zetacored-rpc-testnet-localbuild: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 false - -clean-zetacored-rpc-testnet-localbuild: - cd contrib/rpc/zetacored && bash kill_docker_compose.sh athens3 true - - ############################################################################### ### Debug Tools ### ############################################################################### diff --git a/contrib/docker-scripts/download_binaries.py b/contrib/docker-scripts/download_binaries.py deleted file mode 100644 index 99063a40f0..0000000000 --- a/contrib/docker-scripts/download_binaries.py +++ /dev/null @@ -1,58 +0,0 @@ -import requests -import os -import json -import logging -import sys - -# Logger class for easier logging setup -class Logger: - def __init__(self): - self.log = logging.getLogger() - self.log.setLevel(logging.INFO) - self.handler = logging.StreamHandler(sys.stdout) - self.handler.setLevel(logging.DEBUG) - self.formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') - self.handler.setFormatter(self.formatter) - self.log.addHandler(self.handler) - - -# Initialize logger instance -logger = Logger() - -# Parse JSON from an environment variable to get binary download information -info = json.loads(os.environ["DOWNLOAD_BINARIES"]) - -try: - # Iterate over binaries to download - for binary in info["binaries"]: - download_link = binary["download_url"] - binary_location = f'{os.environ["DAEMON_HOME"]}/{binary["binary_location"]}' - binary_directory = os.path.dirname(binary_location) - # Log download link - logger.log.info(f"DOWNLOAD LINK: {download_link}") - split_download_link = download_link.split("/") - # Log split download link parts - logger.log.info(f"SPLIT DOWNLOAD LINK: {split_download_link}") - # Extract binary name and version from the download link - binary_name = download_link.split("/")[8] - # Check if binary already exists - logger.log.info(f"CHECKING / DOWNLOADING {binary_location}") - - if os.path.exists(binary_location): - # If binary exists, log and do nothing - logger.log.info(f"BINARY EXISTS ALREADY: {binary_location}") - else: - # If binary doesn't exist, download and save it - logger.log.info("BINARY DOES NOT EXIST.") - os.makedirs(binary_directory, exist_ok=True) - response = requests.get(download_link) - if response.status_code == 200: - with open(binary_location, "wb") as f: - f.write(response.content) - os.chmod(binary_location, 0o755) - logger.log.info("BINARY DOWNLOADED SUCCESSFULLY.") - else: - logger.log.info("FAILED TO DOWNLOAD BINARY. Status code:", response.status_code) - logger.log.info("BINARIES DOWNLOAD FINISHED...") -except Exception as e: - logger.log.error(str(e)) diff --git a/contrib/docker-scripts/install_cosmovisor.py b/contrib/docker-scripts/install_cosmovisor.py deleted file mode 100644 index 568c9bbe8e..0000000000 --- a/contrib/docker-scripts/install_cosmovisor.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python3 -import hashlib -import logging -import os -import requests -import sys - -# Constants defining the binary name, version, expected checksum, download URL, and installation path -BINARY_NAME = "cosmovisor" -BINARY_VERSION = os.getenv("COSMOVISOR_VERSION") # Get the cosmovisor version from environment variable -EXPECTED_CHECKSUM = os.getenv("COSMOVISOR_CHECKSUM") # Get the expected checksum from environment variable -BINARY_URL = f"https://binary-pickup.zetachain.com/cosmovisor-{BINARY_VERSION}-linux-amd64" # Construct the binary download URL -INSTALL_PATH = f"/usr/local/bin/{BINARY_NAME}" # Define the installation path for the binary - -# Check if necessary environment variables are set; exit if not -if not BINARY_VERSION or not EXPECTED_CHECKSUM: - logging.error("Environment variables COSMOVISOR_VERSION and COSMOVISOR_CHECKSUM must be set.") - sys.exit(1) - -# Configure logging to both stdout and a file -logging.basicConfig( - level=logging.INFO, # Set logging level to INFO - format="%(levelname)s: %(message)s", # Define log message format - handlers=[ - logging.StreamHandler(sys.stdout), # Log to stdout - logging.FileHandler("/var/log/update_cosmovisor.log") # Log to a file - ] -) - - -# Function to calculate the SHA-256 checksum of the downloaded binary -def calculate_checksum(file_path): - sha256 = hashlib.sha256() # Create a new SHA-256 hash object - with open(file_path, "rb") as f: # Open the binary file in binary read mode - for byte_block in iter(lambda: f.read(4096), - b""): # Read the file in chunks to avoid loading it all into memory - sha256.update(byte_block) # Update the hash object with the chunk - return sha256.hexdigest() # Return the hexadecimal digest of the hash object - - -# Function to download the binary and update it if the checksum matches -def download_and_update_binary(): - try: - response = requests.get(BINARY_URL) # Attempt to download the binary - response.raise_for_status() # Check if the download was successful, raises exception on failure - logging.info("Binary downloaded successfully.") - except requests.exceptions.RequestException as e: - logging.error(f"Failed to download the binary: {e}") # Log any error during download - sys.exit(1) # Exit the script on download failure - - with open(INSTALL_PATH, "wb") as f: # Open the installation path file in binary write mode - f.write(response.content) # Write the downloaded binary content to the file - - actual_checksum = calculate_checksum(INSTALL_PATH) # Calculate the checksum of the downloaded binary - if actual_checksum == EXPECTED_CHECKSUM: # Compare the actual checksum with the expected checksum - logging.info("Cosmovisor binary checksum verified.") # Log success if checksums match - os.chmod(INSTALL_PATH, 0o755) # Make the binary executable - logging.info("Cosmovisor binary updated successfully.") - else: - logging.error( - "Checksums do not match. Possible corrupted download. Deleting the downloaded binary.") # Log failure if checksums do not match - os.remove(INSTALL_PATH) # Remove the potentially corrupted binary - sys.exit(1) # Exit the script due to checksum mismatch - - -# Main script execution starts here -logging.info( - f"Downloading the {BINARY_NAME} binary (version {BINARY_VERSION})...") # Log the start of the download process -download_and_update_binary() # Call the function to download and update the binary diff --git a/contrib/docker-scripts/start.sh b/contrib/docker-scripts/start.sh deleted file mode 100644 index bb151a49fe..0000000000 --- a/contrib/docker-scripts/start.sh +++ /dev/null @@ -1,335 +0,0 @@ -#!/bin/bash - -logt() { - echo "$(date '+%Y-%m-%d %H:%M:%S') $1" -} - - -function load_defaults { - #DEFAULT: Mainnet Statesync. - export DAEMON_HOME=${DAEMON_HOME:=/root/.zetacored} - export NETWORK=${NETWORK:=mainnet} - export RESTORE_TYPE=${RESTORE_TYPE:=statesync} - export SNAPSHOT_API=${SNAPSHOT_API:=https://snapshots.rpc.zetachain.com} - export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:=40000} - export COSMOVISOR_VERSION=${COSMOVISOR_VERSION:=v1.5.0} - export CHAIN_ID=${CHAIN_ID:=zetachain_7000-1} - export COSMOVISOR_CHECKSUM=${COSMOVISOR_CHECKSUM:=626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc} - export VISOR_NAME=${VISOR_NAME:=cosmovisor} - export DAEMON_NAME=${DAEMON_NAME:=zetacored} - export DAEMON_ALLOW_DOWNLOAD_BINARIES=${DAEMON_ALLOW_DOWNLOAD_BINARIES:=false} - export DAEMON_RESTART_AFTER_UPGRADE=${DAEMON_RESTART_AFTER_UPGRADE:=true} - export UNSAFE_SKIP_BACKUP=${UNSAFE_SKIP_BACKUP:=true} - export CLIENT_DAEMON_NAME=${CLIENT_DAEMON_NAME:=zetaclientd} - export CLIENT_DAEMON_ARGS=${CLIENT_DAEMON_ARGS:""} - export CLIENT_SKIP_UPGRADE=${CLIENT_SKIP_UPGRADE:=true} - export CLIENT_START_PROCESS=${CLIENT_START_PROCESS:=false} - export MONIKER=${MONIKER:=local-test} - export RE_DO_START_SEQUENCE=${RE_DO_START_SEQUENCE:=false} - - #ATHENS3 - export BINARY_LIST_ATHENS3=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/binary_list.json} - export STATE_SYNC_RPC_NODE_FILE_ATHENS3=${STATE_SYNC_RPC_NODE_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/state_sync_node} - export RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3=${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/rpc_state_sync_nodes} - export APP_TOML_FILE_ATHENS3=${APP_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/app.toml} - export CONFIG_TOML_FILE_ATHENS3=${CONFIG_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/config.toml} - export CLIENT_TOML_FILE_ATHENS3=${CLIENT_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/client.toml} - export GENESIS_FILE_ATHENS3=${GENESIS_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/genesis.json} - - #MAINNET - export BINARY_LIST_MAINNET=${BINARY_LIST_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/binary_list.json} - export STATE_SYNC_RPC_NODE_FILE_MAINNET=${STATE_SYNC_RPC_NODE_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/state_sync_node} - export RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET=${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/rpc_state_sync_nodes} - export APP_TOML_FILE_MAINNET=${APP_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml} - export CONFIG_TOML_FILE_MAINNET=${CONFIG_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml} - export CLIENT_TOML_FILE_MAINNET=${CLIENT_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml} - export GENESIS_FILE_MAINNET=${GENESIS_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json} - -} - -function init_chain { - if [ -d "${DAEMON_HOME}/config" ]; then - logt "${DAEMON_NAME} home directory already initialized." - else - logt "${DAEMON_NAME} home directory not initialized." - logt "MONIKER: ${MONIKER}" - logt "DAEMON_HOME: ${DAEMON_HOME}" - ${DAEMON_NAME} init ${MONIKER} --home ${DAEMON_HOME} --chain-id ${CHAIN_ID} - fi -} - -function download_configs { - if [ "${NETWORK}" == "mainnet" ]; then - wget -q ${APP_TOML_FILE_MAINNET} -O ${DAEMON_HOME}/config/app.toml - wget -q ${CONFIG_TOML_FILE_MAINNET} -O ${DAEMON_HOME}/config/config.toml - wget -q ${CLIENT_TOML_FILE_MAINNET} -O ${DAEMON_HOME}/config/client.toml - wget -q ${GENESIS_FILE_MAINNET} -O ${DAEMON_HOME}/config/genesis.json - wget -q ${BINARY_LIST_MAINNET} - export DOWNLOAD_BINARIES=$(cat binary_list.json | tr -d '\n') - rm -rf binary_list.json - logt "BINARY_LIST: ${DOWNLOAD_BINARIES}" - elif [ "${NETWORK}" == "athens3" ]; then - wget -q ${APP_TOML_FILE_ATHENS3} -O ${DAEMON_HOME}/config/app.toml - wget -q ${CONFIG_TOML_FILE_ATHENS3} -O ${DAEMON_HOME}/config/config.toml - wget -q ${CLIENT_TOML_FILE_ATHENS3} -O ${DAEMON_HOME}/config/client.toml - wget -q ${GENESIS_FILE_ATHENS3} -O ${DAEMON_HOME}/config/genesis.json - wget -q ${BINARY_LIST_ATHENS3} - export DOWNLOAD_BINARIES=$(cat binary_list.json | tr -d '\n') - rm -rf binary_list.json - logt "BINARY_LIST: ${DOWNLOAD_BINARIES}" - else - logt "Initialize for Localnet." - fi -} - -function setup_restore_type { - if [ "${RESTORE_TYPE}" == "statesync" ]; then - 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}" - logt "RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET: ${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET}" - wget -q ${STATE_SYNC_RPC_NODE_FILE_MAINNET} - wget -q ${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET} - export STATE_SYNC_SERVER=$(cat state_sync_node) - export RPC_STATE_SYNC_SERVERS=$(cat rpc_state_sync_nodes) - rm -rf state_sync_node - rm -rf rpc_state_sync_nodes - elif [ "${NETWORK}" == "athens3" ]; then - logt "ATHENS STATE SYNC" - logt "STATE_SYNC_RPC_NODE_FILE_MAINNET: ${STATE_SYNC_RPC_NODE_FILE_ATHENS3}" - logt "RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET: ${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3}" - wget -q ${STATE_SYNC_RPC_NODE_FILE_ATHENS3} - wget -q ${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3} - export STATE_SYNC_SERVER=$(cat state_sync_node) - export RPC_STATE_SYNC_SERVERS=$(cat rpc_state_sync_nodes) - rm -rf state_sync_node - rm -rf rpc_state_sync_nodes - fi - elif [ "${RESTORE_TYPE}" == "snapshot" ]; then - if [ "${NETWORK}" == "mainnet" ]; then - logt "Get Latest Snapshot URL" - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/mainnet/fullnode/latest.json | jq -r '.snapshots[0].link') - SNAPSHOT_FILENAME=$(curl -s ${SNAPSHOT_API}/mainnet/fullnode/latest.json | jq -r '.snapshots[0].filename') - SNAPSHOT_DIR=$(pwd) - logt "Download Snapshot from url: ${SNAPSHOT_URL}" - curl -o "${SNAPSHOT_FILENAME}" "${SNAPSHOT_URL}" - logt "Change to: ${DAEMON_HOME} and extract snapshot." - cd ${DAEMON_HOME} - tar xvf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - logt " Cleanup Snapshot" - rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - elif [ "${NETWORK}" == "athens3" ]; then - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/testnet/fullnode/latest.json | jq -r '.snapshots[0].link') - SNAPSHOT_FILENAME=$(curl -s ${SNAPSHOT_API}/testnet/fullnode/latest.json | jq -r '.snapshots[0].filename') - SNAPSHOT_DIR=$(pwd) - logt "Download Snapshot from url: ${SNAPSHOT_URL}" - curl -o "${SNAPSHOT_FILENAME}" "${SNAPSHOT_URL}" - logt "Change to: ${DAEMON_HOME} and extract snapshot." - cd ${DAEMON_HOME} - tar xvf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - logt " Cleanup Snapshot" - rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - fi - elif [ "${RESTORE_TYPE}" == "snapshot-archive" ]; then - if [ "${NETWORK}" == "mainnet" ]; then - logt "Get Latest Snapshot URL" - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/mainnet/archive/latest.json | jq -r '.snapshots[0].link') - SNAPSHOT_FILENAME=$(curl -s ${SNAPSHOT_API}/mainnet/archive/latest.json | jq -r '.snapshots[0].filename') - SNAPSHOT_DIR=$(pwd) - logt "Download Snapshot from url: ${SNAPSHOT_URL}" - curl -o "${SNAPSHOT_FILENAME}" "${SNAPSHOT_URL}" - logt "Change to: ${DAEMON_HOME} and extract snapshot." - cd ${DAEMON_HOME} - tar xvf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - logt " Cleanup Snapshot" - rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - elif [ "${NETWORK}" == "athens3" ]; then - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/testnet/archive/latest.json | jq -r '.snapshots[0].link') - SNAPSHOT_FILENAME=$(curl -s ${SNAPSHOT_API}/testnet/archive/latest.json | jq -r '.snapshots[0].filename') - SNAPSHOT_DIR=$(pwd) - logt "Download Snapshot from url: ${SNAPSHOT_URL}" - curl -o "${SNAPSHOT_FILENAME}" "${SNAPSHOT_URL}" - logt "Change to: ${DAEMON_HOME} and extract snapshot." - cd ${DAEMON_HOME} - tar xvf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - logt " Cleanup Snapshot" - rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} - fi - else - logt "Initialize for Localnet." - fi -} - -function change_config_values { - if [ "${RESTORE_TYPE}" == "statesync" ]; then - export STATE_SYNC_SERVER="${STATE_SYNC_SERVER}" - export TRUST_HEIGHT=$(curl -s ${STATE_SYNC_SERVER}/block | jq -r '.result.block.header.height') - export HEIGHT=$((TRUST_HEIGHT-${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC})) - export TRUST_HASH=$(curl -s "${STATE_SYNC_SERVER}/block?height=${HEIGHT}" | jq -r '.result.block_id.hash') - export RPC_STATE_SYNC_SERVERS="${RPC_STATE_SYNC_SERVERS}" - export EXTERNAL_IP=$(curl -4 icanhazip.com) - - logt "******* DEBUG STATE SYNC VALUES *******" - logt "STATE_SYNC_SERVER: ${STATE_SYNC_SERVER}" - logt "RPC_STATE_SYNC_SERVERS: ${RPC_STATE_SYNC_SERVERS}" - logt "TRUST_HEIGHT: ${TRUST_HEIGHT}" - logt "TRUST_HASH: ${TRUST_HASH}" - logt "HEIGHT: ${HEIGHT}" - logt "EXTERNAL_IP: ${EXTERNAL_IP}" - - logt "SED Change Config Files." - sed -i -e "s/^enable = .*/enable = \"true\"/" ${DAEMON_HOME}/config/config.toml - sed -i -e "s/^rpc_servers = .*/rpc_servers = \"${RPC_STATE_SYNC_SERVERS}\"/" ${DAEMON_HOME}/config/config.toml - sed -i -e "s/^trust_height = .*/trust_height = \"${HEIGHT}\"/" ${DAEMON_HOME}/config/config.toml - sed -i -e "s/^trust_hash = .*/trust_hash = \"${TRUST_HASH}\"/" ${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 - else - export EXTERNAL_IP=$(curl -4 icanhazip.com) - logt "******* DEBUG STATE SYNC 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 -} - -function setup_basic_keyring { - if ${DAEMON_NAME} keys show "$MONIKER" --keyring-backend test > /dev/null 2>&1; then - echo "Key $MONIKER already exists." - else - ${DAEMON_NAME} keys add "$MONIKER" --keyring-backend test - echo "Key $MONIKER created." - fi -} - -function download_binary_version { - if [ "${NETWORK}" == "mainnet" ]; then - wget -q ${BINARY_LIST_MAINNET} - export DOWNLOAD_BINARIES=$(cat binary_list.json | tr -d '\n') - rm -rf binary_list.json - logt "BINARY_LIST: ${DOWNLOAD_BINARIES}" - elif [ "${NETWORK}" == "athens3" ]; then - wget -q ${BINARY_LIST_ATHENS3} - export DOWNLOAD_BINARIES=$(cat binary_list.json | tr -d '\n') - rm -rf binary_list.json - logt "BINARY_LIST: ${DOWNLOAD_BINARIES}" - fi - python3 /scripts/download_binaries.py -} - -function move_zetacored_binaries { - mkdir -p ${DAEMON_HOME}/cosmovisor || logt "Directory already exists ${DAEMON_HOME}/cosmovisor" - mkdir -p ${DAEMON_HOME}/cosmovisor/genesis || logt "Directory already exists ${DAEMON_HOME}/cosmovisor/genesis" - mkdir -p ${DAEMON_HOME}/cosmovisor/genesis/bin || logt "Directory already exists ${DAEMON_HOME}/cosmovisor/genesis/bin" - cp /usr/local/bin/zetacored ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored - - if [ "${RESTORE_TYPE}" == "statesync" ]; then - logt "Its statesync so cosmosvisor won't know which binary to start from so make sure it starts from the latest version reported in ABCI_INFO from statesync server rpc." - export VERSION_CHECK=$(curl -s ${STATE_SYNC_SERVER}/abci_info | jq -r '.result.response.version') - logt "CURRENT VERSION_CHECK: ${VERSION_CHECK}" - cp ${DAEMON_HOME}/cosmovisor/upgrades/v${VERSION_CHECK}/bin/zetacored ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored - fi -} - -function start_network { - if [ "${IS_LOCAL_DEVELOPMENT}" == "true" ]; then - cp /usr/local/bin/zetacored ${DAEMON_HOME}/cosmovisor/genesis/bin/zetacored - find /root/.zetacored/cosmovisor/upgrades/ -type f -path "*/bin/zetacored" -exec cp /usr/local/bin/zetacored {} \; - fi - expected_major_version=$(cat /scripts/expected_major_version | cut -d '-' -f 1) - 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_VERSION_WITH_HASH: $(cat /scripts/expected_major_version | cut -d '-' -f 1)" - 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} \ - --rpc.laddr tcp://0.0.0.0:26657 \ - --minimum-gas-prices 1.0azeta "--grpc.enable=true" -} - -logt "Load Default Values for ENV Vars if not set." -load_defaults - -if [[ -f "${DAEMON_HOME}/start_sequence_status" ]] && grep -q "START_SEQUENCE_COMPLETE" "${DAEMON_HOME}/start_sequence_status" && [[ "$RE_DO_START_SEQUENCE" != "true" ]]; then - logt "The start sequence is complete and no redo is required." - - logt "Download Configs" - download_configs - - logt "Download Historical Binaries" - download_binary_version - - if [ "${RESTORE_TYPE}" == "statesync" ]; then - logt "Setup Restore Type: ${RESTORE_TYPE}" - logt "During restarts, we re-do this to ensure to update the configs with valid values. When you call change config the stuff that gets set in this function for statesync needs to be set. Doesn't effect to re-set this." - setup_restore_type - fi - - logt "Modify Chain Configs" - change_config_values - - logt "Move Zetacored Binaries." - move_zetacored_binaries - - logt "Start sequence has completed, echo into file so on restart it doesn't download snapshots again." - echo "START_SEQUENCE_COMPLETE" >> ${DAEMON_HOME}/start_sequence_status - - logt "Start Network" - start_network -else - logt "START_SEQUENCE_COMPLETE is not true, or RE_DO_START_SEQUENCE is set to true." - - if [[ "$RE_DO_START_SEQUENCE" == "true" ]]; then - logt "Clean any files that may exist in: ${DAEMON_HOME}" - rm -rf ${DAEMON_HOME}/* || logt "directory doesn't exist." - fi - - logt "Init Chain" - init_chain - - logt "Download Configs" - download_configs - - logt "Download Historical Binaries" - download_binary_version - - logt "Setup Restore Type: ${RESTORE_TYPE}" - setup_restore_type - - logt "Modify Chain Configs" - change_config_values - - logt "Move root binaries to current" - move_zetacored_binaries - - logt "Start sequence has completed, echo into file so on restart it doesn't download snapshots again." - echo "START_SEQUENCE_COMPLETE" >> ${DAEMON_HOME}/start_sequence_status - - logt "Start Network" - start_network -fi \ No newline at end of file diff --git a/contrib/rpc/zetacored/docker-compose.yml b/contrib/rpc/zetacored/docker-compose.yml deleted file mode 100644 index 50dbd0a731..0000000000 --- a/contrib/rpc/zetacored/docker-compose.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: '3.8' -services: - -=name=-: - platform: linux/amd64 - -=image_block=- - container_name: "zetachain_${NETWORK:-mainnet}_rpc" - environment: - DAEMON_HOME: "${DAEMON_HOME:-/root/.zetacored}" - NETWORK: ${NETWORK:-mainnet} - RESTORE_TYPE: "${RESTORE_TYPE:-snapshot}" - SNAPSHOT_API: ${SNAPSHOT_API:-https://snapshots.rpc.zetachain.com} - TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: ${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:-40000} - CHAIN_ID: "${CHAIN_ID:-zetachain_7000-1}" - VISOR_NAME: "${VISOR_NAME:-cosmovisor}" - DAEMON_NAME: "${DAEMON_NAME:-zetacored}" - DAEMON_ALLOW_DOWNLOAD_BINARIES: "${DAEMON_ALLOW_DOWNLOAD_BINARIES:-false}" - DAEMON_RESTART_AFTER_UPGRADE: "${DAEMON_RESTART_AFTER_UPGRADE:-true}" - UNSAFE_SKIP_BACKUP: "${UNSAFE_SKIP_BACKUP:-true}" - MONIKER: ${MONIKER:-mainnet-docker-rpc} - #If this is true it will erase everything and start over from scratch. - RE_DO_START_SEQUENCE: "${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: "${IS_LOCAL_DEVELOPMENT:-false}" - ports: - - "26656:26656" - - "1317:1317" - - "8545:8545" - - "8546:8546" - - "26657:26657" - - "9090:9090" - - "9091:9091" - volumes: - - -=name=-:/root/.zetacored/ - entrypoint: bash /scripts/start.sh -volumes: - -=name=-: diff --git a/contrib/rpc/zetacored/init_docker_compose.sh b/contrib/rpc/zetacored/init_docker_compose.sh deleted file mode 100644 index 04e9f6857c..0000000000 --- a/contrib/rpc/zetacored/init_docker_compose.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -NETWORK=${1} -TYPE=${2} -DOCKER_TAG=${3} - -if [ "$TYPE" == "image" ]; then - echo "Source Environment File." - SOURCE_FILE_NAME="networks/.${NETWORK}" - if [ ! -f "$SOURCE_FILE_NAME" ]; then - echo "Environment file $SOURCE_FILE_NAME does not exist." - exit 1 - fi - source ${SOURCE_FILE_NAME} -elif [ "$TYPE" == "localbuild" ]; then - echo "Source Environment File." - SOURCE_FILE_NAME="networks/.${NETWORK}-localbuild" - if [ ! -f "$SOURCE_FILE_NAME" ]; then - echo "Environment file $SOURCE_FILE_NAME does not exist." - exit 1 - fi - source ${SOURCE_FILE_NAME} -fi - -# Define the path to the Docker Compose file -FILE_PATH="${NETWORK}-docker-compose.yml" -cp docker-compose.yml ${FILE_PATH} - -# Determine the appropriate Docker Compose configuration based on TYPE -if [ "$TYPE" == "image" ]; then - IMAGE_BLOCK="image: zetachain/zetacored:\${DOCKER_TAG:-ubuntu-v14.0.1.0}" - NAME="zetacored-rpc-${NETWORK}" -elif [ "$TYPE" == "localbuild" ]; then - IMAGE_BLOCK=$(cat << 'EOF' -build: - context: ../../.. - dockerfile: Dockerfile -EOF -) - NAME="zetacored-rpc-${NETWORK}-localbuild" -else - echo "Invalid TYPE. Please specify 'image' or 'localbuild'." - exit 1 -fi - -IMAGE_BLOCK_ESCAPED=$(echo "$IMAGE_BLOCK" | sed 's/[&/]/\\&/g; s/$/\\/') -IMAGE_BLOCK_ESCAPED=${IMAGE_BLOCK_ESCAPED%?} - -# Replace placeholders in the Docker Compose file -sed -i '' "s|-=name=-|$NAME|g" $FILE_PATH -sed -i '' "s|-=image_block=-|$IMAGE_BLOCK_ESCAPED|g" $FILE_PATH - -echo "DEBUG ENV VARS" -printenv -echo "================" - -echo "Placeholders have been replaced in $FILE_PATH." -cat $FILE_PATH -echo "================" - -if [ "$TYPE" == "image" ]; then - docker-compose -f ${FILE_PATH} up -elif [ "$TYPE" == "localbuild" ]; then - docker-compose -f ${FILE_PATH} up --build -fi diff --git a/contrib/rpc/zetacored/kill_docker_compose.sh b/contrib/rpc/zetacored/kill_docker_compose.sh deleted file mode 100644 index 5d6a2c192d..0000000000 --- a/contrib/rpc/zetacored/kill_docker_compose.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -NETWORK=${1} -CLEAN=${2} -FILE_PATH="${NETWORK}-docker-compose.yml" - -if [ "${CLEAN}" == "true" ]; then - docker-compose -f ${FILE_PATH} down -v - rm -rf ${FILE_PATH} -else - docker-compose -f ${FILE_PATH} down - rm -rf ${FILE_PATH} -fi - diff --git a/contrib/rpc/zetacored/networks/.athens3 b/contrib/rpc/zetacored/networks/.athens3 deleted file mode 100644 index 7de4cede3b..0000000000 --- a/contrib/rpc/zetacored/networks/.athens3 +++ /dev/null @@ -1,14 +0,0 @@ -export DAEMON_HOME="/root/.zetacored" -export NETWORK=athens3 -export RESTORE_TYPE="snapshot" -export SNAPSHOT_API=https://snapshots.rpc.zetachain.com -export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=40000 -export CHAIN_ID="athens_7001-1" -export VISOR_NAME="cosmovisor" -export DAEMON_NAME="zetacored" -export DAEMON_ALLOW_DOWNLOAD_BINARIES="false" -export DAEMON_RESTART_AFTER_UPGRADE="true" -export UNSAFE_SKIP_BACKUP="true" -export MONIKER=testnet-docker-rpc -export RE_DO_START_SEQUENCE="false" -export IS_LOCAL_DEVELOPMENT="false" diff --git a/contrib/rpc/zetacored/networks/.athens3-localbuild b/contrib/rpc/zetacored/networks/.athens3-localbuild deleted file mode 100644 index b79c14c220..0000000000 --- a/contrib/rpc/zetacored/networks/.athens3-localbuild +++ /dev/null @@ -1,14 +0,0 @@ -export DAEMON_HOME="/root/.zetacored" -export NETWORK=athens3 -export RESTORE_TYPE="snapshot" -export SNAPSHOT_API=https://snapshots.rpc.zetachain.com -export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=40000 -export CHAIN_ID="athens_7001-1" -export VISOR_NAME="cosmovisor" -export DAEMON_NAME="zetacored" -export DAEMON_ALLOW_DOWNLOAD_BINARIES="false" -export DAEMON_RESTART_AFTER_UPGRADE="false" -export UNSAFE_SKIP_BACKUP="true" -export MONIKER=testnet-docker-rpc -export RE_DO_START_SEQUENCE="false" -export IS_LOCAL_DEVELOPMENT="true" diff --git a/contrib/rpc/zetacored/networks/.mainnet b/contrib/rpc/zetacored/networks/.mainnet deleted file mode 100644 index ff260bb5ca..0000000000 --- a/contrib/rpc/zetacored/networks/.mainnet +++ /dev/null @@ -1,14 +0,0 @@ -export DAEMON_HOME="/root/.zetacored" -export NETWORK=mainnet -export RESTORE_TYPE="snapshot" -export SNAPSHOT_API=https://snapshots.rpc.zetachain.com -export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=40000 -export CHAIN_ID="zetachain_7000-1" -export VISOR_NAME="cosmovisor" -export DAEMON_NAME="zetacored" -export DAEMON_ALLOW_DOWNLOAD_BINARIES="false" -export DAEMON_RESTART_AFTER_UPGRADE="true" -export UNSAFE_SKIP_BACKUP="true" -export MONIKER=mainnet-docker-rpc -export RE_DO_START_SEQUENCE="false" -export IS_LOCAL_DEVELOPMENT="false" diff --git a/contrib/rpc/zetacored/networks/.mainnet-localbuild b/contrib/rpc/zetacored/networks/.mainnet-localbuild deleted file mode 100644 index 381c34bd6d..0000000000 --- a/contrib/rpc/zetacored/networks/.mainnet-localbuild +++ /dev/null @@ -1,14 +0,0 @@ -export DAEMON_HOME="/root/.zetacored" -export NETWORK=mainnet -export RESTORE_TYPE="snapshot" -export SNAPSHOT_API=https://snapshots.rpc.zetachain.com -export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=40000 -export CHAIN_ID="zetachain_7000-1" -export VISOR_NAME="cosmovisor" -export DAEMON_NAME="zetacored" -export DAEMON_ALLOW_DOWNLOAD_BINARIES="false" -export DAEMON_RESTART_AFTER_UPGRADE="false" -export UNSAFE_SKIP_BACKUP="true" -export MONIKER=mainnet-docker-rpc -export RE_DO_START_SEQUENCE="false" -export IS_LOCAL_DEVELOPMENT="true"