Skip to content

Commit

Permalink
feat: Add "up" and "down" commands to hubble.sh (#1372)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 authored Sep 9, 2023
1 parent 79e23bf commit 8d21803
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-moons-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farcaster/hubble": patch
---

feat: Add "up" and "down" commands to hubble.sh
43 changes: 37 additions & 6 deletions scripts/hubble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,35 @@ reexec_as_root_if_needed() {
# Call the function at the beginning of your script
reexec_as_root_if_needed "$@"

# Check for the "up" command-line argument
if [ "$1" == "up" ]; then
# Setup the docker-compose command
set_compose_command

# Run docker compose up -d hubble
$COMPOSE_CMD up -d hubble statsd grafana

echo "✅ Hubble is running."

# Finally, start showing the logs
$COMPOSE_CMD logs --tail 100 -f hubble

exit 0
fi

# "down" command-line argument
if [ "$1" == "down" ]; then
# Setup the docker-compose command
set_compose_command

# Run docker compose down
$COMPOSE_CMD down

echo "✅ Hubble is stopped."

exit 0
fi

# Check the command-line argument for 'upgrade'
if [ "$1" == "upgrade" ]; then
# Ensure the ~/hubble directory exists
Expand Down Expand Up @@ -449,12 +478,14 @@ if [ "$1" == "logs" ]; then
exit 0
fi

# If run without args, show a help
if [ $# -eq 0 ]; then
# If run without args OR with "help", show a help
if [ $# -eq 0 ] || [ "$1" == "help" ]; then
echo "hubble.sh - Install or upgrade Hubble"
echo "Usage: hubble.sh [command]"
echo " upgrade: Upgrade an existing installation of Hubble"
echo " logs: Show the logs of the Hubble service"
echo " help: Show this help"
echo "Usage: hubble.sh [command]"
echo " upgrade Upgrade an existing installation of Hubble"
echo " logs Show the logs of the Hubble service"
echo " up Start Hubble and Grafana dashboard"
echo " down Stop Hubble and Grafana dashboard"
echo " help Show this help"
exit 0
fi

0 comments on commit 8d21803

Please sign in to comment.