From 11dd01f4aa1b00fe93eb46373a593ddfe72dc323 Mon Sep 17 00:00:00 2001 From: Sanjay Raveendran Date: Fri, 20 Oct 2023 10:19:40 -0700 Subject: [PATCH] fix: hubble autoupgrade should ensure dependencies and clean unused docker data --- .changeset/chatty-guests-try.md | 5 +++++ scripts/hubble.sh | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .changeset/chatty-guests-try.md diff --git a/.changeset/chatty-guests-try.md b/.changeset/chatty-guests-try.md new file mode 100644 index 0000000000..c0ef672aee --- /dev/null +++ b/.changeset/chatty-guests-try.md @@ -0,0 +1,5 @@ +--- +"@farcaster/hubble": patch +--- + +fix: hubble autoupgrade should ensure dependencies and clean unused docker data diff --git a/scripts/hubble.sh b/scripts/hubble.sh index e511551a2f..bc44fe8d0e 100755 --- a/scripts/hubble.sh +++ b/scripts/hubble.sh @@ -420,6 +420,12 @@ start_hubble() { $COMPOSE_CMD up -d hubble } +cleanup() { + # Prune unused docker cruft. Make sure to call this only when hub is already running + echo "Pruning unused docker images and volumes" + $COMPOSE_CMD system prune --volumes -f +} + set_compose_command() { # Detect whether "docker-compose" or "docker compose" is available if command -v docker-compose &> /dev/null; then @@ -568,6 +574,10 @@ if [ "$1" == "autoupgrade" ]; then echo "$(date) Attempting hubble autoupgrade..." + # Since cronjob is running under root, make sure the dependencies are installed + install_jq + install_docker "$@" + set_platform_commands set_compose_command @@ -578,6 +588,9 @@ if [ "$1" == "autoupgrade" ]; then start_hubble echo "$(date) Completed hubble autoupgrade" + sleep 5 + cleanup + exit 0 fi