Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker-compose if version is gte docker compose #3595

Merged
merged 10 commits into from
Mar 3, 2025
6 changes: 6 additions & 0 deletions install/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ function ensure_file_from_example {
fi
}

# Check the version of $1 is greater than or equal to $2 using sort. Note: versions must be stripped of "v"
function vergte() {
printf "%s\n%s" $1 $2 | sort --version-sort --check=quiet --reverse
echo $?
}

SENTRY_CONFIG_PY=sentry/sentry.conf.py
SENTRY_CONFIG_YML=sentry/config.yml

Expand Down
12 changes: 0 additions & 12 deletions install/check-minimum-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ echo "${_group}Checking minimum requirements ..."

source install/_min-requirements.sh

# Check the version of $1 is greater than or equal to $2 using sort. Note: versions must be stripped of "v"
function vergte() {
printf "%s\n%s" $1 $2 | sort --version-sort --check=quiet --reverse
echo $?
}

DOCKER_VERSION=$(docker version --format '{{.Server.Version}}' || echo '')
if [[ -z "$DOCKER_VERSION" ]]; then
echo "FAIL: Unable to get docker version, is the docker daemon running?"
Expand All @@ -20,12 +14,6 @@ if [[ "$(vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION)" -eq 1 ]]; then
fi
echo "Found Docker version $DOCKER_VERSION"

COMPOSE_VERSION=$($dc_base version --short || echo '')
if [[ -z "$COMPOSE_VERSION" ]]; then
echo "FAIL: Docker compose is required to run self-hosted"
exit 1
fi

if [[ "$(vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION)" -eq 1 ]]; then
echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION"
exit 1
Expand Down
17 changes: 17 additions & 0 deletions install/dc-detect-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ echo "${_group}Initializing Docker Compose ..."

# To support users that are symlinking to docker-compose
dc_base="$(docker compose version &>/dev/null && echo 'docker compose' || echo 'docker-compose')"
dc_base_standalone="$(docker-compose version &>/dev/null && echo 'docker-compose' || echo '')"

COMPOSE_VERSION=$($dc_base version --short || echo '')
STANDALONE_COMPOSE_VERSION=$($dc_base_standalone version --short &>/dev/null || echo '')

if [[ -z "$COMPOSE_VERSION" && -z "$STANDALONE_COMPOSE_VERSION" ]]; then
echo "FAIL: Docker Compose is required to run self-hosted"
exit 1
fi

if [[ ! -z "${STANDALONE_COMPOSE_VERSION}" ]]; then
if [[ "$(vergte ${COMPOSE_VERSION//v/} ${STANDALONE_COMPOSE_VERSION//v/})" -eq 1 ]]; then
COMPOSE_VERSION="${STANDALONE_COMPOSE_VERSION}"
dc_base="$dc_base_standalone"
fi
fi

if [[ "$(basename $0)" = "install.sh" ]]; then
dc="$dc_base --ansi never --env-file ${_ENV}"
else
Expand Down