From 8331eebcc00ddb42cf5e784eac3f525eefceebc0 Mon Sep 17 00:00:00 2001 From: illuminatus Date: Sat, 21 Oct 2023 14:06:42 -0700 Subject: [PATCH] FIXUP guild-deploy.sh --- scripts/cnode-helper-scripts/guild-deploy.sh | 43 +++++++++++--------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/scripts/cnode-helper-scripts/guild-deploy.sh b/scripts/cnode-helper-scripts/guild-deploy.sh index ce976f0d0..b7c8b5a26 100755 --- a/scripts/cnode-helper-scripts/guild-deploy.sh +++ b/scripts/cnode-helper-scripts/guild-deploy.sh @@ -3,6 +3,7 @@ # shellcheck source=/dev/null unset CNODE_HOME +unset MITHRIL_HOME ########################################## # User Variables - Change as desired # @@ -99,6 +100,7 @@ set_defaults() { [[ -z ${INSTALL_OGMIOS} ]] && INSTALL_OGMIOS='N' [[ -z ${INSTALL_CSIGNER} ]] && INSTALL_CSIGNER='N' [[ -z ${CNODE_PATH} ]] && CNODE_PATH="/opt/cardano" + [[ -z ${MITHRIL_PATH} ]] && MITHRIL_PATH="/opt/mithril" [[ -z ${CNODE_NAME} ]] && CNODE_NAME='cnode' [[ -z ${CURL_TIMEOUT} ]] && CURL_TIMEOUT=60 [[ -z ${UPDATE_CHECK} ]] && UPDATE_CHECK='Y' @@ -109,6 +111,7 @@ set_defaults() { [[ "${SUDO}" = 'Y' && $(id -u) -eq 0 ]] && err_exit "Please run as non-root user." CNODE_HOME="${CNODE_PATH}/${CNODE_NAME}" CNODE_VNAME=$(echo "$CNODE_NAME" | awk '{print toupper($0)}') + MITHRIL_HOME="${MITHRIL_PATH}/mithril-signer" REPO="https://github.com/${G_ACCOUNT}/guild-operators" REPO_RAW="https://raw.githubusercontent.com/${G_ACCOUNT}/guild-operators" URL_RAW="${REPO_RAW}/${BRANCH}" @@ -324,25 +327,6 @@ build_libsodium() { echo -e "\nIOG fork of libsodium installed to /usr/local/lib/" } -# Build mithril -download_mithril() { - echo -e "\nDownloading mithril binaries..." - pushd "${HOME}"/tmp >/dev/null || err_exit - # dynamic latest release updated automatically, uncomment and comment out the hardcoded release below if needed - # mithril_release="$(curl -s https://api.github.com/repos/input-output-hk/mithril/releases/latest | jq -r '.tag_name')" - # hardcoded latest release requiring a bump - mithril_release="2337.0" - echo -e "\n Downloading mithril ${mithril_release}..." - rm -f mithril-signer mithril-client - curl -m 200 -sfL https://github.com/input-output-hk/mithril/releases/download/${mithril_release}/mithril-${mithril_release}-linux-x64.tar.gz -o mithril.tar.gz || err_exit " Could not download mithril's latest release archive from IO github!" - tar zxf mithril.tar.gz mithril-signer mithril-client &>/dev/null - rm -f mithril.tar.gz - [[ -f mithril-signer ]] || err_exit " mithril archive downloaded but binary (mithril-signer) not found after extracting package!" - [[ -f mithril-client ]] || err_exit " mithril archive downloaded but binary (mithril-client) not found after extracting package!" - mv -t "${HOME}"/.local/bin mithril-signer mithril-client - chmod +x "${HOME}"/.local/bin/* -} - # Download cardano-node, cardano-cli, cardano-db-sync, bech32 and cardano-submit-api # TODO: Replace these with self-hosted ones (potentially consider IPFS as upload destination for CI) download_cnodebins() { @@ -510,6 +494,25 @@ download_cardanosigner() { fi } +# Download pre-built mithril-signer binary +download_mithril() { + echo -e "\nDownloading Mithril..." + pushd "${HOME}"/tmp >/dev/null || err_exit + # dynamic latest release updated automatically, uncomment and comment out the hardcoded release below if needed + # mithril_release="$(curl -s https://api.github.com/repos/input-output-hk/mithril/releases/latest | jq -r '.tag_name')" + # hardcoded latest release requiring a bump + mithril_release="2337.0" + echo -e "\n Downloading Mithril Signer/Client ${mithril_release}..." + rm -f mithril-signer mithril-client + curl -m 200 -sfL https://github.com/input-output-hk/mithril/releases/download/${mithril_release}/mithril-${mithril_release}-linux-x64.tar.gz -o mithril.tar.gz || err_exit " Could not download mithril's latest release archive from IO github!" + tar zxf mithril.tar.gz mithril-signer mithril-client &>/dev/null + rm -f mithril.tar.gz + [[ -f mithril-signer ]] || err_exit " mithril archive downloaded but binary (mithril-signer) not found after extracting package!" + [[ -f mithril-client ]] || err_exit " mithril archive downloaded but binary (mithril-client) not found after extracting package!" + mv -t "${HOME}"/.local/bin mithril-signer mithril-client + chmod +x "${HOME}"/.local/bin/* +} + # Create folder structure and set up permissions/ownerships setup_folder() { echo -e "\nCreating Folder Structure .." @@ -523,6 +526,8 @@ setup_folder() { $sudo mkdir -p "${CNODE_HOME}"/files "${CNODE_HOME}"/db "${CNODE_HOME}"/guild-db "${CNODE_HOME}"/logs "${CNODE_HOME}"/scripts "${CNODE_HOME}"/scripts/archive "${CNODE_HOME}"/sockets "${CNODE_HOME}"/priv $sudo chown -R "$U_ID":"$G_ID" "${CNODE_HOME}" 2>/dev/null + + # if INSTALL_MITHRIL then create } # Download and update scripts for cnode