diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 794a01d7d0..fb891aea8b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,6 +34,8 @@ jobs: ./install.sh ./test.sh echo "Testing in-place upgrade" + # Also test plugin installation here + echo "sentry-auth-oidc" >> sentry/requirements.txt ./install.sh --minimize-downtime ./test.sh diff --git a/docker-compose.yml b/docker-compose.yml index d25e054498..4a2644c904 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,11 +3,7 @@ x-restart-policy: &restart_policy restart: unless-stopped x-sentry-defaults: &sentry_defaults <<: *restart_policy - build: - context: ./sentry - args: - - SENTRY_IMAGE - image: sentry-onpremise-local + image: "$SENTRY_IMAGE" depends_on: - redis - postgres @@ -21,7 +17,10 @@ x-sentry-defaults: &sentry_defaults - snuba-replacer - symbolicator - kafka + entrypoint: "/etc/sentry/entrypoint.sh" + command: ["run", "web"] environment: + PYTHONUSERBASE: "/data/custom-packages" SENTRY_CONF: "/etc/sentry" SNUBA: "http://snuba-api:1218" # Leaving the value empty to just pass whatever is set @@ -219,7 +218,7 @@ services: build: context: ./cron args: - BASE_IMAGE: "sentry-onpremise-local" + BASE_IMAGE: "$SENTRY_IMAGE" command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"' nginx: <<: *restart_policy diff --git a/install.sh b/install.sh index 4307b201b0..ab978185b4 100755 --- a/install.sh +++ b/install.sh @@ -247,8 +247,6 @@ echo "${_endgroup}" echo "${_group}Building and tagging Docker images ..." echo "" -# Build the sentry onpremise image first as it is needed for the cron image -$dc build --force-rm web $dc build --force-rm echo "" echo "Docker images built." diff --git a/sentry/.dockerignore b/sentry/.dockerignore deleted file mode 100644 index 693a7e0716..0000000000 --- a/sentry/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -# Ignore everything -* - -# Only allow requirements.txt -!/requirements.txt diff --git a/sentry/Dockerfile b/sentry/Dockerfile deleted file mode 100644 index f9484f295b..0000000000 --- a/sentry/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -ARG SENTRY_IMAGE -FROM ${SENTRY_IMAGE} - -COPY . /usr/src/sentry - -# Hook for installing additional plugins -RUN if [ -s /usr/src/sentry/requirements.txt ]; then pip install -r /usr/src/sentry/requirements.txt; fi diff --git a/sentry/entrypoint.sh b/sentry/entrypoint.sh new file mode 100755 index 0000000000..55c7e4141a --- /dev/null +++ b/sentry/entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +req_file="/etc/sentry/requirements.txt" +plugins_dir="/data/custom-packages" +checksum_file="$plugins_dir/.checksum" + +if [[ -s "$req_file" ]] && ! cat "$req_file" | grep '^[^#[:space:]]' | shasum -s -c "$checksum_file" 2>/dev/null; then + echo "Installing additional dependencies..." + mkdir -p "$plugins_dir" + pip install --user -r "$req_file" + cat "$req_file" | grep '^[^#[:space:]]' | shasum > "$checksum_file" + echo "" +fi + +source /docker-entrypoint.sh