Skip to content

Commit a1c0c1f

Browse files
authored
ref: Stop building local images for Sentry services (#834)
We used to build local images for Sentry services to be able to include required plugins in the image. With this change we instead do this in a custom entrypoint script and use the volume `/data` to store the plugins permanently. This should resolve many issues people have around building local images and pushing them to places like private repositories or swarm clusters. This is not 100% compatible with the old way but it should still be a mostly transparent change to many folks.
1 parent 5bad6ed commit a1c0c1f

File tree

6 files changed

+23
-20
lines changed

6 files changed

+23
-20
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434
./install.sh
3535
./test.sh
3636
echo "Testing in-place upgrade"
37+
# Also test plugin installation here
38+
echo "sentry-auth-oidc" >> sentry/requirements.txt
3739
./install.sh --minimize-downtime
3840
./test.sh
3941

docker-compose.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ x-restart-policy: &restart_policy
33
restart: unless-stopped
44
x-sentry-defaults: &sentry_defaults
55
<<: *restart_policy
6-
build:
7-
context: ./sentry
8-
args:
9-
- SENTRY_IMAGE
10-
image: sentry-onpremise-local
6+
image: "$SENTRY_IMAGE"
117
depends_on:
128
- redis
139
- postgres
@@ -21,7 +17,10 @@ x-sentry-defaults: &sentry_defaults
2117
- snuba-replacer
2218
- symbolicator
2319
- kafka
20+
entrypoint: "/etc/sentry/entrypoint.sh"
21+
command: ["run", "web"]
2422
environment:
23+
PYTHONUSERBASE: "/data/custom-packages"
2524
SENTRY_CONF: "/etc/sentry"
2625
SNUBA: "http://snuba-api:1218"
2726
# Leaving the value empty to just pass whatever is set
@@ -219,7 +218,7 @@ services:
219218
build:
220219
context: ./cron
221220
args:
222-
BASE_IMAGE: "sentry-onpremise-local"
221+
BASE_IMAGE: "$SENTRY_IMAGE"
223222
command: '"0 0 * * * gosu sentry sentry cleanup --days $SENTRY_EVENT_RETENTION_DAYS"'
224223
nginx:
225224
<<: *restart_policy

install.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,6 @@ echo "${_endgroup}"
247247

248248
echo "${_group}Building and tagging Docker images ..."
249249
echo ""
250-
# Build the sentry onpremise image first as it is needed for the cron image
251-
$dc build --force-rm web
252250
$dc build --force-rm
253251
echo ""
254252
echo "Docker images built."

sentry/.dockerignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

sentry/Dockerfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

sentry/entrypoint.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -e
3+
4+
req_file="/etc/sentry/requirements.txt"
5+
plugins_dir="/data/custom-packages"
6+
checksum_file="$plugins_dir/.checksum"
7+
8+
if [[ -s "$req_file" ]] && ! cat "$req_file" | grep '^[^#[:space:]]' | shasum -s -c "$checksum_file" 2>/dev/null; then
9+
echo "Installing additional dependencies..."
10+
mkdir -p "$plugins_dir"
11+
pip install --user -r "$req_file"
12+
cat "$req_file" | grep '^[^#[:space:]]' | shasum > "$checksum_file"
13+
echo ""
14+
fi
15+
16+
source /docker-entrypoint.sh

0 commit comments

Comments
 (0)