Skip to content

Commit

Permalink
fix: hubble autoupgrade should ensure dependencies and clean unused d…
Browse files Browse the repository at this point in the history
…ocker data
  • Loading branch information
sanjayprabhu committed Oct 20, 2023
1 parent 173c9d6 commit 11dd01f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/chatty-guests-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farcaster/hubble": patch
---

fix: hubble autoupgrade should ensure dependencies and clean unused docker data
13 changes: 13 additions & 0 deletions scripts/hubble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -578,6 +588,9 @@ if [ "$1" == "autoupgrade" ]; then
start_hubble
echo "$(date) Completed hubble autoupgrade"

sleep 5
cleanup

exit 0
fi

Expand Down

0 comments on commit 11dd01f

Please sign in to comment.