Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an --offline option to run-fs.sh. #672

Merged
merged 5 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions tools/run-fs-offline.sh

This file was deleted.

56 changes: 42 additions & 14 deletions tools/run-fs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ do
build=1
shift 1
;;
--offline)
offline=1
shift 1
;;
*)
net="${1}"
shift 1
Expand Down Expand Up @@ -76,9 +80,12 @@ case "${net}" in

# Set chain id, peer and tx_sources for 2 nodes.
MC_CHAIN_ID="${net}"
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
MC_FOG_INGEST_ENCLAVE_CSS=$(get_css_file "test" "${WORK_DIR}/ingest-enclave.css")
if [[ -z "${offline}" ]]
then
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
MC_FOG_INGEST_ENCLAVE_CSS=$(get_css_file "test" "${WORK_DIR}/ingest-enclave.css")
fi

;;
prod|main)
Expand All @@ -95,9 +102,12 @@ case "${net}" in

# Set chain id, peer and tx_sources for 2 nodes.
MC_CHAIN_ID="${net}"
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
MC_FOG_INGEST_ENCLAVE_CSS=$(get_css_file "prod" "${WORK_DIR}/ingest-enclave.css")
if [[ -z "${offline}" ]]
then
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
MC_FOG_INGEST_ENCLAVE_CSS=$(get_css_file "prod" "${WORK_DIR}/ingest-enclave.css")
fi
;;
alpha)
echo "alpha network doesn't yet publish enclave css measurements, manually download or copy ${WORK_DIR}/ingest-enclave.css"
Expand All @@ -107,15 +117,21 @@ case "${net}" in

# Set chain id, peer and tx_sources for 2 nodes.
MC_CHAIN_ID="${net}"
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
if [[ -z "${offline}" ]]
then
MC_PEER="mc://node1.${domain_name}/,mc://node2.${domain_name}/"
MC_TX_SOURCE_URL="${tx_source_base}/node1.${domain_name}/,${tx_source_base}/node2.${domain_name}/"
fi
MC_FOG_INGEST_ENCLAVE_CSS="${WORK_DIR}/ingest-enclave.css"
;;
local)
# Set chain id, peer and tx_sources for 2 nodes.
MC_CHAIN_ID="${net}"
MC_PEER="insecure-mc://localhost:3200/,insecure-mc://localhost:3201/"
MC_TX_SOURCE_URL="http://localhost:4566/node-0-ledger/,http://localhost:4566/node-1-ledger/"
if [[ -z "${offline}" ]]
then
MC_PEER="insecure-mc://localhost:3200/,insecure-mc://localhost:3201/"
MC_TX_SOURCE_URL="http://localhost:4566/node-0-ledger/,http://localhost:4566/node-1-ledger/"
fi
MC_FOG_INGEST_ENCLAVE_CSS="${WORK_DIR}/ingest-enclave.css"
;;
*)
Expand All @@ -129,18 +145,30 @@ echo "Setting '${net}' environment values"
export MC_CHAIN_ID MC_PEER MC_TX_SOURCE_URL MC_FOG_INGEST_ENCLAVE_CSS MC_WALLET_DB MC_LEDGER_DB

echo " MC_CHAIN_ID: ${MC_CHAIN_ID}"
echo " MC_PEER: ${MC_PEER}"
echo " MC_TX_SOURCE_URL: ${MC_TX_SOURCE_URL}"
if [[ -z "${offline}" ]]
then
echo " MC_PEER: ${MC_PEER}"
echo " MC_TX_SOURCE_URL: ${MC_TX_SOURCE_URL}"
else
echo " running with --offline"
fi
echo " MC_FOG_INGEST_ENCLAVE_CSS: ${MC_FOG_INGEST_ENCLAVE_CSS}"
echo " MC_WALLET_DB: ${MC_WALLET_DB}"
echo " MC_LEDGER_DB: ${MC_LEDGER_DB}"



# Optionally call build-fs.sh to build the current version.
if [[ -n "${build}" ]]
then
"${location}/build-fs.sh" "${net}"
fi

target_dir=${CARGO_TARGET_DIR:-"target"}
echo " executing ${target_dir}/release/full-service"
"${target_dir}/release/full-service"

if [[ -z "${offline}" ]]
then
"${target_dir}/release/full-service"
else
"${target_dir}/release/full-service" --offline
fi