Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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 **"
Expand Down