From 79019e982e9f150111d5e37f06ec82549d18fc97 Mon Sep 17 00:00:00 2001 From: Mohammed Nayeem Date: Tue, 3 Mar 2026 13:02:04 +0530 Subject: [PATCH] Update setup.sh Detect the correct Docker Compose command --- setup.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 617c8bb7..bf74286e 100755 --- a/setup.sh +++ b/setup.sh @@ -29,6 +29,18 @@ elif [ ! -f /etc/os-release ]; then exit fi +# Detect the correct Docker Compose command +detect_compose_command() { + if docker compose version >/dev/null 2>&1; then + DOCKER_COMPOSE="docker compose" + elif command -v docker-compose >/dev/null 2>&1; then + DOCKER_COMPOSE="docker-compose" + else + echo "Error: Neither 'docker compose' nor 'docker-compose' found." + exit 1 + fi +} + # Parse any user provided parameters opts="$(getopt -o doph -l dont-start,overwrite,preview,help,version: --name "$0" -- "$@")" eval set -- "$opts" @@ -173,7 +185,7 @@ create_directories() { # We've been asked to overwrite the existing database echo "Shutting down any running Redash instance" if [ -e "$REDASH_BASE_PATH"/compose.yaml ]; then - docker compose -f "$REDASH_BASE_PATH"/compose.yaml down + $DOCKER_COMPOSE -f "$REDASH_BASE_PATH"/compose.yaml down fi echo "Moving old Redash PG database directory out of the way" @@ -313,10 +325,10 @@ startup() { echo "** Starting Redash **" echo "*********************" echo "** Initialising Redash database **" - docker compose run --rm server create_db + $DOCKER_COMPOSE run --rm server create_db echo "** Starting the rest of Redash **" - docker compose up -d + $DOCKER_COMPOSE up -d echo echo "Redash has been installed and is ready for configuring at http://$(hostname -f):5000" @@ -366,6 +378,10 @@ else esac fi +# Detect the right Docker Compose command to use +detect_compose_command +echo "Using compose command: $DOCKER_COMPOSE" + # Ensure pwgen is available (needed for generating secrets) if ! command -v pwgen >/dev/null 2>&1; then echo "** Installing pwgen **"