Skip to content

Commit abe34d0

Browse files
authored
feat(install): Adds support for podman(compose) (#3673)
1 parent d696c20 commit abe34d0

21 files changed

+224
-79
lines changed

.github/workflows/test.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,30 @@ jobs:
4040
if: github.repository_owner == 'getsentry'
4141
runs-on: ${{ matrix.os }}
4242
strategy:
43+
fail-fast: false
4344
matrix:
4445
os: [ubuntu-24.04, ubuntu-24.04-arm]
45-
name: ${{ matrix.os == 'ubuntu-24.04-arm' && 'integration test (arm64)' || 'integration test' }}
46+
container_engine: ['docker'] # TODO: add 'podman' into the list
47+
name: ${{ matrix.os == 'ubuntu-24.04-arm' && (matrix.container_engine == 'docker' && 'integration test (arm64)' || 'integration test (arm64 podman)') || (matrix.container_engine == 'docker' && 'integration test' || 'integration test (podman)') }}
4648
env:
4749
REPORT_SELF_HOSTED_ISSUES: 0
4850
SELF_HOSTED_TESTING_DSN: ${{ vars.SELF_HOSTED_TESTING_DSN }}
51+
CONTAINER_ENGINE_PODMAN: ${{ matrix.container_engine == 'podman' && '1' || '0' }}
4952
steps:
5053
- name: Checkout
5154
uses: actions/checkout@v4
5255

56+
- name: Install Podman
57+
if: matrix.container_engine == 'podman'
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y --no-install-recommends podman
61+
# TODO: Replace below with podman-compose
62+
# We need this commit to be able to work: https://github.com/containers/podman-compose/commit/8206cc3ea277eee6c2e87d4cd66eba8eae3d44eb
63+
pip3 install --user https://github.com/containers/podman-compose/archive/main.tar.gz
64+
echo "PODMAN_COMPOSE_PROVIDER=podman-compose" >> $GITHUB_ENV
65+
echo "PODMAN_COMPOSE_WARNING_LOGS=false" >> $GITHUB_ENV
66+
5367
- name: Use action from local checkout
5468
uses: './'
5569
with:

docker-compose.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
x-restart-policy: &restart_policy
22
restart: unless-stopped
3+
x-pull-policy: &pull_policy
4+
pull_policy: never
35
x-depends_on-healthy: &depends_on-healthy
46
condition: service_healthy
57
x-depends_on-default: &depends_on-default
@@ -15,7 +17,7 @@ x-healthcheck-defaults: &healthcheck_defaults
1517
retries: $HEALTHCHECK_RETRIES
1618
start_period: 10s
1719
x-sentry-defaults: &sentry_defaults
18-
<<: *restart_policy
20+
<<: [*restart_policy, *pull_policy]
1921
image: sentry-self-hosted-local
2022
# Set the platform to build for linux/arm64 when needed on Apple silicon Macs.
2123
platform: ${DOCKER_PLATFORM:-}
@@ -174,7 +176,7 @@ services:
174176
timeout: 10s
175177
retries: 30
176178
clickhouse:
177-
<<: *restart_policy
179+
<<: [*restart_policy, *pull_policy]
178180
image: clickhouse-self-hosted-local
179181
build:
180182
context: ./clickhouse
@@ -329,7 +331,7 @@ services:
329331
target: /etc/symbolicator
330332
command: run -c /etc/symbolicator/config.yml
331333
symbolicator-cleanup:
332-
<<: *restart_policy
334+
<<: [*restart_policy, *pull_policy]
333335
image: symbolicator-cleanup-self-hosted-local
334336
build:
335337
context: ./cron
@@ -550,7 +552,7 @@ services:
550552
profiles:
551553
- feature-complete
552554
vroom-cleanup:
553-
<<: *restart_policy
555+
<<: [*restart_policy, *pull_policy]
554556
image: vroom-cleanup-self-hosted-local
555557
build:
556558
context: ./cron

install/_detect-container-engine.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
echo "${_group}Detecting container engine ..."
2+
3+
if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]] && command -v podman &>/dev/null; then
4+
export CONTAINER_ENGINE="podman"
5+
elif command -v docker &>/dev/null; then
6+
export CONTAINER_ENGINE="docker"
7+
else
8+
echo "FAIL: Neither podman nor docker is installed on the system."
9+
exit 1
10+
fi
11+
echo "Detected container engine: $CONTAINER_ENGINE"
12+
echo "${_endgroup}"

install/_min-requirements.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
MIN_DOCKER_VERSION='19.03.6'
33
MIN_COMPOSE_VERSION='2.32.2'
44

5+
MIN_PODMAN_VERSION='4.9.3'
6+
MIN_PODMAN_COMPOSE_VERSION='1.3.0'
7+
58
# 16 GB minimum host RAM, but there'll be some overhead outside of what
69
# can be allotted to docker
710
if [[ "$COMPOSE_PROFILES" == "errors-only" ]]; then

install/build-docker-images.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ echo "${_group}Building and tagging Docker images ..."
33
echo ""
44
# Build any service that provides the image sentry-self-hosted-local first,
55
# as it is used as the base image for sentry-cleanup-self-hosted-local.
6-
$dcb --force-rm web
6+
$dcb web
77
# Build each other service individually to localize potential failures better.
88
for service in $($dc config --services); do
9-
$dcb --force-rm "$service"
9+
$dcb "$service"
1010
done
1111
echo ""
1212
echo "Docker images built."

install/check-minimum-requirements.sh

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,41 @@ echo "${_group}Checking minimum requirements ..."
22

33
source install/_min-requirements.sh
44

5-
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}' || echo '')
5+
DOCKER_VERSION=$($CONTAINER_ENGINE version --format '{{.Server.Version}}' || echo '')
66
if [[ -z "$DOCKER_VERSION" ]]; then
7-
echo "FAIL: Unable to get docker version, is the docker daemon running?"
7+
echo "FAIL: Unable to get $CONTAINER_ENGINE version, is the $CONTAINER_ENGINE daemon running?"
88
exit 1
99
fi
1010

11-
if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION; then
12-
echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION"
13-
exit 1
14-
fi
15-
echo "Found Docker version $DOCKER_VERSION"
16-
17-
if ! vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION; then
18-
echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION"
19-
exit 1
11+
if [[ "$CONTAINER_ENGINE" == "docker" ]]; then
12+
if ! vergte ${DOCKER_VERSION//v/} $MIN_DOCKER_VERSION; then
13+
echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION"
14+
exit 1
15+
fi
16+
if ! vergte ${COMPOSE_VERSION//v/} $MIN_COMPOSE_VERSION; then
17+
echo "FAIL: Expected minimum $dc_base version to be $MIN_COMPOSE_VERSION but found $COMPOSE_VERSION"
18+
exit 1
19+
fi
20+
elif [[ "$CONTAINER_ENGINE" == "podman" ]]; then
21+
if ! vergte ${DOCKER_VERSION//v/} $MIN_PODMAN_VERSION; then
22+
echo "FAIL: Expected minimum podman version to be $MIN_PODMAN_VERSION but found $DOCKER_VERSION"
23+
exit 1
24+
fi
25+
if ! vergte ${COMPOSE_VERSION//v/} $MIN_PODMAN_COMPOSE_VERSION; then
26+
echo "FAIL: Expected minimum $dc_base version to be $MIN_PODMAN_COMPOSE_VERSION but found $COMPOSE_VERSION"
27+
exit 1
28+
fi
2029
fi
21-
echo "Found Docker Compose version $COMPOSE_VERSION"
30+
echo "Found $CONTAINER_ENGINE version $DOCKER_VERSION"
31+
echo "Found $CONTAINER_ENGINE Compose version $COMPOSE_VERSION"
2232

23-
CPU_AVAILABLE_IN_DOCKER=$(docker run --rm busybox nproc --all)
33+
CPU_AVAILABLE_IN_DOCKER=$($CONTAINER_ENGINE run --rm busybox nproc --all)
2434
if [[ "$CPU_AVAILABLE_IN_DOCKER" -lt "$MIN_CPU_HARD" ]]; then
2535
echo "FAIL: Required minimum CPU cores available to Docker is $MIN_CPU_HARD, found $CPU_AVAILABLE_IN_DOCKER"
2636
exit 1
2737
fi
2838

29-
RAM_AVAILABLE_IN_DOCKER=$(docker run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}')
39+
RAM_AVAILABLE_IN_DOCKER=$($CONTAINER_ENGINE run --rm busybox free -m 2>/dev/null | awk '/Mem/ {print $2}')
3040
if [[ "$RAM_AVAILABLE_IN_DOCKER" -lt "$MIN_RAM_HARD" ]]; then
3141
echo "FAIL: Required minimum RAM available to Docker is $MIN_RAM_HARD MB, found $RAM_AVAILABLE_IN_DOCKER MB"
3242
exit 1
@@ -35,9 +45,9 @@ fi
3545
#SSE4.2 required by Clickhouse (https://clickhouse.yandex/docs/en/operations/requirements/)
3646
# On KVM, cpuinfo could falsely not report SSE 4.2 support, so skip the check. https://github.com/ClickHouse/ClickHouse/issues/20#issuecomment-226849297
3747
# This may also happen on other virtualization software such as on VMWare ESXi hosts.
38-
IS_KVM=$(docker run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :)
48+
IS_KVM=$($CONTAINER_ENGINE run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :)
3949
if [[ ! "$SKIP_SSE42_REQUIREMENTS" -eq 1 && "$IS_KVM" -eq 0 && "$DOCKER_ARCH" = "x86_64" ]]; then
40-
SUPPORTS_SSE42=$(docker run --rm busybox grep -c sse4_2 /proc/cpuinfo || :)
50+
SUPPORTS_SSE42=$($CONTAINER_ENGINE run --rm busybox grep -c sse4_2 /proc/cpuinfo || :)
4151
if [[ "$SUPPORTS_SSE42" -eq 0 ]]; then
4252
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."
4353
exit 1

install/create-docker-volumes.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
echo "${_group}Creating volumes for persistent storage ..."
22

3-
echo "Created $(docker volume create --name=sentry-clickhouse)."
4-
echo "Created $(docker volume create --name=sentry-data)."
5-
echo "Created $(docker volume create --name=sentry-kafka)."
6-
echo "Created $(docker volume create --name=sentry-postgres)."
7-
echo "Created $(docker volume create --name=sentry-redis)."
8-
echo "Created $(docker volume create --name=sentry-symbolicator)."
3+
create_volume() {
4+
create_command="$CONTAINER_ENGINE volume create"
5+
if [ "$CONTAINER_ENGINE" = "podman" ]; then
6+
create_command="$create_command --ignore $1"
7+
else
8+
create_command="$create_command --name=$1"
9+
fi
10+
11+
$create_command
12+
}
13+
14+
echo "Created $(create_volume sentry-clickhouse)."
15+
echo "Created $(create_volume sentry-data)."
16+
echo "Created $(create_volume sentry-kafka)."
17+
echo "Created $(create_volume sentry-postgres)."
18+
echo "Created $(create_volume sentry-redis)."
19+
echo "Created $(create_volume sentry-symbolicator)."
920

1021
echo "${_endgroup}"

install/dc-detect-version.sh

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ else
66
_endgroup=""
77
fi
88

9-
echo "${_group}Initializing Docker Compose ..."
9+
echo "${_group}Initializing Docker|Podman Compose ..."
10+
11+
export CONTAINER_ENGINE="docker"
12+
if [[ "${CONTAINER_ENGINE_PODMAN:-0}" -eq 1 ]]; then
13+
if command -v podman &>/dev/null; then
14+
export CONTAINER_ENGINE="podman"
15+
else
16+
echo "FAIL: Podman is not installed on the system."
17+
exit 1
18+
fi
19+
fi
1020

1121
# To support users that are symlinking to docker-compose
12-
dc_base="$(docker compose version --short &>/dev/null && echo 'docker compose' || echo '')"
13-
dc_base_standalone="$(docker-compose version --short &>/dev/null && echo 'docker-compose' || echo '')"
22+
dc_base="$(${CONTAINER_ENGINE} compose version --short &>/dev/null && echo "$CONTAINER_ENGINE compose" || echo '')"
23+
dc_base_standalone="$(${CONTAINER_ENGINE}-compose version --short &>/dev/null && echo "$CONTAINER_ENGINE-compose" || echo '')"
1424

1525
COMPOSE_VERSION=$([ -n "$dc_base" ] && $dc_base version --short || echo '')
1626
STANDALONE_COMPOSE_VERSION=$([ -n "$dc_base_standalone" ] && $dc_base_standalone version --short || echo '')
1727

1828
if [[ -z "$COMPOSE_VERSION" && -z "$STANDALONE_COMPOSE_VERSION" ]]; then
19-
echo "FAIL: Docker Compose is required to run self-hosted"
29+
echo "FAIL: Docker|Podman Compose is required to run self-hosted"
2030
exit 1
2131
fi
2232

@@ -25,14 +35,57 @@ if [[ -z "$COMPOSE_VERSION" ]] || [[ -n "$STANDALONE_COMPOSE_VERSION" ]] && ! ve
2535
dc_base="$dc_base_standalone"
2636
fi
2737

38+
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
39+
NO_ANSI="--no-ansi"
40+
else
41+
NO_ANSI="--ansi never"
42+
fi
43+
2844
if [[ "$(basename $0)" = "install.sh" ]]; then
29-
dc="$dc_base --ansi never --env-file ${_ENV}"
45+
dc="$dc_base $NO_ANSI --env-file ${_ENV}"
3046
else
31-
dc="$dc_base --ansi never"
47+
dc="$dc_base $NO_ANSI"
3248
fi
49+
3350
proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}"
34-
dcr="$dc run --pull=never --rm"
51+
if [[ "$CONTAINER_ENGINE" == "podman" ]]; then
52+
proxy_args_dc="--podman-build-args http_proxy=${http_proxy:-},https_proxy=${https_proxy:-},no_proxy=${no_proxy:-}"
53+
# Disable pod creation as these are one-off commands and creating a pod
54+
# prints its pod id to stdout which is messing with the output that we
55+
# rely on various places such as configuration generation
56+
dcr="$dc --profile=feature-complete --in-pod=false run --rm"
57+
else
58+
proxy_args_dc=$proxy_args
59+
dcr="$dc run --pull=never --rm"
60+
fi
3561
dcb="$dc build $proxy_args"
36-
dbuild="docker build $proxy_args"
62+
dbuild="$CONTAINER_ENGINE build $proxy_args"
3763
echo "$dcr"
64+
# Utility function to handle --wait with docker and podman
65+
function start_service_and_wait_ready() {
66+
local options=()
67+
local services=()
68+
local found_service=0
69+
70+
for arg in "$@"; do
71+
if [[ $found_service -eq 0 && "$arg" == -* ]]; then
72+
options+=("$arg")
73+
else
74+
found_service=1
75+
services+=("$arg")
76+
fi
77+
done
78+
79+
if [ "$CONTAINER_ENGINE" = "podman" ]; then
80+
$dc up --force-recreate -d "${options[@]}" "${services[@]}"
81+
for service in "${services[@]}"; do
82+
while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do
83+
sleep 2
84+
done
85+
done
86+
else
87+
$dc up --wait "${options[@]}" "${services[@]}"
88+
fi
89+
}
90+
3891
echo "${_endgroup}"

install/detect-platform.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
source install/_detect-container-engine.sh
2+
13
echo "${_group}Detecting Docker platform"
24

35
# Sentry SaaS uses stock Yandex ClickHouse, but they don't provide images that
@@ -12,13 +14,13 @@ echo "${_group}Detecting Docker platform"
1214
# linux/amd64 by default due to virtualization.
1315
# See https://github.com/docker/cli/issues/3286 for the Docker bug.
1416

15-
if ! command -v docker &>/dev/null; then
16-
echo "FAIL: Could not find a \`docker\` binary on this system. Are you sure it's installed?"
17-
exit 1
17+
FORMAT="{{.Architecture}}"
18+
if [[ $CONTAINER_ENGINE == "podman" ]]; then
19+
FORMAT="{{.Host.Arch}}"
1820
fi
1921

20-
export DOCKER_ARCH=$(docker info --format '{{.Architecture}}')
21-
if [[ "$DOCKER_ARCH" = "x86_64" ]]; then
22+
export DOCKER_ARCH=$($CONTAINER_ENGINE info --format "$FORMAT")
23+
if [[ "$DOCKER_ARCH" = "x86_64" || "$DOCKER_ARCH" = "amd64" ]]; then
2224
export DOCKER_PLATFORM="linux/amd64"
2325
elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then
2426
export DOCKER_PLATFORM="linux/arm64"

install/ensure-correct-permissions-profiles-dir.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
# TODO: Remove this after the next hard-stop
44

55
echo "${_group}Ensuring correct permissions on profiles directory ..."
6+
67
$dcr --no-deps --entrypoint /bin/bash --user root vroom -c 'chown -R vroom:vroom /var/vroom/sentry-profiles && chmod -R o+rwx /var/vroom/sentry-profiles'
8+
79
echo "${_endgroup}"

0 commit comments

Comments
 (0)