mirror of
https://github.com/getsentry/self-hosted.git
synced 2025-12-08 19:46:14 +00:00
Use docker-compose if version is gte docker compose (#3595)
Fixes #3587 This PR tries to use docker-compose if its version is greater than docker compose.
This commit is contained in:
parent
9b6c1cf658
commit
d885dd331f
@ -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
|
||||
|
||||
|
||||
@ -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?"
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user