Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions clickhouse/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
7 changes: 6 additions & 1 deletion clickhouse/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<yandex>
<max_server_memory_usage_to_ram_ratio from_env="MAX_MEMORY_USAGE_RATIO" />
<max_server_memory_usage_to_ram_ratio>
<!-- This include is important!
It is required for the version of Clickhouse
used on ARM to read the environment variable. -->
<include from_env="MAX_MEMORY_USAGE_RATIO"/>
</max_server_memory_usage_to_ram_ratio>
<logger>
<level>information</level>
<console>1</console>
Expand Down
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ x-healthcheck-defaults: &healthcheck_defaults
x-sentry-defaults: &sentry_defaults
<<: *restart_policy
image: sentry-self-hosted-local
# Set the platform to build for linux/arm64 when needed on Apple silicon Macs.
platform: ${DOCKER_PLATFORM:-}
build:
context: ./sentry
args:
Expand Down Expand Up @@ -190,7 +192,12 @@ services:
test: ["CMD-SHELL", "nc -z localhost 9092"]
clickhouse:
<<: *restart_policy
image: "yandex/clickhouse-server:20.3.9.70"
image: clickhouse-self-hosted-local
build:
context:
./clickhouse
args:
BASE_IMAGE: "${CLICKHOUSE_IMAGE:-}"
ulimits:
nofile:
soft: 262144
Expand Down
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 "$(dirname $0)/install/_lib.sh" # does a `cd .../install/`, among other

# Pre-flight. No impact yet.
source parse-cli.sh
source detect-platform.sh
source dc-detect-version.sh
source error-handling.sh
source check-latest-commit.sh
Expand Down
8 changes: 7 additions & 1 deletion install/check-minimum-requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ source "$(dirname $0)/_min-requirements.sh"
function ver () { echo "$@" | awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'; }

DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')

if [[ -z "$DOCKER_VERSION" ]]; then
echo "FAIL: Unable to get docker version, is the docker daemon running?"
exit 1
fi

if [[ "$(ver $DOCKER_VERSION)" -lt "$(ver $MIN_DOCKER_VERSION)" ]]; then
echo "FAIL: Expected minimum docker version to be $MIN_DOCKER_VERSION but found $DOCKER_VERSION"
exit 1
Expand Down Expand Up @@ -39,7 +45,7 @@ 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
IS_KVM=$(docker run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo || :)
if [[ "$IS_KVM" -eq 0 ]]; then
if [[ "$IS_KVM" -eq 0 && "$DOCKER_ARCH" = "x86_64" ]]; then
SUPPORTS_SSE42=$(docker 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."
Expand Down
30 changes: 30 additions & 0 deletions install/detect-platform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
echo "${_group}Detecting Docker platform"


# Sentry SaaS uses stock Yandex ClickHouse, but they don't provide images that
# support ARM, which is relevant especially for Apple M1 laptops, Sentry's
# standard developer environment. As a workaround, we use an altinity image
# targeting ARM.
#
# See https://github.com/getsentry/self-hosted/issues/1385#issuecomment-1101824274
#
# Images built on ARM also need to be tagged to use linux/arm64 on Apple
# silicon Macs to work around an issue where they are built for
# linux/amd64 by default due to virtualization.
# See https://github.com/docker/cli/issues/3286 for the Docker bug.

export DOCKER_ARCH=$(docker info --format '{{.Architecture}}')

if [[ "$DOCKER_ARCH" = "x86_64" ]]; then
export DOCKER_PLATFORM="linux/amd64"
export CLICKHOUSE_IMAGE="yandex/clickhouse-server:20.3.9.70"
elif [[ "$DOCKER_ARCH" = "aarch64" ]]; then
export DOCKER_PLATFORM="linux/arm64"
export CLICKHOUSE_IMAGE="altinity/clickhouse-server:21.6.1.6734-testing-arm"
else
echo "FAIL: Unsupported docker architecture $DOCKER_ARCH."
exit 1
fi
echo "Detected Docker platform is $DOCKER_PLATFORM"

echo "${_endgroup}"