From d87c155ca32d074519ba0a849c00cacb00ce7c45 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Tue, 22 Apr 2025 14:18:30 +0200 Subject: [PATCH 01/52] feat(install): Adds support for podman(compose), while maintaining compatibility with docker --- install.sh | 1 + install/_min-requirements.sh | 3 ++ install/check-minimum-requirements.sh | 42 ++++++++++++++++---------- install/create-docker-volumes.sh | 12 ++++---- install/dc-detect-version.sh | 27 ++++++++++++----- install/detect-container-technology.sh | 14 +++++++++ install/detect-platform.sh | 10 +++--- install/error-handling.sh | 4 +-- install/geoip.sh | 2 +- install/parse-cli.sh | 2 +- install/update-docker-images.sh | 6 ++-- install/upgrade-postgres.sh | 14 ++++----- install/wrap-up.sh | 2 +- 13 files changed, 90 insertions(+), 49 deletions(-) create mode 100755 install/detect-container-technology.sh diff --git a/install.sh b/install.sh index 23726ce97f..ec9f81011a 100755 --- a/install.sh +++ b/install.sh @@ -11,6 +11,7 @@ source install/_lib.sh # Pre-flight. No impact yet. source install/parse-cli.sh +source install/detect-container-technology.sh source install/detect-platform.sh source install/dc-detect-version.sh source install/error-handling.sh diff --git a/install/_min-requirements.sh b/install/_min-requirements.sh index 17afa00995..3f764b8cf3 100644 --- a/install/_min-requirements.sh +++ b/install/_min-requirements.sh @@ -2,6 +2,9 @@ MIN_DOCKER_VERSION='19.03.6' MIN_COMPOSE_VERSION='2.32.2' +MIN_PODMAN_VERSION='4.9.4' +MIN_PODMAN_COMPOSE_VERSION='1.3.0' + # 16 GB minimum host RAM, but there'll be some overhead outside of what # can be allotted to docker if [[ "$COMPOSE_PROFILES" == "errors-only" ]]; then diff --git a/install/check-minimum-requirements.sh b/install/check-minimum-requirements.sh index e06db42c48..743be8c058 100644 --- a/install/check-minimum-requirements.sh +++ b/install/check-minimum-requirements.sh @@ -2,31 +2,41 @@ echo "${_group}Checking minimum requirements ..." source install/_min-requirements.sh -DOCKER_VERSION=$(docker version --format '{{.Server.Version}}' || echo '') +DOCKER_VERSION=$($CONTAINER_TECHNOLOGY version --format '{{.Server.Version}}' || echo '') if [[ -z "$DOCKER_VERSION" ]]; then - echo "FAIL: Unable to get docker version, is the docker daemon running?" + echo "FAIL: Unable to get $CONTAINER_TECHNOLOGY version, is the $CONTAINER_TECHNOLOGY daemon running?" exit 1 fi -if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION; then - echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION" - exit 1 -fi -echo "Found Docker version $DOCKER_VERSION" - -if ! vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION; then - echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION" - exit 1 +if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then + if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION; then + echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION" + exit 1 + fi + if ! vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION; then + echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION" + exit 1 + fi +elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then + if ! vergte ${DOCKER_VERSION//v/} $MIN_PODMAN_VERSION; then + echo "FAIL: Expected minimum podman version to be $MIN_PODMAN_VERSION but found $DOCKER_VERSION" + exit 1 + fi + if ! vergte ${COMPOSE_VERSION//v/} $MIN_PODMAN_COMPOSE_VERSION; then + echo "FAIL: Expected minimum $dc_base version to be $MIN_PODMAN_COMPOSE_VERSION but found $COMPOSE_VERSION" + exit 1 + fi fi -echo "Found Docker Compose version $COMPOSE_VERSION" +echo "Found $CONTAINER_TECHNOLOGY version $DOCKER_VERSION" +echo "Found $CONTAINER_TECHNOLOGY Compose version $COMPOSE_VERSION" -CPU_AVAILABLE_IN_DOCKER=$(docker run --rm busybox nproc --all) +CPU_AVAILABLE_IN_DOCKER=$($CONTAINER_TECHNOLOGY run --rm busybox nproc --all) if [[ "$CPU_AVAILABLE_IN_DOCKER" -lt "$MIN_CPU_HARD" ]]; then echo "FAIL: Required minimum CPU cores available to Docker is $MIN_CPU_HARD, found $CPU_AVAILABLE_IN_DOCKER" exit 1 fi -RAM_AVAILABLE_IN_DOCKER=$(docker run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}') +RAM_AVAILABLE_IN_DOCKER=$($CONTAINER_TECHNOLOGY run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}') if [[ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM_HARD" ]]; then echo "FAIL: Required minimum RAM available to Docker is $MIN_RAM_HARD MB, found $RAM_AVAILABLE_IN_DOCKER MB" exit 1 @@ -35,9 +45,9 @@ fi #SSE4.2 required by Clickhouse (https://clickhouse.yandex/docs/en/operations/requirements/) # On KVM, cpuinfo could falsely not report SSE 4.2 support, so skip the check. https://github.com/ClickHouse/ClickHouse/issues/20#issuecomment-226849297 # This may also happen on other virtualization software such as on VMWare ESXi hosts. -IS_KVM=$(docker run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :) +IS_KVM=$($CONTAINER_TECHNOLOGY run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :) if [[ ! "$SKIP_SSE42_REQUIREMENTS" -eq 1 && "$IS_KVM" -eq 0 && "$DOCKER_ARCH" = "x86_64" ]]; then - SUPPORTS_SSE42=$(docker run --rm busybox grep -c sse4_2 /proc/cpuinfo || :) + SUPPORTS_SSE42=$($CONTAINER_TECHNOLOGY run --rm busybox grep -c sse4_2 /proc/cpuinfo || :) if [[ "$SUPPORTS_SSE42" -eq 0 ]]; then echo "FAIL: The CPU your machine is running on does not support the SSE 4.2 instruction set, which is required for one of the services Sentry uses (Clickhouse). See https://github.com/getsentry/self-hosted/issues/340 for more info." exit 1 diff --git a/install/create-docker-volumes.sh b/install/create-docker-volumes.sh index 15f20d5440..ca44e065dc 100644 --- a/install/create-docker-volumes.sh +++ b/install/create-docker-volumes.sh @@ -1,10 +1,10 @@ echo "${_group}Creating volumes for persistent storage ..." -echo "Created $(docker volume create --name=sentry-clickhouse)." -echo "Created $(docker volume create --name=sentry-data)." -echo "Created $(docker volume create --name=sentry-kafka)." -echo "Created $(docker volume create --name=sentry-postgres)." -echo "Created $(docker volume create --name=sentry-redis)." -echo "Created $(docker volume create --name=sentry-symbolicator)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-clickhouse)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-data)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-kafka)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-postgres)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-redis)." +echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-symbolicator)." echo "${_endgroup}" diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 1629736336..d0b1298eee 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -6,17 +6,17 @@ else _endgroup="" fi -echo "${_group}Initializing Docker Compose ..." +echo "${_group}Initializing Docker|Podman Compose ..." # To support users that are symlinking to docker-compose -dc_base="$(docker compose version --short &>/dev/null && echo 'docker compose' || echo '')" -dc_base_standalone="$(docker-compose version --short &>/dev/null && echo 'docker-compose' || echo '')" +dc_base="$(${CONTAINER_TECHNOLOGY} compose version --short &>/dev/null && echo "$CONTAINER_TECHNOLOGY compose" || echo '')" +dc_base_standalone="$(${CONTAINER_TECHNOLOGY}-compose version --short &>/dev/null && echo "$CONTAINER_TECHNOLOGY-compose" || echo '')" COMPOSE_VERSION=$([ -n "$dc_base" ] && $dc_base version --short || echo '') STANDALONE_COMPOSE_VERSION=$([ -n "$dc_base_standalone" ] && $dc_base_standalone version --short || echo '') if [[ -z "$COMPOSE_VERSION" && -z "$STANDALONE_COMPOSE_VERSION" ]]; then - echo "FAIL: Docker Compose is required to run self-hosted" + echo "FAIL: Docker|Podman Compose is required to run self-hosted" exit 1 fi @@ -25,14 +25,25 @@ if [[ -z "$COMPOSE_VERSION" ]] || [[ -n "$STANDALONE_COMPOSE_VERSION" ]] && ! ve dc_base="$dc_base_standalone" fi +if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then + NO_ANSI="--ansi never" +elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then + NO_ANSI="--no-ansi" +fi + if [[ "$(basename $0)" = "install.sh" ]]; then - dc="$dc_base --ansi never --env-file ${_ENV}" + dc="$dc_base $NO_ANSI --env-file ${_ENV}" else - dc="$dc_base --ansi never" + dc="$dc_base $NO_ANSI" +fi + +if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then + proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" +elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then + proxy_args="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" fi -proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" dcr="$dc run --pull=never --rm" dcb="$dc build $proxy_args" -dbuild="docker build $proxy_args" +dbuild="$CONTAINER_TECHNOLOGY build $proxy_args" echo "${_endgroup}" diff --git a/install/detect-container-technology.sh b/install/detect-container-technology.sh new file mode 100755 index 0000000000..0f756d4f78 --- /dev/null +++ b/install/detect-container-technology.sh @@ -0,0 +1,14 @@ +echo "${_group}Detecting container technology ..." + +export CONTAINER_TECHNOLOGY="" + +if command -v podman &> /dev/null; then + CONTAINER_TECHNOLOGY="podman" +elif command -v docker &> /dev/null; then + CONTAINER_TECHNOLOGY="docker" +else + echo "FAIL: Neither podman nor docker is installed on the system." + exit 1 +fi +echo "Detected container technology: $CONTAINER_TECHNOLOGY" +echo "${_endgroup}" \ No newline at end of file diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 7404008f41..86a76e8103 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -12,12 +12,14 @@ echo "${_group}Detecting Docker platform" # linux/amd64 by default due to virtualization. # See https://github.com/docker/cli/issues/3286 for the Docker bug. -if ! command -v docker &>/dev/null; then - echo "FAIL: Could not find a \`docker\` binary on this system. Are you sure it's installed?" - exit 1 +FORMAT="" +if [[ $CONTAINER_TECHNOLOGY == "podman" ]]; then + FORMAT="{{.Host.Arch}}" +elif [[ $CONTAINER_TECHNOLOGY == "docker" ]]; then + FORMAT="{{.Architecture}}" fi -export DOCKER_ARCH=$(docker info --format '{{.Architecture}}') +export DOCKER_ARCH=$($CONTAINER_TECHNOLOGY info --format "$FORMAT") if [[ "$DOCKER_ARCH" = "x86_64" ]]; then export DOCKER_PLATFORM="linux/amd64" elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then diff --git a/install/error-handling.sh b/install/error-handling.sh index cbd0676858..8b95588238 100644 --- a/install/error-handling.sh +++ b/install/error-handling.sh @@ -6,8 +6,8 @@ fi $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq -jq="docker run --rm -i sentry-self-hosted-jq-local" -sentry_cli="docker run --rm -v /tmp:/work -e SENTRY_DSN=$SENTRY_DSN getsentry/sentry-cli" +jq="$CONTAINER_TECHNOLOGY run --rm -i sentry-self-hosted-jq-local" +sentry_cli="$CONTAINER_TECHNOLOGY run --rm -v /tmp:/work -e SENTRY_DSN=$SENTRY_DSN getsentry/sentry-cli" send_envelope() { # Send envelope diff --git a/install/geoip.sh b/install/geoip.sh index 041db9b683..92f5a6ee16 100644 --- a/install/geoip.sh +++ b/install/geoip.sh @@ -21,7 +21,7 @@ install_geoip() { else echo "IP address geolocation is configured for updates." echo "Updating IP address geolocation database ... " - if ! docker run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then + if ! $CONTAINER_TECHNOLOGY run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then result='Error' fi echo "$result updating IP address geolocation database." diff --git a/install/parse-cli.sh b/install/parse-cli.sh index 0390b54f9e..67f838d391 100644 --- a/install/parse-cli.sh +++ b/install/parse-cli.sh @@ -4,7 +4,7 @@ show_help() { cat <stdout redirection below and pass it through grep, ignoring all lines # having this '-onpremise-local' suffix. -$dc pull -q --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true +$dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true # We may not have the set image on the repo (local images) so allow fails -docker pull ${SENTRY_IMAGE} || true +$CONTAINER_TECHNOLOGY pull ${SENTRY_IMAGE} || true echo "${_endgroup}" diff --git a/install/upgrade-postgres.sh b/install/upgrade-postgres.sh index fa66a0aa4a..f878f9d148 100644 --- a/install/upgrade-postgres.sh +++ b/install/upgrade-postgres.sh @@ -1,23 +1,23 @@ echo "${_group}Ensuring proper PostgreSQL version ..." -if [[ -n "$(docker volume ls -q --filter name=sentry-postgres)" && "$(docker run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.6" ]]; then - docker volume rm sentry-postgres-new || true +if [[ -n "$($CONTAINER_TECHNOLOGY volume ls -q --filter name=sentry-postgres)" && "$($CONTAINER_TECHNOLOGY run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.6" ]]; then + $CONTAINER_TECHNOLOGY volume rm sentry-postgres-new || true # If this is Postgres 9.6 data, start upgrading it to 14.0 in a new volume - docker run --rm \ + $CONTAINER_TECHNOLOGY run --rm \ -v sentry-postgres:/var/lib/postgresql/9.6/data \ -v sentry-postgres-new:/var/lib/postgresql/14/data \ tianon/postgres-upgrade:9.6-to-14 # Get rid of the old volume as we'll rename the new one to that - docker volume rm sentry-postgres - docker volume create --name sentry-postgres + $CONTAINER_TECHNOLOGY volume rm sentry-postgres + $CONTAINER_TECHNOLOGY volume create --name sentry-postgres # There's no rename volume in Docker so copy the contents from old to new name # Also append the `host all all all trust` line as `tianon/postgres-upgrade:9.6-to-14` # doesn't do that automatically. - docker run --rm -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -c \ + $CONTAINER_TECHNOLOGY run --rm -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -c \ "cd /from ; cp -av . /to ; echo 'host all all all trust' >> /to/pg_hba.conf" # Finally, remove the new old volume as we are all in sentry-postgres now. - docker volume rm sentry-postgres-new + $CONTAINER_TECHNOLOGY volume rm sentry-postgres-new echo "Re-indexing due to glibc change, this may take a while..." echo "Starting up new PostgreSQL version" $dc up --wait postgres diff --git a/install/wrap-up.sh b/install/wrap-up.sh index 6f242284fe..73b529fc0b 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -6,7 +6,7 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then $dc restart relay $dc exec -T nginx nginx -s reload - docker run --rm --network="${COMPOSE_PROJECT_NAME}_default" alpine ash \ + $CONTAINER_TECHNOLOGY run --rm --network="${COMPOSE_PROJECT_NAME}_default" alpine ash \ -c 'while [[ "$(wget -T 1 -q -O- http://web:9000/_health/)" != "ok" ]]; do sleep 0.5; done' # Make sure everything is up. This should only touch relay and nginx From cd243119fd8abeaa86228f9b4babcda66d110b22 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 09:36:18 +0200 Subject: [PATCH 02/52] Renames container-technology -> container-engine --- install.sh | 2 +- install/check-minimum-requirements.sh | 20 ++++++++++---------- install/create-docker-volumes.sh | 12 ++++++------ install/dc-detect-version.sh | 14 +++++++------- install/detect-container-engine.sh | 14 ++++++++++++++ install/detect-container-technology.sh | 14 -------------- install/detect-platform.sh | 6 +++--- install/error-handling.sh | 4 ++-- install/geoip.sh | 2 +- install/update-docker-images.sh | 4 ++-- install/upgrade-postgres.sh | 14 +++++++------- install/wrap-up.sh | 2 +- 12 files changed, 54 insertions(+), 54 deletions(-) create mode 100755 install/detect-container-engine.sh delete mode 100755 install/detect-container-technology.sh diff --git a/install.sh b/install.sh index ec9f81011a..d6c786153b 100755 --- a/install.sh +++ b/install.sh @@ -11,7 +11,7 @@ source install/_lib.sh # Pre-flight. No impact yet. source install/parse-cli.sh -source install/detect-container-technology.sh +source install/detect-container-engine.sh source install/detect-platform.sh source install/dc-detect-version.sh source install/error-handling.sh diff --git a/install/check-minimum-requirements.sh b/install/check-minimum-requirements.sh index 743be8c058..322de33975 100644 --- a/install/check-minimum-requirements.sh +++ b/install/check-minimum-requirements.sh @@ -2,13 +2,13 @@ echo "${_group}Checking minimum requirements ..." source install/_min-requirements.sh -DOCKER_VERSION=$($CONTAINER_TECHNOLOGY version --format '{{.Server.Version}}' || echo '') +DOCKER_VERSION=$($CONTAINER_ENGINE version --format '{{.Server.Version}}' || echo '') if [[ -z "$DOCKER_VERSION" ]]; then - echo "FAIL: Unable to get $CONTAINER_TECHNOLOGY version, is the $CONTAINER_TECHNOLOGY daemon running?" + echo "FAIL: Unable to get $CONTAINER_ENGINE version, is the $CONTAINER_ENGINE daemon running?" exit 1 fi -if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then +if [[ "$CONTAINER_ENGINE" == "docker" ]]; then if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION; then echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION" exit 1 @@ -17,7 +17,7 @@ if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION" exit 1 fi -elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then +elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then if ! vergte ${DOCKER_VERSION//v/} $MIN_PODMAN_VERSION; then echo "FAIL: Expected minimum podman version to be $MIN_PODMAN_VERSION but found $DOCKER_VERSION" exit 1 @@ -27,16 +27,16 @@ elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then exit 1 fi fi -echo "Found $CONTAINER_TECHNOLOGY version $DOCKER_VERSION" -echo "Found $CONTAINER_TECHNOLOGY Compose version $COMPOSE_VERSION" +echo "Found $CONTAINER_ENGINE version $DOCKER_VERSION" +echo "Found $CONTAINER_ENGINE Compose version $COMPOSE_VERSION" -CPU_AVAILABLE_IN_DOCKER=$($CONTAINER_TECHNOLOGY run --rm busybox nproc --all) +CPU_AVAILABLE_IN_DOCKER=$($CONTAINER_ENGINE run --rm busybox nproc --all) if [[ "$CPU_AVAILABLE_IN_DOCKER" -lt "$MIN_CPU_HARD" ]]; then echo "FAIL: Required minimum CPU cores available to Docker is $MIN_CPU_HARD, found $CPU_AVAILABLE_IN_DOCKER" exit 1 fi -RAM_AVAILABLE_IN_DOCKER=$($CONTAINER_TECHNOLOGY run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}') +RAM_AVAILABLE_IN_DOCKER=$($CONTAINER_ENGINE run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}') if [[ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM_HARD" ]]; then echo "FAIL: Required minimum RAM available to Docker is $MIN_RAM_HARD MB, found $RAM_AVAILABLE_IN_DOCKER MB" exit 1 @@ -45,9 +45,9 @@ fi #SSE4.2 required by Clickhouse (https://clickhouse.yandex/docs/en/operations/requirements/) # On KVM, cpuinfo could falsely not report SSE 4.2 support, so skip the check. https://github.com/ClickHouse/ClickHouse/issues/20#issuecomment-226849297 # This may also happen on other virtualization software such as on VMWare ESXi hosts. -IS_KVM=$($CONTAINER_TECHNOLOGY run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :) +IS_KVM=$($CONTAINER_ENGINE run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :) if [[ ! "$SKIP_SSE42_REQUIREMENTS" -eq 1 && "$IS_KVM" -eq 0 && "$DOCKER_ARCH" = "x86_64" ]]; then - SUPPORTS_SSE42=$($CONTAINER_TECHNOLOGY run --rm busybox grep -c sse4_2 /proc/cpuinfo || :) + SUPPORTS_SSE42=$($CONTAINER_ENGINE run --rm busybox grep -c sse4_2 /proc/cpuinfo || :) if [[ "$SUPPORTS_SSE42" -eq 0 ]]; then echo "FAIL: The CPU your machine is running on does not support the SSE 4.2 instruction set, which is required for one of the services Sentry uses (Clickhouse). See https://github.com/getsentry/self-hosted/issues/340 for more info." exit 1 diff --git a/install/create-docker-volumes.sh b/install/create-docker-volumes.sh index ca44e065dc..aa8fbd690b 100644 --- a/install/create-docker-volumes.sh +++ b/install/create-docker-volumes.sh @@ -1,10 +1,10 @@ echo "${_group}Creating volumes for persistent storage ..." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-clickhouse)." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-data)." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-kafka)." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-postgres)." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-redis)." -echo "Created $($CONTAINER_TECHNOLOGY volume create --name=sentry-symbolicator)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-clickhouse)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-data)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-kafka)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-postgres)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-redis)." +echo "Created $($CONTAINER_ENGINE volume create --name=sentry-symbolicator)." echo "${_endgroup}" diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index d0b1298eee..0ca5aeb81b 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -9,8 +9,8 @@ fi echo "${_group}Initializing Docker|Podman Compose ..." # To support users that are symlinking to docker-compose -dc_base="$(${CONTAINER_TECHNOLOGY} compose version --short &>/dev/null && echo "$CONTAINER_TECHNOLOGY compose" || echo '')" -dc_base_standalone="$(${CONTAINER_TECHNOLOGY}-compose version --short &>/dev/null && echo "$CONTAINER_TECHNOLOGY-compose" || echo '')" +dc_base="$(${CONTAINER_ENGINE} compose version --short &>/dev/null && echo "$CONTAINER_ENGINE compose" || echo '')" +dc_base_standalone="$(${CONTAINER_ENGINE}-compose version --short &>/dev/null && echo "$CONTAINER_ENGINE-compose" || echo '')" COMPOSE_VERSION=$([ -n "$dc_base" ] && $dc_base version --short || echo '') STANDALONE_COMPOSE_VERSION=$([ -n "$dc_base_standalone" ] && $dc_base_standalone version --short || echo '') @@ -25,9 +25,9 @@ if [[ -z "$COMPOSE_VERSION" ]] || [[ -n "$STANDALONE_COMPOSE_VERSION" ]] && ! ve dc_base="$dc_base_standalone" fi -if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then +if [[ "$CONTAINER_ENGINE" == "docker" ]]; then NO_ANSI="--ansi never" -elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then +elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then NO_ANSI="--no-ansi" fi @@ -37,13 +37,13 @@ else dc="$dc_base $NO_ANSI" fi -if [[ "$CONTAINER_TECHNOLOGY" == "docker" ]]; then +if [[ "$CONTAINER_ENGINE" == "docker" ]]; then proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" -elif [[ "$CONTAINER_TECHNOLOGY" == "podman" ]]; then +elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then proxy_args="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" fi dcr="$dc run --pull=never --rm" dcb="$dc build $proxy_args" -dbuild="$CONTAINER_TECHNOLOGY build $proxy_args" +dbuild="$CONTAINER_ENGINE build $proxy_args" echo "${_endgroup}" diff --git a/install/detect-container-engine.sh b/install/detect-container-engine.sh new file mode 100755 index 0000000000..2b16c5ec98 --- /dev/null +++ b/install/detect-container-engine.sh @@ -0,0 +1,14 @@ +echo "${_group}Detecting container engine ..." + +export CONTAINER_ENGINE="" + +if command -v podman &> /dev/null; then + CONTAINER_ENGINE="podman" +elif command -v docker &> /dev/null; then + CONTAINER_ENGINE="docker" +else + echo "FAIL: Neither podman nor docker is installed on the system." + exit 1 +fi +echo "Detected container engine: $CONTAINER_ENGINE" +echo "${_endgroup}" \ No newline at end of file diff --git a/install/detect-container-technology.sh b/install/detect-container-technology.sh deleted file mode 100755 index 0f756d4f78..0000000000 --- a/install/detect-container-technology.sh +++ /dev/null @@ -1,14 +0,0 @@ -echo "${_group}Detecting container technology ..." - -export CONTAINER_TECHNOLOGY="" - -if command -v podman &> /dev/null; then - CONTAINER_TECHNOLOGY="podman" -elif command -v docker &> /dev/null; then - CONTAINER_TECHNOLOGY="docker" -else - echo "FAIL: Neither podman nor docker is installed on the system." - exit 1 -fi -echo "Detected container technology: $CONTAINER_TECHNOLOGY" -echo "${_endgroup}" \ No newline at end of file diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 86a76e8103..1d28065e51 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -13,13 +13,13 @@ echo "${_group}Detecting Docker platform" # See https://github.com/docker/cli/issues/3286 for the Docker bug. FORMAT="" -if [[ $CONTAINER_TECHNOLOGY == "podman" ]]; then +if [[ $CONTAINER_ENGINE == "podman" ]]; then FORMAT="{{.Host.Arch}}" -elif [[ $CONTAINER_TECHNOLOGY == "docker" ]]; then +elif [[ $CONTAINER_ENGINE == "docker" ]]; then FORMAT="{{.Architecture}}" fi -export DOCKER_ARCH=$($CONTAINER_TECHNOLOGY info --format "$FORMAT") +export DOCKER_ARCH=$($CONTAINER_ENGINE info --format "$FORMAT") if [[ "$DOCKER_ARCH" = "x86_64" ]]; then export DOCKER_PLATFORM="linux/amd64" elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then diff --git a/install/error-handling.sh b/install/error-handling.sh index 8b95588238..e325a21494 100644 --- a/install/error-handling.sh +++ b/install/error-handling.sh @@ -6,8 +6,8 @@ fi $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq -jq="$CONTAINER_TECHNOLOGY run --rm -i sentry-self-hosted-jq-local" -sentry_cli="$CONTAINER_TECHNOLOGY run --rm -v /tmp:/work -e SENTRY_DSN=$SENTRY_DSN getsentry/sentry-cli" +jq="$CONTAINER_ENGINE run --rm -i sentry-self-hosted-jq-local" +sentry_cli="$CONTAINER_ENGINE run --rm -v /tmp:/work -e SENTRY_DSN=$SENTRY_DSN getsentry/sentry-cli" send_envelope() { # Send envelope diff --git a/install/geoip.sh b/install/geoip.sh index 92f5a6ee16..0d1b2efc0a 100644 --- a/install/geoip.sh +++ b/install/geoip.sh @@ -21,7 +21,7 @@ install_geoip() { else echo "IP address geolocation is configured for updates." echo "Updating IP address geolocation database ... " - if ! $CONTAINER_TECHNOLOGY run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then + if ! $CONTAINER_ENGINE run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then result='Error' fi echo "$result updating IP address geolocation database." diff --git a/install/update-docker-images.sh b/install/update-docker-images.sh index a67bc9ac40..e5d5bc23d2 100644 --- a/install/update-docker-images.sh +++ b/install/update-docker-images.sh @@ -1,4 +1,4 @@ -echo "${_group}Fetching and updating $CONTAINER_TECHNOLOGY images ..." +echo "${_group}Fetching and updating $CONTAINER_ENGINE images ..." # We tag locally built images with a '-self-hosted-local' suffix. `docker # compose pull` tries to pull these too and shows a 404 error on the console @@ -9,6 +9,6 @@ echo "${_group}Fetching and updating $CONTAINER_TECHNOLOGY images ..." $dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true # We may not have the set image on the repo (local images) so allow fails -$CONTAINER_TECHNOLOGY pull ${SENTRY_IMAGE} || true +$CONTAINER_ENGINE pull ${SENTRY_IMAGE} || true echo "${_endgroup}" diff --git a/install/upgrade-postgres.sh b/install/upgrade-postgres.sh index f878f9d148..ad5fa88bac 100644 --- a/install/upgrade-postgres.sh +++ b/install/upgrade-postgres.sh @@ -1,23 +1,23 @@ echo "${_group}Ensuring proper PostgreSQL version ..." -if [[ -n "$($CONTAINER_TECHNOLOGY volume ls -q --filter name=sentry-postgres)" && "$($CONTAINER_TECHNOLOGY run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.6" ]]; then - $CONTAINER_TECHNOLOGY volume rm sentry-postgres-new || true +if [[ -n "$($CONTAINER_ENGINE volume ls -q --filter name=sentry-postgres)" && "$($CONTAINER_ENGINE run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION 2>/dev/null)" == "9.6" ]]; then + $CONTAINER_ENGINE volume rm sentry-postgres-new || true # If this is Postgres 9.6 data, start upgrading it to 14.0 in a new volume - $CONTAINER_TECHNOLOGY run --rm \ + $CONTAINER_ENGINE run --rm \ -v sentry-postgres:/var/lib/postgresql/9.6/data \ -v sentry-postgres-new:/var/lib/postgresql/14/data \ tianon/postgres-upgrade:9.6-to-14 # Get rid of the old volume as we'll rename the new one to that - $CONTAINER_TECHNOLOGY volume rm sentry-postgres - $CONTAINER_TECHNOLOGY volume create --name sentry-postgres + $CONTAINER_ENGINE volume rm sentry-postgres + $CONTAINER_ENGINE volume create --name sentry-postgres # There's no rename volume in Docker so copy the contents from old to new name # Also append the `host all all all trust` line as `tianon/postgres-upgrade:9.6-to-14` # doesn't do that automatically. - $CONTAINER_TECHNOLOGY run --rm -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -c \ + $CONTAINER_ENGINE run --rm -v sentry-postgres-new:/from -v sentry-postgres:/to alpine ash -c \ "cd /from ; cp -av . /to ; echo 'host all all all trust' >> /to/pg_hba.conf" # Finally, remove the new old volume as we are all in sentry-postgres now. - $CONTAINER_TECHNOLOGY volume rm sentry-postgres-new + $CONTAINER_ENGINE volume rm sentry-postgres-new echo "Re-indexing due to glibc change, this may take a while..." echo "Starting up new PostgreSQL version" $dc up --wait postgres diff --git a/install/wrap-up.sh b/install/wrap-up.sh index 73b529fc0b..31f5ffd7fd 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -6,7 +6,7 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then $dc restart relay $dc exec -T nginx nginx -s reload - $CONTAINER_TECHNOLOGY run --rm --network="${COMPOSE_PROJECT_NAME}_default" alpine ash \ + $CONTAINER_ENGINE run --rm --network="${COMPOSE_PROJECT_NAME}_default" alpine ash \ -c 'while [[ "$(wget -T 1 -q -O- http://web:9000/_health/)" != "ok" ]]; do sleep 0.5; done' # Make sure everything is up. This should only touch relay and nginx From 64c9741b5f2f2a08a489eb601a23e61bf3aa2a95 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 10:04:35 +0200 Subject: [PATCH 03/52] Adds feature flag to enable podman; fixes test runner --- _unit-test/_test_setup.sh | 1 + install/detect-container-engine.sh | 8 +++----- install/parse-cli.sh | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/_unit-test/_test_setup.sh b/_unit-test/_test_setup.sh index 8572dd8a32..4f9f5f7b0f 100644 --- a/_unit-test/_test_setup.sh +++ b/_unit-test/_test_setup.sh @@ -7,6 +7,7 @@ _ORIGIN=$(pwd) rm -rf /tmp/sentry-self-hosted-test-sandbox.* _SANDBOX="$(mktemp -d /tmp/sentry-self-hosted-test-sandbox.XXX)" +source install/detect-container-engine.sh source install/detect-platform.sh docker build -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq diff --git a/install/detect-container-engine.sh b/install/detect-container-engine.sh index 2b16c5ec98..55c99c4ca6 100755 --- a/install/detect-container-engine.sh +++ b/install/detect-container-engine.sh @@ -1,11 +1,9 @@ echo "${_group}Detecting container engine ..." -export CONTAINER_ENGINE="" - -if command -v podman &> /dev/null; then - CONTAINER_ENGINE="podman" +if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]] && command -v podman &> /dev/null; then + export CONTAINER_ENGINE="podman" elif command -v docker &> /dev/null; then - CONTAINER_ENGINE="docker" + export CONTAINER_ENGINE="docker" else echo "FAIL: Neither podman nor docker is installed on the system." exit 1 diff --git a/install/parse-cli.sh b/install/parse-cli.sh index 67f838d391..b342033ca0 100644 --- a/install/parse-cli.sh +++ b/install/parse-cli.sh @@ -29,6 +29,8 @@ Options: --no-report-self-hosted-issues Do not report error and performance data about your self-hosted instance upstream to Sentry. + --container-engine-podman + Use podman as the container engine. EOF } @@ -46,6 +48,7 @@ MINIMIZE_DOWNTIME="${MINIMIZE_DOWNTIME:-}" SKIP_COMMIT_CHECK="${SKIP_COMMIT_CHECK:-}" REPORT_SELF_HOSTED_ISSUES="${REPORT_SELF_HOSTED_ISSUES:-}" SKIP_SSE42_REQUIREMENTS="${SKIP_SSE42_REQUIREMENTS:-}" +CONTAINER_ENGINE_PODMAN="${CONTAINER_ENGINE_PODMAN:-}" while (($#)); do case "$1" in @@ -67,6 +70,7 @@ while (($#)); do --report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=1 ;; --no-report-self-hosted-issues) REPORT_SELF_HOSTED_ISSUES=0 ;; --skip-sse42-requirements) SKIP_SSE42_REQUIREMENTS=1 ;; + --container-engine-podman) CONTAINER_ENGINE_PODMAN=1 ;; --) ;; *) echo "Unexpected argument: $1. Use --help for usage information." From 8034a6e0885b07dbab181dbd48ce74272b6a1b53 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 12:26:38 +0200 Subject: [PATCH 04/52] fix(install): platform detection for amd64 --- install/detect-platform.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 1d28065e51..3a3ed2cee5 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -20,7 +20,7 @@ elif [[ $CONTAINER_ENGINE == "docker" ]]; then fi export DOCKER_ARCH=$($CONTAINER_ENGINE info --format "$FORMAT") -if [[ "$DOCKER_ARCH" = "x86_64" ]]; then +if [[ "$DOCKER_ARCH" = "x86_64" || "$DOCKER_ARCH" = "amd64" ]]; then export DOCKER_PLATFORM="linux/amd64" elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then export DOCKER_PLATFORM="linux/arm64" From 0fca38eb0ec322a1076659df70de6d53270f6025 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 13:43:36 +0200 Subject: [PATCH 05/52] fix(install): Adds separate prox-args for podman build vs. podman-compose build; Substitutes occurences of --- install/dc-detect-version.sh | 5 +++-- install/error-handling.sh | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 0ca5aeb81b..4f47f202d7 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -37,10 +37,11 @@ else dc="$dc_base $NO_ANSI" fi +proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" if [[ "$CONTAINER_ENGINE" == "docker" ]]; then - proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" + proxy_args_dc=$proxy_args elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then - proxy_args="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" + proxy_args_dc="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" fi dcr="$dc run --pull=never --rm" dcb="$dc build $proxy_args" diff --git a/install/error-handling.sh b/install/error-handling.sh index e325a21494..09aa1c2fe1 100644 --- a/install/error-handling.sh +++ b/install/error-handling.sh @@ -27,7 +27,7 @@ send_event() { local breadcrumbs=$5 local fingerprint_value=$( echo -n "$cmd_exit $error_msg $traceback" | - docker run -i --rm busybox md5sum | + $CONTAINER_ENGINE run -i --rm busybox md5sum | cut -d' ' -f1 ) local envelope_file="sentry-envelope-${fingerprint_value}" @@ -151,7 +151,7 @@ fi # Make sure we can use sentry-cli if we need it. if [ "$REPORT_SELF_HOSTED_ISSUES" == 1 ]; then - if ! docker pull getsentry/sentry-cli:latest; then + if ! $CONTAINER_ENGINE pull getsentry/sentry-cli:latest; then echo "Failed to pull sentry-cli, won't report to Sentry after all." export REPORT_SELF_HOSTED_ISSUES=0 fi From d98e2fb7da3ca5887419a2537f96b72c832de96e Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 15:17:18 +0200 Subject: [PATCH 06/52] fix(install): Substitues docker compose --rmi for podman --- install/turn-things-off.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install/turn-things-off.sh b/install/turn-things-off.sh index 270dc4e78c..5cb30c4c07 100644 --- a/install/turn-things-off.sh +++ b/install/turn-things-off.sh @@ -5,7 +5,12 @@ if [[ -n "$MINIMIZE_DOWNTIME" ]]; then $dc rm -fsv $($dc config --services | grep -v -E '^(nginx|relay)$') else # Clean up old stuff and ensure nothing is working while we install/update - $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans + if [ "$CONTAINER_ENGINE" = "docker" ]; then + $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans + elif [ "$CONTAINER_ENGINE" = "podman" ]; then + $dc down -t $STOP_TIMEOUT --remove-orphans + $CONTAINER_ENGINE rmi -f $($CONTAINER_ENGINE images --quiet --filter dangling=true) + fi fi echo "${_endgroup}" From 27e524d30b41ae2abb9de26e5d0ee2ad2af14941 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 15:28:22 +0200 Subject: [PATCH 07/52] fix(install): handling of ps command for docker compose vs. podman-compose --- install/upgrade-clickhouse.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index 3dcb56f189..c1a521fda5 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -1,7 +1,13 @@ echo "${_group}Upgrading Clickhouse ..." # First check to see if user is upgrading by checking for existing clickhouse volume -if $dc ps -a | grep -q clickhouse; then +ps_command="$dc ps" +if [ "$CONTAINER_ENGINE" = "docker" ]; then + # docker compose needs to be run with the -a flag to show all containers + ps_command="$ps_command -a" +fi + +if $ps_command | grep -q clickhouse; then # Start clickhouse if it is not already running $dc up --wait clickhouse From d711b5b8907f9baaa268b613611b7e95dbc20a2d Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Wed, 23 Apr 2025 15:47:14 +0200 Subject: [PATCH 08/52] fix(install): Susbstitutes docker compose --wait for podman --- install/upgrade-clickhouse.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index c1a521fda5..3519e4ded2 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -1,25 +1,39 @@ echo "${_group}Upgrading Clickhouse ..." # First check to see if user is upgrading by checking for existing clickhouse volume -ps_command="$dc ps" if [ "$CONTAINER_ENGINE" = "docker" ]; then # docker compose needs to be run with the -a flag to show all containers ps_command="$ps_command -a" + build_arg="--build-arg" +else + ps_command="$dc ps" + build_arg="--podman-build-args" fi +function start_service_and_wait_ready() { + if [ "$CONTAINER_ENGINE" = "docker" ]; then + $dc up --wait $1 + else + $dc up $1 + while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep $1; do + sleep 2 + done + fi +} + if $ps_command | grep -q clickhouse; then # Start clickhouse if it is not already running - $dc up --wait clickhouse + start_service_and_wait_ready clickhouse # In order to get to 23.8, we need to first upgrade go from 21.8 -> 22.8 -> 23.3 -> 23.8 version=$($dc exec clickhouse clickhouse-client -q 'SELECT version()') if [[ "$version" == "21.8.13.1.altinitystable" || "$version" == "21.8.12.29.altinitydev.arm" ]]; then $dc down clickhouse - $dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:22.8.15.25.altinitystable clickhouse - $dc up --wait clickhouse + $dcb $build_arg BASE_IMAGE=altinity/clickhouse-server:22.8.15.25.altinitystable clickhouse + start_service_and_wait_ready clickhouse $dc down clickhouse - $dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:23.3.19.33.altinitystable clickhouse - $dc up --wait clickhouse + $dcb $build_arg BASE_IMAGE=altinity/clickhouse-server:23.3.19.33.altinitystable clickhouse + start_service_and_wait_ready clickhouse else echo "Detected clickhouse version $version. Skipping upgrades!" fi From 0e5e24e660db9aedfd3bcee56cdc66b6a35da676 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:21:44 +0200 Subject: [PATCH 09/52] fix(install): Substitues occurence of docker run with run --- install/setup-js-sdk-assets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/setup-js-sdk-assets.sh b/install/setup-js-sdk-assets.sh index 51c5e40819..3b5e971f3e 100644 --- a/install/setup-js-sdk-assets.sh +++ b/install/setup-js-sdk-assets.sh @@ -14,7 +14,7 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq - jq="docker run --rm -i sentry-self-hosted-jq-local" + jq="$CONTAINER_ENGINE run --rm -i sentry-self-hosted-jq-local" loader_registry=$($dcr --no-deps --rm -T web cat /usr/src/sentry/src/sentry/loader/_registry.json) # The `loader_registry` should start with "Updating certificates...", we want to delete that and the subsequent ca-certificates related lines. From f89f0c26e17a61483fd73fb162e122e30168f58f Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:26:10 +0200 Subject: [PATCH 10/52] fix(install): docker substitutions --- install/upgrade-clickhouse.sh | 11 ----------- install/upgrade-postgres.sh | 2 +- install/wrap-up.sh | 4 ++-- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index 3519e4ded2..f3df60fa6e 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -10,17 +10,6 @@ else build_arg="--podman-build-args" fi -function start_service_and_wait_ready() { - if [ "$CONTAINER_ENGINE" = "docker" ]; then - $dc up --wait $1 - else - $dc up $1 - while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep $1; do - sleep 2 - done - fi -} - if $ps_command | grep -q clickhouse; then # Start clickhouse if it is not already running start_service_and_wait_ready clickhouse diff --git a/install/upgrade-postgres.sh b/install/upgrade-postgres.sh index ad5fa88bac..6785ae879e 100644 --- a/install/upgrade-postgres.sh +++ b/install/upgrade-postgres.sh @@ -20,7 +20,7 @@ if [[ -n "$($CONTAINER_ENGINE volume ls -q --filter name=sentry-postgres)" && "$ $CONTAINER_ENGINE volume rm sentry-postgres-new echo "Re-indexing due to glibc change, this may take a while..." echo "Starting up new PostgreSQL version" - $dc up --wait postgres + start_service_and_wait_ready postgres # Wait for postgres RETRIES=5 diff --git a/install/wrap-up.sh b/install/wrap-up.sh index 31f5ffd7fd..a5d618d31b 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -2,7 +2,7 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then echo "${_group}Waiting for Sentry to start ..." # Start the whole setup, except nginx and relay. - $dc up --wait --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay)$') + start_service_and_wait_ready --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay)$') $dc restart relay $dc exec -T nginx nginx -s reload @@ -10,7 +10,7 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then -c 'while [[ "$(wget -T 1 -q -O- http://web:9000/_health/)" != "ok" ]]; do sleep 0.5; done' # Make sure everything is up. This should only touch relay and nginx - $dc up --wait + start_service_and_wait_ready $($dc config --services) echo "${_endgroup}" else From 7c886c9dd871b24007da7eabef1e60bd3a852ece Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:27:09 +0200 Subject: [PATCH 11/52] fix(install): substitues docker volume create with correct syntax --- install/create-docker-volumes.sh | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/install/create-docker-volumes.sh b/install/create-docker-volumes.sh index aa8fbd690b..d8caf21cce 100644 --- a/install/create-docker-volumes.sh +++ b/install/create-docker-volumes.sh @@ -1,10 +1,21 @@ echo "${_group}Creating volumes for persistent storage ..." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-clickhouse)." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-data)." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-kafka)." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-postgres)." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-redis)." -echo "Created $($CONTAINER_ENGINE volume create --name=sentry-symbolicator)." +create_volume() { + create_command="$CONTAINER_ENGINE volume create" + if [ "$CONTAINER_ENGINE" = "docker" ]; then + create_command="$create_command --name=$1" + else + create_command="$create_command --ignore $1" + fi + + $create_command +} + +echo "Created $(create_volume sentry-clickhouse)." +echo "Created $(create_volume sentry-data)." +echo "Created $(create_volume sentry-kafka)." +echo "Created $(create_volume sentry-postgres)." +echo "Created $(create_volume sentry-redis)." +echo "Created $(create_volume sentry-symbolicator)." echo "${_endgroup}" From 8039e03760504431df9169ca2b3efced5009fa4d Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:28:13 +0200 Subject: [PATCH 12/52] fix(install): remove dangling images under podman on compose down --- install/turn-things-off.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install/turn-things-off.sh b/install/turn-things-off.sh index 5cb30c4c07..364a17bfc6 100644 --- a/install/turn-things-off.sh +++ b/install/turn-things-off.sh @@ -9,7 +9,11 @@ else $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans elif [ "$CONTAINER_ENGINE" = "podman" ]; then $dc down -t $STOP_TIMEOUT --remove-orphans - $CONTAINER_ENGINE rmi -f $($CONTAINER_ENGINE images --quiet --filter dangling=true) + dangling_images=$($CONTAINER_ENGINE images --quiet --filter dangling=true) + if [ -n "$dangling_images" ]; then + # Remove dangling images + $CONTAINER_ENGINE rmi -f $dangling_images + fi fi fi From 00f4c8129973ea384225f057aca487f69d7903ef Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:29:20 +0200 Subject: [PATCH 13/52] fix(install): Replaces how images are pulled Modifies docker-compose.yml with pull_policy: never, which also works for podman-compose. --- docker-compose.yml | 16 +++++++++++++++ install/dc-detect-version.sh | 32 +++++++++++++++++++++++++++++- install/detect-container-engine.sh | 0 install/update-docker-images.sh | 18 +++++++++++------ 4 files changed, 59 insertions(+), 7 deletions(-) mode change 100755 => 100644 install/detect-container-engine.sh diff --git a/docker-compose.yml b/docker-compose.yml index 75a86e2e59..ca642f77e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,7 @@ x-restart-policy: &restart_policy restart: unless-stopped +x-pull-policy: &pull_policy + pull_policy: never x-depends_on-healthy: &depends_on-healthy condition: service_healthy x-depends_on-default: &depends_on-default @@ -16,6 +18,7 @@ x-healthcheck-defaults: &healthcheck_defaults start_period: 10s x-sentry-defaults: &sentry_defaults <<: *restart_policy + <<: *pull_policy image: sentry-self-hosted-local # Set the platform to build for linux/arm64 when needed on Apple silicon Macs. platform: ${DOCKER_PLATFORM:-} @@ -66,6 +69,7 @@ x-sentry-defaults: &sentry_defaults - "./certificates:/usr/local/share/ca-certificates:ro" x-snuba-defaults: &snuba_defaults <<: *restart_policy + <<: *pull_policy depends_on: clickhouse: <<: *depends_on-healthy @@ -91,6 +95,7 @@ x-snuba-defaults: &snuba_defaults services: smtp: <<: *restart_policy + <<: *pull_policy platform: linux/amd64 image: tianon/exim4 hostname: "${SENTRY_MAIL_HOST:-}" @@ -99,6 +104,7 @@ services: - "sentry-smtp-log:/var/log/exim4" memcached: <<: *restart_policy + <<: *pull_policy image: "memcached:1.6.26-alpine" command: ["-I", "${SENTRY_MAX_EXTERNAL_SOURCEMAP_SIZE:-1M}"] healthcheck: @@ -107,6 +113,7 @@ services: test: echo stats | nc 127.0.0.1 11211 redis: <<: *restart_policy + <<: *pull_policy image: "redis:6.2.14-alpine" healthcheck: <<: *healthcheck_defaults @@ -124,6 +131,7 @@ services: command: ["redis-server", "/usr/local/etc/redis/redis.conf"] postgres: <<: *restart_policy + <<: *pull_policy # Using the same postgres version as Sentry dev for consistency purposes image: "postgres:14.11" healthcheck: @@ -142,6 +150,7 @@ services: - "sentry-postgres:/var/lib/postgresql/data" kafka: <<: *restart_policy + <<: *pull_policy image: "confluentinc/cp-kafka:7.6.1" environment: # https://docs.confluent.io/platform/current/installation/docker/config-reference.html#cp-kakfa-example @@ -179,6 +188,7 @@ services: retries: 30 clickhouse: <<: *restart_policy + <<: *pull_policy image: clickhouse-self-hosted-local build: context: ./clickhouse @@ -306,6 +316,7 @@ services: - feature-complete symbolicator: <<: *restart_policy + <<: *pull_policy image: "$SYMBOLICATOR_IMAGE" volumes: - "sentry-symbolicator:/data" @@ -316,6 +327,7 @@ services: command: run -c /etc/symbolicator/config.yml symbolicator-cleanup: <<: *restart_policy + <<: *pull_policy image: symbolicator-cleanup-self-hosted-local build: context: ./cron @@ -450,6 +462,7 @@ services: command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"' nginx: <<: *restart_policy + <<: *pull_policy ports: - "$SENTRY_BIND:80/tcp" image: "nginx:1.25.4-alpine" @@ -465,6 +478,7 @@ services: - relay relay: <<: *restart_policy + <<: *pull_policy image: "$RELAY_IMAGE" volumes: - type: bind @@ -484,6 +498,7 @@ services: <<: *depends_on-healthy vroom: <<: *restart_policy + <<: *pull_policy image: "$VROOM_IMAGE" environment: SENTRY_KAFKA_BROKERS_PROFILING: "kafka:9092" @@ -499,6 +514,7 @@ services: - feature-complete vroom-cleanup: <<: *restart_policy + <<: *pull_policy image: vroom-cleanup-self-hosted-local build: context: ./cron diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 4f47f202d7..cf5c63b0b1 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -40,11 +40,41 @@ fi proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" if [[ "$CONTAINER_ENGINE" == "docker" ]]; then proxy_args_dc=$proxy_args + dcr="$dc run --pull=never --rm" elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then proxy_args_dc="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" + dcr="$dc run --rm" fi -dcr="$dc run --pull=never --rm" dcb="$dc build $proxy_args" dbuild="$CONTAINER_ENGINE build $proxy_args" +# Utility function to handle --wait with docker and podman +function start_service_and_wait_ready() { + local options=() + local services=() + local found_service=0 + + for arg in "$@"; do + if [[ $found_service -eq 0 && "$arg" == -* ]]; then + options+=("$arg") + else + found_service=1 + services+=("$arg") + fi + done + + if [ "$CONTAINER_ENGINE" = "docker" ]; then + $dc up --wait "${options[@]}" "${services[@]}" + else + $dc up --no-recreate "${options[@]}" "${services[@]}" + for service in "${services[@]}"; do + while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do + sleep 2 + done + done + fi +} + + + echo "${_endgroup}" diff --git a/install/detect-container-engine.sh b/install/detect-container-engine.sh old mode 100755 new mode 100644 diff --git a/install/update-docker-images.sh b/install/update-docker-images.sh index e5d5bc23d2..8882b81cb5 100644 --- a/install/update-docker-images.sh +++ b/install/update-docker-images.sh @@ -1,12 +1,18 @@ echo "${_group}Fetching and updating $CONTAINER_ENGINE images ..." -# We tag locally built images with a '-self-hosted-local' suffix. `docker -# compose pull` tries to pull these too and shows a 404 error on the console -# which is confusing and unnecessary. To overcome this, we add the -# stderr>stdout redirection below and pass it through grep, ignoring all lines -# having this '-onpremise-local' suffix. +if [ "$CONTAINER_ENGINE" = "docker" ]; then + # We tag locally built images with a '-self-hosted-local' suffix. `docker + # compose pull` tries to pull these too and shows a 404 error on the console + # which is confusing and unnecessary. To overcome this, we add the + # stderr>stdout redirection below and pass it through grep, ignoring all lines + # having this '-onpremise-local' suffix. -$dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true + $dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true +else + # podman compose doesn't have the --ignore-pull-failures option, so can just + # run the command normally + $dc pull || true +fi # We may not have the set image on the repo (local images) so allow fails $CONTAINER_ENGINE pull ${SENTRY_IMAGE} || true From b467a5564daa46c3727f5f080f52bce422bf4107 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 09:41:55 +0200 Subject: [PATCH 14/52] fix(install): Substitues up --wait with start_service_and_wait_ready function --- install/set-up-and-migrate-database.sh | 2 +- install/setup-js-sdk-assets.sh | 6 ++++-- sentry-admin.sh | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/install/set-up-and-migrate-database.sh b/install/set-up-and-migrate-database.sh index 2d4e13208e..e73fa7aead 100644 --- a/install/set-up-and-migrate-database.sh +++ b/install/set-up-and-migrate-database.sh @@ -2,7 +2,7 @@ echo "${_group}Setting up / migrating database ..." if [[ -z "${SKIP_SENTRY_MIGRATIONS:-}" ]]; then # Fixes https://github.com/getsentry/self-hosted/issues/2758, where a migration fails due to indexing issue - $dc up --wait postgres + start_service_and_wait_ready postgres os=$($dc exec postgres cat /etc/os-release | grep 'ID=debian') if [[ -z $os ]]; then diff --git a/install/setup-js-sdk-assets.sh b/install/setup-js-sdk-assets.sh index 3b5e971f3e..6283835a8e 100644 --- a/install/setup-js-sdk-assets.sh +++ b/install/setup-js-sdk-assets.sh @@ -12,8 +12,10 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then $dcr --no-deps --rm -v "sentry-nginx-www:/var/www" nginx rm -rf /var/www/js-sdk/* fi - $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq - + if [ -z ${NO_BUILD_LOCALLY:-} ]; then + $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq + fi + jq="$CONTAINER_ENGINE run --rm -i sentry-self-hosted-jq-local" loader_registry=$($dcr --no-deps --rm -T web cat /usr/src/sentry/src/sentry/loader/_registry.json) diff --git a/sentry-admin.sh b/sentry-admin.sh index 386b3d5701..cc7c3f2bdc 100755 --- a/sentry-admin.sh +++ b/sentry-admin.sh @@ -22,8 +22,8 @@ on the host filesystem. Commands that write files should write them to the '/sen # Actual invocation that runs the command in the container. invocation() { - $dc up postgres --wait - $dc up redis --wait + start_service_and_wait_ready postgres + start_service_and_wait_ready redis --wait $dcr --no-deps -v "$VOLUME_MAPPING" -T -e SENTRY_LOG_LEVEL=CRITICAL web "$@" 2>&1 } From b9bff98885896ff1986cf7bd0a457e6e7578899b Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 10:03:52 +0200 Subject: [PATCH 15/52] fix(install): run podman-compose up with --force-recreate --- install/dc-detect-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index cf5c63b0b1..48c771decd 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -66,7 +66,7 @@ function start_service_and_wait_ready() { if [ "$CONTAINER_ENGINE" = "docker" ]; then $dc up --wait "${options[@]}" "${services[@]}" else - $dc up --no-recreate "${options[@]}" "${services[@]}" + $dc up --force-recreate "${options[@]}" "${services[@]}" for service in "${services[@]}"; do while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do sleep 2 From 8185732e1933372c3952450d9acb9471402dec62 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 10:14:13 +0200 Subject: [PATCH 16/52] fix(install): start_service_and_Wait_ready uses daemonized start --- install/dc-detect-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 48c771decd..3b6b570bf3 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -66,7 +66,7 @@ function start_service_and_wait_ready() { if [ "$CONTAINER_ENGINE" = "docker" ]; then $dc up --wait "${options[@]}" "${services[@]}" else - $dc up --force-recreate "${options[@]}" "${services[@]}" + $dc up --force-recreate -d "${options[@]}" "${services[@]}" for service in "${services[@]}"; do while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do sleep 2 From 3bd844c4ddad32db5d4ad6ef0e1482188624dea4 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 10:44:19 +0200 Subject: [PATCH 17/52] fix(install): multiple merge instrtuctions in docker-compose.yml --- docker-compose.yml | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ca642f77e7..ec398fd57c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,8 +17,7 @@ x-healthcheck-defaults: &healthcheck_defaults retries: $HEALTHCHECK_RETRIES start_period: 10s x-sentry-defaults: &sentry_defaults - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: sentry-self-hosted-local # Set the platform to build for linux/arm64 when needed on Apple silicon Macs. platform: ${DOCKER_PLATFORM:-} @@ -68,8 +67,7 @@ x-sentry-defaults: &sentry_defaults - "./geoip:/geoip:ro" - "./certificates:/usr/local/share/ca-certificates:ro" x-snuba-defaults: &snuba_defaults - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] depends_on: clickhouse: <<: *depends_on-healthy @@ -94,8 +92,7 @@ x-snuba-defaults: &snuba_defaults SNUBA_STATSD_PORT: # Example value: 8125 services: smtp: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] platform: linux/amd64 image: tianon/exim4 hostname: "${SENTRY_MAIL_HOST:-}" @@ -103,8 +100,7 @@ services: - "sentry-smtp:/var/spool/exim4" - "sentry-smtp-log:/var/log/exim4" memcached: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "memcached:1.6.26-alpine" command: ["-I", "${SENTRY_MAX_EXTERNAL_SOURCEMAP_SIZE:-1M}"] healthcheck: @@ -112,8 +108,7 @@ services: # From: https://stackoverflow.com/a/31877626/5155484 test: echo stats | nc 127.0.0.1 11211 redis: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "redis:6.2.14-alpine" healthcheck: <<: *healthcheck_defaults @@ -130,8 +125,7 @@ services: hard: 10032 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] postgres: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] # Using the same postgres version as Sentry dev for consistency purposes image: "postgres:14.11" healthcheck: @@ -149,8 +143,7 @@ services: volumes: - "sentry-postgres:/var/lib/postgresql/data" kafka: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "confluentinc/cp-kafka:7.6.1" environment: # https://docs.confluent.io/platform/current/installation/docker/config-reference.html#cp-kakfa-example @@ -187,8 +180,7 @@ services: timeout: 10s retries: 30 clickhouse: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: clickhouse-self-hosted-local build: context: ./clickhouse @@ -315,8 +307,7 @@ services: profiles: - feature-complete symbolicator: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "$SYMBOLICATOR_IMAGE" volumes: - "sentry-symbolicator:/data" @@ -326,8 +317,7 @@ services: target: /etc/symbolicator command: run -c /etc/symbolicator/config.yml symbolicator-cleanup: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: symbolicator-cleanup-self-hosted-local build: context: ./cron @@ -461,8 +451,7 @@ services: entrypoint: "/entrypoint.sh" command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"' nginx: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] ports: - "$SENTRY_BIND:80/tcp" image: "nginx:1.25.4-alpine" @@ -477,8 +466,7 @@ services: - web - relay relay: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "$RELAY_IMAGE" volumes: - type: bind @@ -497,8 +485,7 @@ services: web: <<: *depends_on-healthy vroom: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: "$VROOM_IMAGE" environment: SENTRY_KAFKA_BROKERS_PROFILING: "kafka:9092" @@ -513,8 +500,7 @@ services: profiles: - feature-complete vroom-cleanup: - <<: *restart_policy - <<: *pull_policy + <<: [*restart_policy, *pull_policy] image: vroom-cleanup-self-hosted-local build: context: ./cron From fc3d976ebeda99281a444361cbe32160b9384cca Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Thu, 24 Apr 2025 16:46:52 +0200 Subject: [PATCH 18/52] fix(install): Substitute --force-rm for podman --- install/build-docker-images.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index c793b9ea9c..1e6cd3888e 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -3,10 +3,14 @@ echo "${_group}Building and tagging Docker images ..." echo "" # Build any service that provides the image sentry-self-hosted-local first, # as it is used as the base image for sentry-cleanup-self-hosted-local. -$dcb --force-rm web +dcb_force="$dcb --force-rm" +if [[ "$CONTAINER_ENGINE" == "docker" ]]; then + dcb_force="$dcb --podman-rm-args='--force'" +fi +$dcb_force web # Build each other service individually to localize potential failures better. for service in $($dc config --services); do - $dcb --force-rm "$service" + $dcb_force "$service" done echo "" echo "Docker images built." From 059f0c70df1fe72137c63de296e60c6bc19333ad Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 08:59:57 +0200 Subject: [PATCH 19/52] chore(install): simplify container-engine selection --- _unit-test/_test_setup.sh | 1 - install.sh | 1 - install/dc-detect-version.sh | 10 ++++++++++ install/detect-container-engine.sh | 12 ------------ 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 install/detect-container-engine.sh diff --git a/_unit-test/_test_setup.sh b/_unit-test/_test_setup.sh index 4f9f5f7b0f..8572dd8a32 100644 --- a/_unit-test/_test_setup.sh +++ b/_unit-test/_test_setup.sh @@ -7,7 +7,6 @@ _ORIGIN=$(pwd) rm -rf /tmp/sentry-self-hosted-test-sandbox.* _SANDBOX="$(mktemp -d /tmp/sentry-self-hosted-test-sandbox.XXX)" -source install/detect-container-engine.sh source install/detect-platform.sh docker build -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq diff --git a/install.sh b/install.sh index d6c786153b..23726ce97f 100755 --- a/install.sh +++ b/install.sh @@ -11,7 +11,6 @@ source install/_lib.sh # Pre-flight. No impact yet. source install/parse-cli.sh -source install/detect-container-engine.sh source install/detect-platform.sh source install/dc-detect-version.sh source install/error-handling.sh diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 3b6b570bf3..7f666330b5 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -8,6 +8,16 @@ fi echo "${_group}Initializing Docker|Podman Compose ..." +export CONTAINER_ENGINE="docker" +if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]]; then + if command -v podman &> /dev/null; then + export CONTAINER_ENGINE="podman" + else + echo "FAIL: Podman is not installed on the system." + exit 1 + fi +fi + # To support users that are symlinking to docker-compose dc_base="$(${CONTAINER_ENGINE} compose version --short &>/dev/null && echo "$CONTAINER_ENGINE compose" || echo '')" dc_base_standalone="$(${CONTAINER_ENGINE}-compose version --short &>/dev/null && echo "$CONTAINER_ENGINE-compose" || echo '')" diff --git a/install/detect-container-engine.sh b/install/detect-container-engine.sh deleted file mode 100644 index 55c99c4ca6..0000000000 --- a/install/detect-container-engine.sh +++ /dev/null @@ -1,12 +0,0 @@ -echo "${_group}Detecting container engine ..." - -if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]] && command -v podman &> /dev/null; then - export CONTAINER_ENGINE="podman" -elif command -v docker &> /dev/null; then - export CONTAINER_ENGINE="docker" -else - echo "FAIL: Neither podman nor docker is installed on the system." - exit 1 -fi -echo "Detected container engine: $CONTAINER_ENGINE" -echo "${_endgroup}" \ No newline at end of file From ed1e604fa53960572eca681a7b72060ec3a05efd Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 16:23:55 +0200 Subject: [PATCH 20/52] chore(install): cleanups --- install/build-docker-images.sh | 2 +- install/detect-platform.sh | 4 +--- install/wrap-up.sh | 6 +++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index 1e6cd3888e..7208d4fffb 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -4,7 +4,7 @@ echo "" # Build any service that provides the image sentry-self-hosted-local first, # as it is used as the base image for sentry-cleanup-self-hosted-local. dcb_force="$dcb --force-rm" -if [[ "$CONTAINER_ENGINE" == "docker" ]]; then +if [[ "$CONTAINER_ENGINE" == "podman" ]]; then dcb_force="$dcb --podman-rm-args='--force'" fi $dcb_force web diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 3a3ed2cee5..3e3afa839e 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -12,11 +12,9 @@ echo "${_group}Detecting Docker platform" # linux/amd64 by default due to virtualization. # See https://github.com/docker/cli/issues/3286 for the Docker bug. -FORMAT="" +FORMAT="{{.Architecture}}" if [[ $CONTAINER_ENGINE == "podman" ]]; then FORMAT="{{.Host.Arch}}" -elif [[ $CONTAINER_ENGINE == "docker" ]]; then - FORMAT="{{.Architecture}}" fi export DOCKER_ARCH=$($CONTAINER_ENGINE info --format "$FORMAT") diff --git a/install/wrap-up.sh b/install/wrap-up.sh index a5d618d31b..02bacd3d71 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -22,7 +22,11 @@ else if [[ "${_ENV}" =~ ".env.custom" ]]; then echo " $dc_base --env-file .env --env-file ${_ENV} up --wait" else - echo " $dc_base up --wait" + if [[ "$CONTAINER_ENGINE" == "docker" ]]; then + echo " $dc_base up --wait" + else + echo " $dc_base up --force-recreate -d" + fi fi echo "" echo "-----------------------------------------------------------------" From abb45513bd26801ae0d63cb3b5f5e5bb4da31765 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 18:13:16 +0200 Subject: [PATCH 21/52] Update install/create-docker-volumes.sh Co-authored-by: Burak Yigit Kaya --- install/create-docker-volumes.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/create-docker-volumes.sh b/install/create-docker-volumes.sh index d8caf21cce..fdbecc2288 100644 --- a/install/create-docker-volumes.sh +++ b/install/create-docker-volumes.sh @@ -2,10 +2,10 @@ echo "${_group}Creating volumes for persistent storage ..." create_volume() { create_command="$CONTAINER_ENGINE volume create" - if [ "$CONTAINER_ENGINE" = "docker" ]; then - create_command="$create_command --name=$1" - else + if [ "$CONTAINER_ENGINE" = "podman" ]; then create_command="$create_command --ignore $1" + else + create_command="$create_command --name=$1" fi $create_command From b8a02069d5162fdb99f92a777f253c596fe5a5b1 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 18:13:25 +0200 Subject: [PATCH 22/52] Update install/turn-things-off.sh Co-authored-by: Burak Yigit Kaya --- install/turn-things-off.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/turn-things-off.sh b/install/turn-things-off.sh index 364a17bfc6..49b2b9276f 100644 --- a/install/turn-things-off.sh +++ b/install/turn-things-off.sh @@ -5,15 +5,15 @@ if [[ -n "$MINIMIZE_DOWNTIME" ]]; then $dc rm -fsv $($dc config --services | grep -v -E '^(nginx|relay)$') else # Clean up old stuff and ensure nothing is working while we install/update - if [ "$CONTAINER_ENGINE" = "docker" ]; then - $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans - elif [ "$CONTAINER_ENGINE" = "podman" ]; then + if [ "$CONTAINER_ENGINE" = "podman" ]; then $dc down -t $STOP_TIMEOUT --remove-orphans dangling_images=$($CONTAINER_ENGINE images --quiet --filter dangling=true) if [ -n "$dangling_images" ]; then # Remove dangling images $CONTAINER_ENGINE rmi -f $dangling_images fi + else + $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans fi fi From 5ae7db9c9c2a72be568ccd51d6fc4b5910240bc9 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 18:13:37 +0200 Subject: [PATCH 23/52] Update install/upgrade-clickhouse.sh Co-authored-by: Burak Yigit Kaya --- install/upgrade-clickhouse.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index f3df60fa6e..a1d87c6832 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -1,13 +1,13 @@ echo "${_group}Upgrading Clickhouse ..." # First check to see if user is upgrading by checking for existing clickhouse volume -if [ "$CONTAINER_ENGINE" = "docker" ]; then +if [ "$CONTAINER_ENGINE" = "podman" ]; then + ps_command="$dc ps" + build_arg="--podman-build-args" +else # docker compose needs to be run with the -a flag to show all containers ps_command="$ps_command -a" build_arg="--build-arg" -else - ps_command="$dc ps" - build_arg="--podman-build-args" fi if $ps_command | grep -q clickhouse; then From e2d60eecab10a6fbb714b850bf3e62c551ca4b09 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 18:13:49 +0200 Subject: [PATCH 24/52] Update install/wrap-up.sh Co-authored-by: Burak Yigit Kaya --- install/wrap-up.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/wrap-up.sh b/install/wrap-up.sh index 02bacd3d71..7c198d5ad9 100644 --- a/install/wrap-up.sh +++ b/install/wrap-up.sh @@ -22,10 +22,10 @@ else if [[ "${_ENV}" =~ ".env.custom" ]]; then echo " $dc_base --env-file .env --env-file ${_ENV} up --wait" else - if [[ "$CONTAINER_ENGINE" == "docker" ]]; then - echo " $dc_base up --wait" - else + if [[ "$CONTAINER_ENGINE" == "podman" ]]; then echo " $dc_base up --force-recreate -d" + else + echo " $dc_base up --wait" fi fi echo "" From dd74c39e19e9f4ea0a1a9f47881bb229afd74fff Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 28 Apr 2025 12:50:40 +0100 Subject: [PATCH 25/52] run tests with podman too --- .github/workflows/test.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 672a2802e7..94fcbe74a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,14 +36,25 @@ jobs: integration-test: if: github.repository_owner == 'getsentry' runs-on: ubuntu-22.04 - name: integration test + strategy: + fail-fast: false + matrix: + container_engine: ['docker', 'podman'] + name: integration test (${{ matrix.container_engine }}) env: REPORT_SELF_HOSTED_ISSUES: 0 SELF_HOSTED_TESTING_DSN: ${{ vars.SELF_HOSTED_TESTING_DSN }} + CONTAINER_ENGINE_PODMAN: ${{ matrix.container_engine == 'podman' && '1' || '0' }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Install Podman + if: matrix.container_engine == 'podman' + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends podman + - name: Use action from local checkout uses: './' with: From cfa91574945f5c50c64d2d0c92c94e93f91c6814 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 28 Apr 2025 12:55:07 +0100 Subject: [PATCH 26/52] fix sentry-admin script --- install/dc-detect-version.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 7f666330b5..f70d7e1358 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -1,3 +1,5 @@ +source install/_detect-container-engine.sh + if [ "${GITHUB_ACTIONS:-}" = "true" ]; then _group="::group::" _endgroup="::endgroup::" From 9df8ab44915698034bd3b0bfe7aeaa964e9afc9a Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 28 Apr 2025 16:55:31 +0100 Subject: [PATCH 27/52] add missing renamed file --- install/_detect-container-engine.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 install/_detect-container-engine.sh diff --git a/install/_detect-container-engine.sh b/install/_detect-container-engine.sh new file mode 100755 index 0000000000..4ae351df15 --- /dev/null +++ b/install/_detect-container-engine.sh @@ -0,0 +1,12 @@ +echo "${_group}Detecting container engine ..." + +if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]] && command -v podman &>/dev/null; then + export CONTAINER_ENGINE="podman" +elif command -v docker &>/dev/null; then + export CONTAINER_ENGINE="docker" +else + echo "FAIL: Neither podman nor docker is installed on the system." + exit 1 +fi +echo "Detected container engine: $CONTAINER_ENGINE" +echo "${_endgroup}" From b679f063e4e420dfbee161d4386905cbab18e4a8 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Mon, 28 Apr 2025 18:18:42 +0200 Subject: [PATCH 28/52] chore(install): Switch docker/podman if-else in install/update-docker-images.sh --- install/update-docker-images.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install/update-docker-images.sh b/install/update-docker-images.sh index 8882b81cb5..f3c1b8bcda 100644 --- a/install/update-docker-images.sh +++ b/install/update-docker-images.sh @@ -1,6 +1,10 @@ echo "${_group}Fetching and updating $CONTAINER_ENGINE images ..." -if [ "$CONTAINER_ENGINE" = "docker" ]; then +if [ "$CONTAINER_ENGINE" = "podman" ]; then + # podman compose doesn't have the --ignore-pull-failures option, so can just + # run the command normally + $dc pull || true +else # We tag locally built images with a '-self-hosted-local' suffix. `docker # compose pull` tries to pull these too and shows a 404 error on the console # which is confusing and unnecessary. To overcome this, we add the @@ -8,10 +12,6 @@ if [ "$CONTAINER_ENGINE" = "docker" ]; then # having this '-onpremise-local' suffix. $dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true -else - # podman compose doesn't have the --ignore-pull-failures option, so can just - # run the command normally - $dc pull || true fi # We may not have the set image on the repo (local images) so allow fails From 400e4eab8cbc50210e8200a3cf33c0af9ae00cba Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Mon, 28 Apr 2025 17:19:55 +0100 Subject: [PATCH 29/52] fix import place --- install/dc-detect-version.sh | 6 +----- install/detect-platform.sh | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index f70d7e1358..74d5b54cbe 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -1,5 +1,3 @@ -source install/_detect-container-engine.sh - if [ "${GITHUB_ACTIONS:-}" = "true" ]; then _group="::group::" _endgroup="::endgroup::" @@ -12,7 +10,7 @@ echo "${_group}Initializing Docker|Podman Compose ..." export CONTAINER_ENGINE="docker" if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]]; then - if command -v podman &> /dev/null; then + if command -v podman &>/dev/null; then export CONTAINER_ENGINE="podman" else echo "FAIL: Podman is not installed on the system." @@ -87,6 +85,4 @@ function start_service_and_wait_ready() { fi } - - echo "${_endgroup}" diff --git a/install/detect-platform.sh b/install/detect-platform.sh index 3e3afa839e..9009f79b63 100644 --- a/install/detect-platform.sh +++ b/install/detect-platform.sh @@ -1,3 +1,5 @@ +source install/_detect-container-engine.sh + echo "${_group}Detecting Docker platform" # Sentry SaaS uses stock Yandex ClickHouse, but they don't provide images that From 5abf5a7affb1f82d137ba3a90c586fda03341367 Mon Sep 17 00:00:00 2001 From: Daniel Bunte Date: Tue, 29 Apr 2025 10:30:13 +0200 Subject: [PATCH 30/52] chore(install): fixes from review --- docker-compose.yml | 16 ++++++++-------- install/setup-js-sdk-assets.sh | 4 +--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ec398fd57c..761d41997b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -92,7 +92,7 @@ x-snuba-defaults: &snuba_defaults SNUBA_STATSD_PORT: # Example value: 8125 services: smtp: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] platform: linux/amd64 image: tianon/exim4 hostname: "${SENTRY_MAIL_HOST:-}" @@ -100,7 +100,7 @@ services: - "sentry-smtp:/var/spool/exim4" - "sentry-smtp-log:/var/log/exim4" memcached: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] image: "memcached:1.6.26-alpine" command: ["-I", "${SENTRY_MAX_EXTERNAL_SOURCEMAP_SIZE:-1M}"] healthcheck: @@ -108,7 +108,7 @@ services: # From: https://stackoverflow.com/a/31877626/5155484 test: echo stats | nc 127.0.0.1 11211 redis: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] image: "redis:6.2.14-alpine" healthcheck: <<: *healthcheck_defaults @@ -125,7 +125,7 @@ services: hard: 10032 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] postgres: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] # Using the same postgres version as Sentry dev for consistency purposes image: "postgres:14.11" healthcheck: @@ -143,7 +143,7 @@ services: volumes: - "sentry-postgres:/var/lib/postgresql/data" kafka: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] image: "confluentinc/cp-kafka:7.6.1" environment: # https://docs.confluent.io/platform/current/installation/docker/config-reference.html#cp-kakfa-example @@ -451,7 +451,7 @@ services: entrypoint: "/entrypoint.sh" command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"' nginx: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] ports: - "$SENTRY_BIND:80/tcp" image: "nginx:1.25.4-alpine" @@ -466,7 +466,7 @@ services: - web - relay relay: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] image: "$RELAY_IMAGE" volumes: - type: bind @@ -485,7 +485,7 @@ services: web: <<: *depends_on-healthy vroom: - <<: [*restart_policy, *pull_policy] + <<: [*restart_policy] image: "$VROOM_IMAGE" environment: SENTRY_KAFKA_BROKERS_PROFILING: "kafka:9092" diff --git a/install/setup-js-sdk-assets.sh b/install/setup-js-sdk-assets.sh index 6283835a8e..0d789570a7 100644 --- a/install/setup-js-sdk-assets.sh +++ b/install/setup-js-sdk-assets.sh @@ -12,9 +12,7 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then $dcr --no-deps --rm -v "sentry-nginx-www:/var/www" nginx rm -rf /var/www/js-sdk/* fi - if [ -z ${NO_BUILD_LOCALLY:-} ]; then - $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq - fi + $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq jq="$CONTAINER_ENGINE run --rm -i sentry-self-hosted-jq-local" From cb54be224e7d1a4cc0e466c7baa85d53895c4be7 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:07:20 +0100 Subject: [PATCH 31/52] fix unbound variable error --- install/upgrade-clickhouse.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index a1d87c6832..384e2b5b27 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -1,13 +1,13 @@ echo "${_group}Upgrading Clickhouse ..." +# docker compose needs to be run with the -a flag to show all containers +ps_command="$ps_command -a" +build_arg="--build-arg" + # First check to see if user is upgrading by checking for existing clickhouse volume if [ "$CONTAINER_ENGINE" = "podman" ]; then ps_command="$dc ps" build_arg="--podman-build-args" -else - # docker compose needs to be run with the -a flag to show all containers - ps_command="$ps_command -a" - build_arg="--build-arg" fi if $ps_command | grep -q clickhouse; then From 6416fa652328218e29a2723ee1017b9874e79130 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:10:21 +0100 Subject: [PATCH 32/52] remove incorrect pull_policy definitions --- docker-compose.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 761d41997b..268720b63d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -67,7 +67,7 @@ x-sentry-defaults: &sentry_defaults - "./geoip:/geoip:ro" - "./certificates:/usr/local/share/ca-certificates:ro" x-snuba-defaults: &snuba_defaults - <<: [*restart_policy, *pull_policy] + <<: *restart_policy depends_on: clickhouse: <<: *depends_on-healthy @@ -92,7 +92,7 @@ x-snuba-defaults: &snuba_defaults SNUBA_STATSD_PORT: # Example value: 8125 services: smtp: - <<: [*restart_policy] + <<: *restart_policy platform: linux/amd64 image: tianon/exim4 hostname: "${SENTRY_MAIL_HOST:-}" @@ -100,7 +100,7 @@ services: - "sentry-smtp:/var/spool/exim4" - "sentry-smtp-log:/var/log/exim4" memcached: - <<: [*restart_policy] + <<: *restart_policy image: "memcached:1.6.26-alpine" command: ["-I", "${SENTRY_MAX_EXTERNAL_SOURCEMAP_SIZE:-1M}"] healthcheck: @@ -108,7 +108,7 @@ services: # From: https://stackoverflow.com/a/31877626/5155484 test: echo stats | nc 127.0.0.1 11211 redis: - <<: [*restart_policy] + <<: *restart_policy image: "redis:6.2.14-alpine" healthcheck: <<: *healthcheck_defaults @@ -125,7 +125,7 @@ services: hard: 10032 command: ["redis-server", "/usr/local/etc/redis/redis.conf"] postgres: - <<: [*restart_policy] + <<: *restart_policy # Using the same postgres version as Sentry dev for consistency purposes image: "postgres:14.11" healthcheck: @@ -143,7 +143,7 @@ services: volumes: - "sentry-postgres:/var/lib/postgresql/data" kafka: - <<: [*restart_policy] + <<: *restart_policy image: "confluentinc/cp-kafka:7.6.1" environment: # https://docs.confluent.io/platform/current/installation/docker/config-reference.html#cp-kakfa-example @@ -307,7 +307,7 @@ services: profiles: - feature-complete symbolicator: - <<: [*restart_policy, *pull_policy] + <<: *restart_policy image: "$SYMBOLICATOR_IMAGE" volumes: - "sentry-symbolicator:/data" @@ -451,7 +451,7 @@ services: entrypoint: "/entrypoint.sh" command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"' nginx: - <<: [*restart_policy] + <<: *restart_policy ports: - "$SENTRY_BIND:80/tcp" image: "nginx:1.25.4-alpine" @@ -466,7 +466,7 @@ services: - web - relay relay: - <<: [*restart_policy] + <<: *restart_policy image: "$RELAY_IMAGE" volumes: - type: bind @@ -485,7 +485,7 @@ services: web: <<: *depends_on-healthy vroom: - <<: [*restart_policy] + <<: *restart_policy image: "$VROOM_IMAGE" environment: SENTRY_KAFKA_BROKERS_PROFILING: "kafka:9092" From 43f5431bfdbe89b4a10c7dbd97cb437d0a3e4f38 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:14:59 +0100 Subject: [PATCH 33/52] lol --- install/upgrade-clickhouse.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install/upgrade-clickhouse.sh b/install/upgrade-clickhouse.sh index 384e2b5b27..93456b8ddb 100644 --- a/install/upgrade-clickhouse.sh +++ b/install/upgrade-clickhouse.sh @@ -1,13 +1,13 @@ echo "${_group}Upgrading Clickhouse ..." -# docker compose needs to be run with the -a flag to show all containers -ps_command="$ps_command -a" -build_arg="--build-arg" - # First check to see if user is upgrading by checking for existing clickhouse volume if [ "$CONTAINER_ENGINE" = "podman" ]; then ps_command="$dc ps" build_arg="--podman-build-args" +else + # docker compose needs to be run with the -a flag to show all containers + ps_command="$dc ps -a" + build_arg="--build-arg" fi if $ps_command | grep -q clickhouse; then From 09f54a0162240bc946a6811bfeb5249a2999757e Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:26:52 +0100 Subject: [PATCH 34/52] install podman-compose too? --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94fcbe74a4..069a21d369 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,6 +54,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends podman + pip3 install --user podman-compose - name: Use action from local checkout uses: './' From 257dc2d57ec3a5f023e54fff92a3788a7932e03e Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:32:54 +0100 Subject: [PATCH 35/52] sigh, try using brew to install --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 069a21d369..83a02d67c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,9 +52,7 @@ jobs: - name: Install Podman if: matrix.container_engine == 'podman' run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends podman - pip3 install --user podman-compose + brew install podman - name: Use action from local checkout uses: './' From 7259d2746730504adf6498d0ec12fab0ca73a8a5 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:35:22 +0100 Subject: [PATCH 36/52] shfmt --- install/_detect-container-engine.sh | 8 ++++---- install/setup-js-sdk-assets.sh | 2 +- install/turn-things-off.sh | 2 +- install/update-docker-images.sh | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/install/_detect-container-engine.sh b/install/_detect-container-engine.sh index 4ae351df15..7fc23de2e2 100755 --- a/install/_detect-container-engine.sh +++ b/install/_detect-container-engine.sh @@ -1,12 +1,12 @@ echo "${_group}Detecting container engine ..." if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]] && command -v podman &>/dev/null; then - export CONTAINER_ENGINE="podman" + export CONTAINER_ENGINE="podman" elif command -v docker &>/dev/null; then - export CONTAINER_ENGINE="docker" + export CONTAINER_ENGINE="docker" else - echo "FAIL: Neither podman nor docker is installed on the system." - exit 1 + echo "FAIL: Neither podman nor docker is installed on the system." + exit 1 fi echo "Detected container engine: $CONTAINER_ENGINE" echo "${_endgroup}" diff --git a/install/setup-js-sdk-assets.sh b/install/setup-js-sdk-assets.sh index 0d789570a7..3b5e971f3e 100644 --- a/install/setup-js-sdk-assets.sh +++ b/install/setup-js-sdk-assets.sh @@ -13,7 +13,7 @@ if [[ "${SETUP_JS_SDK_ASSETS:-}" == "1" ]]; then fi $dbuild -t sentry-self-hosted-jq-local --platform="$DOCKER_PLATFORM" jq - + jq="$CONTAINER_ENGINE run --rm -i sentry-self-hosted-jq-local" loader_registry=$($dcr --no-deps --rm -T web cat /usr/src/sentry/src/sentry/loader/_registry.json) diff --git a/install/turn-things-off.sh b/install/turn-things-off.sh index 49b2b9276f..1c70ce392c 100644 --- a/install/turn-things-off.sh +++ b/install/turn-things-off.sh @@ -13,7 +13,7 @@ else $CONTAINER_ENGINE rmi -f $dangling_images fi else - $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans + $dc down -t $STOP_TIMEOUT --rmi local --remove-orphans fi fi diff --git a/install/update-docker-images.sh b/install/update-docker-images.sh index f3c1b8bcda..c6b2b327fa 100644 --- a/install/update-docker-images.sh +++ b/install/update-docker-images.sh @@ -1,17 +1,17 @@ echo "${_group}Fetching and updating $CONTAINER_ENGINE images ..." if [ "$CONTAINER_ENGINE" = "podman" ]; then - # podman compose doesn't have the --ignore-pull-failures option, so can just - # run the command normally - $dc pull || true + # podman compose doesn't have the --ignore-pull-failures option, so can just + # run the command normally + $dc pull || true else - # We tag locally built images with a '-self-hosted-local' suffix. `docker - # compose pull` tries to pull these too and shows a 404 error on the console - # which is confusing and unnecessary. To overcome this, we add the - # stderr>stdout redirection below and pass it through grep, ignoring all lines - # having this '-onpremise-local' suffix. + # We tag locally built images with a '-self-hosted-local' suffix. `docker + # compose pull` tries to pull these too and shows a 404 error on the console + # which is confusing and unnecessary. To overcome this, we add the + # stderr>stdout redirection below and pass it through grep, ignoring all lines + # having this '-onpremise-local' suffix. - $dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true + $dc pull --ignore-pull-failures 2>&1 | grep -v -- -self-hosted-local || true fi # We may not have the set image on the repo (local images) so allow fails From 705a8b70654c3fc74a0a29e0b6a93b72f94c3069 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:37:00 +0100 Subject: [PATCH 37/52] sigh... --- install/_detect-container-engine.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 install/_detect-container-engine.sh diff --git a/install/_detect-container-engine.sh b/install/_detect-container-engine.sh old mode 100755 new mode 100644 From 8e6e1166e59e4d0ffec4c33116f51a15deb1e735 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:40:53 +0100 Subject: [PATCH 38/52] podman install.... --- .github/workflows/test.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83a02d67c5..aedb96b20e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,13 @@ jobs: - name: Install Podman if: matrix.container_engine == 'podman' run: | - brew install podman + curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/Release.key \ + | gpg --dearmor \ + | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null + echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] \ + https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/ /" \ + | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null + sudo apt-get -q update - name: Use action from local checkout uses: './' From 7d7f1c24860ef2e72949e1a1578c451e7d8eb104 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:43:05 +0100 Subject: [PATCH 39/52] use ubuntu latest :facepalm: --- .github/workflows/test.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aedb96b20e..b3aebffebb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ defaults: jobs: unit-test: if: github.repository_owner == 'getsentry' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest name: "unit tests" steps: - name: Checkout @@ -35,7 +35,7 @@ jobs: integration-test: if: github.repository_owner == 'getsentry' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -52,13 +52,8 @@ jobs: - name: Install Podman if: matrix.container_engine == 'podman' run: | - curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/Release.key \ - | gpg --dearmor \ - | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] \ - https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/ /" \ - | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null - sudo apt-get -q update + sudo apt-get update + sudo apt-get install -y --no-install-recommends podman - name: Use action from local checkout uses: './' From ffe08d8003fe188ae7201a5d1a95fab1f0d7725f Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 13:48:07 +0100 Subject: [PATCH 40/52] bump podman version requirement one notch down --- install/_min-requirements.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/_min-requirements.sh b/install/_min-requirements.sh index 3f764b8cf3..36c5dc0f62 100644 --- a/install/_min-requirements.sh +++ b/install/_min-requirements.sh @@ -2,7 +2,7 @@ MIN_DOCKER_VERSION='19.03.6' MIN_COMPOSE_VERSION='2.32.2' -MIN_PODMAN_VERSION='4.9.4' +MIN_PODMAN_VERSION='4.9.3' MIN_PODMAN_COMPOSE_VERSION='1.3.0' # 16 GB minimum host RAM, but there'll be some overhead outside of what From 2544ec86146dfc47a4ac965c18ddc2714e24a276 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 14:04:50 +0100 Subject: [PATCH 41/52] install podman-compose too --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b3aebffebb..e732265885 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,6 +54,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends podman + pip3 install --user podman-compose - name: Use action from local checkout uses: './' From 06e6e24a9b5c54f228777021daf146c23125e19b Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 14:13:55 +0100 Subject: [PATCH 42/52] sigh... --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e732265885..58b6f282e7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,6 +55,7 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends podman pip3 install --user podman-compose + echo "PODMAN_COMPOSE_PROVIDER=podman-compose" >> $GITHUB_ENV - name: Use action from local checkout uses: './' From 8f0ba1a4c3fc3c009ae78165135cc4b4a8bbb524 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 14:21:44 +0100 Subject: [PATCH 43/52] moar swaps --- install/dc-detect-version.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 74d5b54cbe..21418b4415 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -35,10 +35,10 @@ if [[ -z "$COMPOSE_VERSION" ]] || [[ -n "$STANDALONE_COMPOSE_VERSION" ]] && ! ve dc_base="$dc_base_standalone" fi -if [[ "$CONTAINER_ENGINE" == "docker" ]]; then - NO_ANSI="--ansi never" -elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then +if [[ "$CONTAINER_ENGINE" == "podman" ]]; then NO_ANSI="--no-ansi" +else + NO_ANSI="--ansi never" fi if [[ "$(basename $0)" = "install.sh" ]]; then @@ -48,12 +48,12 @@ else fi proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" -if [[ "$CONTAINER_ENGINE" == "docker" ]]; then - proxy_args_dc=$proxy_args - dcr="$dc run --pull=never --rm" -elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then +if [[ "$CONTAINER_ENGINE" == "podman" ]]; then proxy_args_dc="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" dcr="$dc run --rm" +else + proxy_args_dc=$proxy_args + dcr="$dc run --pull=never --rm" fi dcb="$dc build $proxy_args" dbuild="$CONTAINER_ENGINE build $proxy_args" @@ -73,15 +73,15 @@ function start_service_and_wait_ready() { fi done - if [ "$CONTAINER_ENGINE" = "docker" ]; then - $dc up --wait "${options[@]}" "${services[@]}" - else + if [ "$CONTAINER_ENGINE" = "podman" ]; then $dc up --force-recreate -d "${options[@]}" "${services[@]}" for service in "${services[@]}"; do while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do sleep 2 done done + else + $dc up --wait "${options[@]}" "${services[@]}" fi } From ab342b9d8c94de1438c1efa021e7a956c0879f06 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 14:25:23 +0100 Subject: [PATCH 44/52] latest podman-compose --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 58b6f282e7..e70a9bb461 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,7 +54,9 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends podman - pip3 install --user podman-compose + # TODO: Replace below with podman-compose + # We need this commit to be able to work: https://github.com/containers/podman-compose/commit/8206cc3ea277eee6c2e87d4cd66eba8eae3d44eb + pip3 install --user https://github.com/containers/podman-compose/archive/main.tar.gz echo "PODMAN_COMPOSE_PROVIDER=podman-compose" >> $GITHUB_ENV - name: Use action from local checkout From 1973cb0b37964b0af06fb3200b8b3a9fd4f2ef7f Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Tue, 29 Apr 2025 14:46:27 +0100 Subject: [PATCH 45/52] silence podman compose a bit --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e70a9bb461..cd821e67a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,6 +58,7 @@ jobs: # We need this commit to be able to work: https://github.com/containers/podman-compose/commit/8206cc3ea277eee6c2e87d4cd66eba8eae3d44eb pip3 install --user https://github.com/containers/podman-compose/archive/main.tar.gz echo "PODMAN_COMPOSE_PROVIDER=podman-compose" >> $GITHUB_ENV + echo "PODMAN_COMPOSE_WARNING_LOGS=false" >> $GITHUB_ENV - name: Use action from local checkout uses: './' From 69e671d443c075387bc1764f36a45fab676b4a46 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 14:32:24 +0100 Subject: [PATCH 46/52] add --in-pod=false to dcr --- install/dc-detect-version.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index 21418b4415..c387232e76 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -53,7 +53,10 @@ if [[ "$CONTAINER_ENGINE" == "podman" ]]; then dcr="$dc run --rm" else proxy_args_dc=$proxy_args - dcr="$dc run --pull=never --rm" + # Disable pod creation as these are one-off commands and creating a pod + # prints its pod id to stdout which is messing with the output that we + # rely on various places such as configuration generation + dcr="$dc --in-pod=false run --rm" fi dcb="$dc build $proxy_args" dbuild="$CONTAINER_ENGINE build $proxy_args" From dc4c1dbf8008c4264a9e9b722f1aed5754e004ac Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 14:36:30 +0100 Subject: [PATCH 47/52] lol, wrong line --- install/dc-detect-version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install/dc-detect-version.sh b/install/dc-detect-version.sh index c387232e76..165145c9d1 100644 --- a/install/dc-detect-version.sh +++ b/install/dc-detect-version.sh @@ -50,13 +50,13 @@ fi proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}" if [[ "$CONTAINER_ENGINE" == "podman" ]]; then proxy_args_dc="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}" - dcr="$dc run --rm" -else - proxy_args_dc=$proxy_args # Disable pod creation as these are one-off commands and creating a pod # prints its pod id to stdout which is messing with the output that we # rely on various places such as configuration generation dcr="$dc --in-pod=false run --rm" +else + proxy_args_dc=$proxy_args + dcr="$dc run --pull=never --rm" fi dcb="$dc build $proxy_args" dbuild="$CONTAINER_ENGINE build $proxy_args" From 485c2641908c824fcc2b910a2d426d8e938675ef Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 14:42:22 +0100 Subject: [PATCH 48/52] try to fix force rm --- install/build-docker-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index 7208d4fffb..e764a16b35 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -5,7 +5,7 @@ echo "" # as it is used as the base image for sentry-cleanup-self-hosted-local. dcb_force="$dcb --force-rm" if [[ "$CONTAINER_ENGINE" == "podman" ]]; then - dcb_force="$dcb --podman-rm-args='--force'" + dcb_force="$dcb '--podman-rm-args=--force'" fi $dcb_force web # Build each other service individually to localize potential failures better. From fe231a4eff19b0a2ff189284cb8d0799ef79340d Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 20:54:40 +0100 Subject: [PATCH 49/52] try no quotes at all --- install/build-docker-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index e764a16b35..8559f47465 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -5,7 +5,7 @@ echo "" # as it is used as the base image for sentry-cleanup-self-hosted-local. dcb_force="$dcb --force-rm" if [[ "$CONTAINER_ENGINE" == "podman" ]]; then - dcb_force="$dcb '--podman-rm-args=--force'" + dcb_force="$dcb --podman-rm-args=--force" fi $dcb_force web # Build each other service individually to localize potential failures better. From ca4055731a8612b3c266930c646ee7aa2252d3be Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 21:15:19 +0100 Subject: [PATCH 50/52] well, it should be --podman-build --- install/build-docker-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index 8559f47465..4a2438f62c 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -5,7 +5,7 @@ echo "" # as it is used as the base image for sentry-cleanup-self-hosted-local. dcb_force="$dcb --force-rm" if [[ "$CONTAINER_ENGINE" == "podman" ]]; then - dcb_force="$dcb --podman-rm-args=--force" + dcb_force="$dcb --podman-build-args=--force" fi $dcb_force web # Build each other service individually to localize potential failures better. From dbe912dc72bf0dba706557f841ada496328edd2e Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 22:16:47 +0100 Subject: [PATCH 51/52] we don't need this as default is true --- install/build-docker-images.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index 4a2438f62c..9bdd55b94d 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -5,7 +5,7 @@ echo "" # as it is used as the base image for sentry-cleanup-self-hosted-local. dcb_force="$dcb --force-rm" if [[ "$CONTAINER_ENGINE" == "podman" ]]; then - dcb_force="$dcb --podman-build-args=--force" + dcb_force="$dcb" fi $dcb_force web # Build each other service individually to localize potential failures better. From a2792f714f0c985958f906b753ecc2ce1f353c85 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 7 May 2025 22:18:21 +0100 Subject: [PATCH 52/52] --force-rm is no longer anyway --- install/build-docker-images.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/install/build-docker-images.sh b/install/build-docker-images.sh index 9bdd55b94d..dce4c43ca4 100644 --- a/install/build-docker-images.sh +++ b/install/build-docker-images.sh @@ -3,14 +3,10 @@ echo "${_group}Building and tagging Docker images ..." echo "" # Build any service that provides the image sentry-self-hosted-local first, # as it is used as the base image for sentry-cleanup-self-hosted-local. -dcb_force="$dcb --force-rm" -if [[ "$CONTAINER_ENGINE" == "podman" ]]; then - dcb_force="$dcb" -fi -$dcb_force web +$dcb web # Build each other service individually to localize potential failures better. for service in $($dc config --services); do - $dcb_force "$service" + $dcb "$service" done echo "" echo "Docker images built."