-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
base: master
Are you sure you want to change the base?
Changes from 30 commits
d87c155
cd24311
64c9741
8034a6e
0fca38e
d98e2fb
27e524d
d711b5b
0e5e24e
f89f0c2
7c886c9
8039e03
00f4c81
b467a55
b9bff98
8185732
3bd844c
fc3d976
059f0c7
ed1e604
abb4551
b8a0206
5ae7db9
e2d60ee
dd74c39
cfa9157
9df8ab4
b679f06
400e4ea
5abf5a7
cb54be2
6416fa6
43f5431
09f54a0
257dc2d
7259d27
705a8b7
8e6e116
7d7f1c2
ffe08d8
2544ec8
06e6e24
8f0ba1a
ab342b9
1973cb0
a61a7a5
69e671d
dc4c1db
485c264
fe231a4
ca40557
dbe912d
a2792f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" == "podman" ]]; then | ||
dcb_force="$dcb --podman-rm-args='--force'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like single quotes here passed as is which leads to
|
||
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." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
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)." | ||
create_volume() { | ||
create_command="$CONTAINER_ENGINE volume create" | ||
if [ "$CONTAINER_ENGINE" = "podman" ]; then | ||
create_command="$create_command --ignore $1" | ||
else | ||
create_command="$create_command --name=$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}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,27 @@ else | |
_endgroup="" | ||
fi | ||
|
||
echo "${_group}Initializing Docker Compose ..." | ||
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="$(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_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 '') | ||
|
||
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 +35,54 @@ 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 | ||
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 | ||
|
||
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" | ||
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 | ||
dcb="$dc build $proxy_args" | ||
dbuild="docker build $proxy_args" | ||
dbuild="$CONTAINER_ENGINE build $proxy_args" | ||
|
||
# Utility function to handle --wait with docker and podman | ||
function start_service_and_wait_ready() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well well... @aldy505 - with this, maybe we can lower the Docker Compose version requirement again as some people were complaining about that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we might. Do you have any thoughts regarding this? @aminvakil |
||
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 --force-recreate -d "${options[@]}" "${services[@]}" | ||
for service in "${services[@]}"; do | ||
while ! $CONTAINER_ENGINE ps --filter "health=healthy" | grep "$service"; do | ||
sleep 2 | ||
done | ||
done | ||
fi | ||
} | ||
|
||
echo "${_endgroup}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BYK I believe Docker and Docker Compose needs to be uninstalled if we want to move forward with this? Or we can just drop the Podman tests and do it on a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have Podman, it takes precedence. Don't think we need to uninstall Docker. Why do you think so?