Skip to content

Commit

Permalink
FIXUP guild-deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBenson committed Oct 21, 2023
1 parent 3cdd718 commit 8331eeb
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions scripts/cnode-helper-scripts/guild-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# shellcheck source=/dev/null

unset CNODE_HOME
unset MITHRIL_HOME

##########################################
# User Variables - Change as desired #
Expand Down Expand Up @@ -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'
Expand All @@ -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}"
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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 .."
Expand All @@ -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
Expand Down

0 comments on commit 8331eeb

Please sign in to comment.