From b5ff774a9ca0854bb492ca3ada6febe92dcf0d4e Mon Sep 17 00:00:00 2001 From: Wasif Iqbal Date: Tue, 9 Jul 2024 18:50:56 -0500 Subject: [PATCH] feat: add hub service agreement - there will be no rewards for running a hub (#2142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why is this change needed? ⚠️ THERE WILL BE NO REWARDS FOR RUNNING A HUB ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [x] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [ ] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. --- ## PR-Codex overview This PR adds a hub service agreement feature to the Hubble script, requiring hub operators to agree to terms before starting the hub. ### Detailed summary - Added function `prompt_for_hub_operator_agreement` to prompt hub operators to agree to terms - Prompt displays a warning about no rewards for running the hub - Operators must type "Yes" to proceed - Implemented input validation for agreement - Integration of agreement prompt before starting or upgrading the hub > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/poor-queens-lick.md | 5 +++++ scripts/hubble.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 .changeset/poor-queens-lick.md diff --git a/.changeset/poor-queens-lick.md b/.changeset/poor-queens-lick.md new file mode 100644 index 0000000000..6e2f8ceab2 --- /dev/null +++ b/.changeset/poor-queens-lick.md @@ -0,0 +1,5 @@ +--- +"@farcaster/hubble": patch +--- + +feat: add hub service agreement - there will be no rewards for running a hub diff --git a/scripts/hubble.sh b/scripts/hubble.sh index 6a110cfedd..3ae061431d 100755 --- a/scripts/hubble.sh +++ b/scripts/hubble.sh @@ -120,6 +120,26 @@ fetch_latest_docker_compose_and_dashboard() { fetch_file_from_repo "$GRAFANA_INI_PATH" "grafana/grafana.ini" } +prompt_for_hub_operator_agreement() { + # Check if stdin is a terminal + if [ -t 0 ]; then + while true; do + printf "⚠️ IMPORTANT: You will NOT get any rewards for running this hub\n" + printf "> Please type \"Yes\" to continue: " + read -r response + case $(printf "%s" "$response" | tr '[:upper:]' '[:lower:]') in + yes|y) + printf "✅ You have agreed to the terms of service. Proceeding with hub startup...\n" + return 0 + ;; + *) + printf "[i] Incorrect input. Please try again.\n" + ;; + esac + done + fi +} + validate_and_store() { local rpc_name=$1 local expected_chain_id=$2 @@ -498,6 +518,9 @@ if [ "$1" == "up" ]; then # Setup the docker-compose command set_compose_command + # Prompt for hub operator agreement + prompt_for_hub_operator_agreement + # Run docker compose up -d hubble $COMPOSE_CMD up -d hubble statsd grafana @@ -543,6 +566,9 @@ if [ "$1" == "upgrade" ]; then # Call the function to set the COMPOSE_CMD variable set_compose_command + # Prompt for hub operator agreement + prompt_for_hub_operator_agreement + # Update the env file if needed write_env_file