Skip to content

feat(install): Adds support for podman(compose) #3673

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d87c155
feat(install): Adds support for podman(compose), while maintaining co…
Apr 22, 2025
cd24311
Renames container-technology -> container-engine
Apr 23, 2025
64c9741
Adds feature flag to enable podman; fixes test runner
Apr 23, 2025
8034a6e
fix(install): platform detection for amd64
Apr 23, 2025
0fca38e
fix(install): Adds separate prox-args for podman build vs. podman-com…
Apr 23, 2025
d98e2fb
fix(install): Substitues docker compose --rmi for podman
Apr 23, 2025
27e524d
fix(install): handling of ps command for docker compose vs. podman-co…
Apr 23, 2025
d711b5b
fix(install): Susbstitutes docker compose --wait for podman
Apr 23, 2025
0e5e24e
fix(install): Substitues occurence of docker run with run
Apr 24, 2025
f89f0c2
fix(install): docker substitutions
Apr 24, 2025
7c886c9
fix(install): substitues docker volume create with correct syntax
Apr 24, 2025
8039e03
fix(install): remove dangling images under podman on compose down
Apr 24, 2025
00f4c81
fix(install): Replaces how images are pulled
Apr 24, 2025
b467a55
fix(install): Substitues up <service> --wait with start_service_and_…
Apr 24, 2025
b9bff98
fix(install): run podman-compose up with --force-recreate
Apr 24, 2025
8185732
fix(install): start_service_and_Wait_ready uses daemonized start
Apr 24, 2025
3bd844c
fix(install): multiple merge instrtuctions in docker-compose.yml
Apr 24, 2025
fc3d976
fix(install): Substitute --force-rm for podman
Apr 24, 2025
059f0c7
chore(install): simplify container-engine selection
Apr 28, 2025
ed1e604
chore(install): cleanups
Apr 28, 2025
abb4551
Update install/create-docker-volumes.sh
DuncanConroy Apr 28, 2025
b8a0206
Update install/turn-things-off.sh
DuncanConroy Apr 28, 2025
5ae7db9
Update install/upgrade-clickhouse.sh
DuncanConroy Apr 28, 2025
e2d60ee
Update install/wrap-up.sh
DuncanConroy Apr 28, 2025
dd74c39
run tests with podman too
BYK Apr 28, 2025
cfa9157
fix sentry-admin script
BYK Apr 28, 2025
9df8ab4
add missing renamed file
BYK Apr 28, 2025
b679f06
chore(install): Switch docker/podman if-else in install/update-docker…
Apr 28, 2025
400e4ea
fix import place
BYK Apr 28, 2025
5abf5a7
chore(install): fixes from review
Apr 29, 2025
cb54be2
fix unbound variable error
BYK Apr 29, 2025
6416fa6
remove incorrect pull_policy definitions
BYK Apr 29, 2025
43f5431
lol
BYK Apr 29, 2025
09f54a0
install podman-compose too?
BYK Apr 29, 2025
257dc2d
sigh, try using brew to install
BYK Apr 29, 2025
7259d27
shfmt
BYK Apr 29, 2025
705a8b7
sigh...
BYK Apr 29, 2025
8e6e116
podman install....
BYK Apr 29, 2025
7d7f1c2
use ubuntu latest :facepalm:
BYK Apr 29, 2025
ffe08d8
bump podman version requirement one notch down
BYK Apr 29, 2025
2544ec8
install podman-compose too
BYK Apr 29, 2025
06e6e24
sigh...
BYK Apr 29, 2025
8f0ba1a
moar swaps
BYK Apr 29, 2025
ab342b9
latest podman-compose
BYK Apr 29, 2025
1973cb0
silence podman compose a bit
BYK Apr 29, 2025
a61a7a5
Merge branch 'master' into pr3673
BYK May 7, 2025
69e671d
add --in-pod=false to dcr
BYK May 7, 2025
dc4c1db
lol, wrong line
BYK May 7, 2025
485c264
try to fix force rm
BYK May 7, 2025
fe231a4
try no quotes at all
BYK May 7, 2025
ca40557
well, it should be --podman-build
BYK May 7, 2025
dbe912d
we don't need this as default is true
BYK May 7, 2025
a2792f7
--force-rm is no longer anyway
BYK May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions install/_min-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 26 additions & 16 deletions install/check-minimum-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions install/create-docker-volumes.sh
Original file line number Diff line number Diff line change
@@ -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}"
27 changes: 19 additions & 8 deletions install/dc-detect-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}"
14 changes: 14 additions & 0 deletions install/detect-container-technology.sh
Original file line number Diff line number Diff line change
@@ -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}"
10 changes: 6 additions & 4 deletions install/detect-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions install/error-handling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion install/geoip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion install/parse-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ show_help() {
cat <<EOF
Usage: $0 [options]

Install Sentry with \`docker compose\`.
Install Sentry with \`docker|podman compose\`.

Options:
-h, --help Show this message and exit.
Expand Down
6 changes: 3 additions & 3 deletions install/update-docker-images.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
echo "${_group}Fetching and updating Docker images ..."
echo "${_group}Fetching and updating $CONTAINER_TECHNOLOGY 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.

$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}"
14 changes: 7 additions & 7 deletions install/upgrade-postgres.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion install/wrap-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading