From 3cdd718ba602306a1d1ba23222248e60c340c94f Mon Sep 17 00:00:00 2001 From: illuminatus Date: Sat, 21 Oct 2023 14:06:30 -0700 Subject: [PATCH] FIXUP mithril-signer.sh --- .../cnode-helper-scripts/mithril-signer.sh | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/cnode-helper-scripts/mithril-signer.sh b/scripts/cnode-helper-scripts/mithril-signer.sh index 2dce24967..c8f7c3487 100755 --- a/scripts/cnode-helper-scripts/mithril-signer.sh +++ b/scripts/cnode-helper-scripts/mithril-signer.sh @@ -47,20 +47,6 @@ set_defaults() { RELEASE="pre-release" ;; esac - sudo bash -c "cat <<-'EOF' > ${MITHRIL_HOME}/service.env - AGGREGATOR_ENDPOINT=https://aggregator.${RELEASE}-${NETWORK}.api.mithril.network/aggregator - KES_SECRET_KEY_PATH=${POOL_DIR}/${POOL_HOTKEY_SK_FILENAME} - OPERATIONAL_CERTIFICATE_PATH=${POOL_DIR}/${POOL_OPCERT_FILENAME} - PARTY_ID=$(cat ${POOL_DIR}/${POOL_ID_FILENAME}) - DB_DIRECTORY=${CNODE_HOME}/db - CARDANO_CLI_PATH=${HOME}/.local/bin/cardano-cli - DATA_STORES_DIRECTORY=${MITHRIL_HOME}/data-stores - ERA_READER_ADAPTER_TYPE=cardano-chain - ERA_READER_ADDRESS=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/era.addr - ERA_READER_VKEY=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/era.vkey - ERA_READER_ADAPTER_PARAMS=$(jq -nc --arg address $(wget -q -O - "${ERA_READER_ADDRESS}") --arg verification_key $(wget -q -O - "${ERA_READER_VKEY}") '{"address": $address, "verification_key": $verification_key}') - GENESIS_VERIFICATION_KEY=$(curl -s https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/genesis.vkey) - EOF" else echo "ERROR: NETWORK not set in env file, please set and re-run!!" fi @@ -76,7 +62,27 @@ pre_startup_sanity() { [[ -f "${LOG_DIR}"/mithril-signer.log ]] && mv "${LOG_DIR}"/mithril-signer.log "${LOG_DIR}"/archive/ } +create_environment_file() { + sudo bash -c "cat <<-'EOF' > ${MITHRIL_HOME}/service.env + AGGREGATOR_ENDPOINT=https://aggregator.${RELEASE}-${NETWORK}.api.mithril.network/aggregator + KES_SECRET_KEY_PATH=${POOL_DIR}/${POOL_HOTKEY_SK_FILENAME} + OPERATIONAL_CERTIFICATE_PATH=${POOL_DIR}/${POOL_OPCERT_FILENAME} + PARTY_ID=$(cat ${POOL_DIR}/${POOL_ID_FILENAME}) + DB_DIRECTORY=${CNODE_HOME}/db + CARDANO_CLI_PATH=${HOME}/.local/bin/cardano-cli + DATA_STORES_DIRECTORY=${MITHRIL_HOME}/data-stores + ERA_READER_ADAPTER_TYPE=cardano-chain + ERA_READER_ADDRESS=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/era.addr + ERA_READER_VKEY=https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/era.vkey + ERA_READER_ADAPTER_PARAMS=$(jq -nc --arg address $(wget -q -O - "${ERA_READER_ADDRESS}") --arg verification_key $(wget -q -O - "${ERA_READER_VKEY}") '{"address": $address, "verification_key": $verification_key}') + GENESIS_VERIFICATION_KEY=$(curl -s https://raw.githubusercontent.com/input-output-hk/mithril/main/mithril-infra/configuration/${RELEASE}-${NETWORK}/genesis.vkey) + EOF" +} + deploy_systemd() { + echo "Creating ${CNODE_VNAME}-mithril-signer systemd service environment file.." + create_environment_file || echo "ERROR: Failed to create ${CNODE_VNAME}-mithril-signer systemd service environment file!!" && exit 1 + echo "Deploying ${CNODE_VNAME}-mithril-signer as systemd service.." sudo bash -c "cat <<-'EOF' > /etc/systemd/system/${CNODE_VNAME}-mithril-signer.service [Unit]