Skip to content

Commit ad39dab

Browse files
authored
ref(geoip): Remove geoipupdate from compose (#3490)
`geoipupdate` is not used by any other service nor it is needed for any service to run. Moreover, it is a one-shot command, causing `docker compose up --wait` to fail when it exits with a non-zero status. This happens when one has not yet set up their credentials and they may choose to never do this. This PR removes `geoipupdate` from the `docker-compose.yml` file and moves the command directly into the geoip related script. One may run this whenever they want to update their GeoIP database. This PR needs an accompanying docs change.
1 parent 0ca9311 commit ad39dab

File tree

8 files changed

+12
-40
lines changed

8 files changed

+12
-40
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ jobs:
134134

135135
- name: Integration Test
136136
run: |
137+
docker compose up --wait
137138
if [ "${{ matrix.compose_version }}" = "v2.19.0" ]; then
138139
pytest --reruns 3 --cov --junitxml=junit.xml _integration-test/ --customizations=${{ matrix.customizations }}
139140
else

docker-compose.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,6 @@ services:
207207
interval: 10s
208208
timeout: 10s
209209
retries: 30
210-
geoipupdate:
211-
image: "ghcr.io/maxmind/geoipupdate:v6.1.0"
212-
# Override the entrypoint in order to avoid using envvars for config.
213-
# Futz with settings so we can keep mmdb and conf in same dir on host
214-
# (image looks for them in separate dirs by default).
215-
entrypoint:
216-
["/usr/bin/geoipupdate", "-d", "/sentry", "-f", "/sentry/GeoIP.conf"]
217-
volumes:
218-
- "./geoip:/sentry"
219210
snuba-api:
220211
<<: *snuba_defaults
221212
# Kafka consumer responsible for feeding events into Clickhouse

install/geoip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ install_geoip() {
2121
else
2222
echo "IP address geolocation is configured for updates."
2323
echo "Updating IP address geolocation database ... "
24-
if ! $dcr geoipupdate; then
24+
if ! docker run --rm -v "./geoip:/sentry" --entrypoint '/usr/bin/geoipupdate' "ghcr.io/maxmind/geoipupdate:v6.1.0" "-d" "/sentry" "-f" "/sentry/GeoIP.conf"; then
2525
result='Error'
2626
fi
2727
echo "$result updating IP address geolocation database."

install/set-up-and-migrate-database.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
echo "${_group}Setting up / migrating database ..."
22

33
# Fixes https://github.com/getsentry/self-hosted/issues/2758, where a migration fails due to indexing issue
4-
$dc up -d postgres
5-
# Wait for postgres
6-
RETRIES=5
7-
until $dc exec postgres psql -U postgres -c "select 1" >/dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
8-
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
9-
sleep 1
10-
done
4+
$dc up --wait postgres
115

126
os=$($dc exec postgres cat /etc/os-release | grep 'ID=debian')
137
if [[ -z $os ]]; then

install/upgrade-clickhouse.sh

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,19 @@
11
echo "${_group}Upgrading Clickhouse ..."
22

3-
function wait_for_clickhouse() {
4-
# Wait for clickhouse
5-
RETRIES=30
6-
until $dc ps clickhouse | grep 'healthy' || [ $RETRIES -eq 0 ]; do
7-
echo "Waiting for clickhouse server, $((RETRIES--)) remaining attempts..."
8-
sleep 1
9-
done
10-
}
11-
123
# First check to see if user is upgrading by checking for existing clickhouse volume
134
if [[ -n "$(docker volume ls -q --filter name=sentry-clickhouse)" ]]; then
145
# Start clickhouse if it is not already running
15-
$dc up -d clickhouse
16-
17-
# Wait for clickhouse
18-
wait_for_clickhouse
6+
$dc up --wait clickhouse
197

208
# In order to get to 23.8, we need to first upgrade go from 21.8 -> 22.8 -> 23.3 -> 23.8
219
version=$($dc exec clickhouse clickhouse-client -q 'SELECT version()')
2210
if [[ "$version" == "21.8.13.1.altinitystable" || "$version" == "21.8.12.29.altinitydev.arm" ]]; then
2311
$dc down clickhouse
2412
$dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:22.8.15.25.altinitystable clickhouse
25-
$dc up -d clickhouse
26-
wait_for_clickhouse
13+
$dc up --wait clickhouse
2714
$dc down clickhouse
2815
$dcb --build-arg BASE_IMAGE=altinity/clickhouse-server:23.3.19.33.altinitystable clickhouse
29-
$dc up -d clickhouse
30-
wait_for_clickhouse
16+
$dc up --wait clickhouse
3117
else
3218
echo "Detected clickhouse version $version. Skipping upgrades!"
3319
fi

install/upgrade-postgres.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [[ -n "$(docker volume ls -q --filter name=sentry-postgres)" && "$(docker run
2020
docker volume rm sentry-postgres-new
2121
echo "Re-indexing due to glibc change, this may take a while..."
2222
echo "Starting up new PostgreSQL version"
23-
$dc up -d postgres
23+
$dc up --wait postgres
2424

2525
# Wait for postgres
2626
RETRIES=5

install/wrap-up.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ if [[ "$MINIMIZE_DOWNTIME" ]]; then
22
echo "${_group}Waiting for Sentry to start ..."
33

44
# Start the whole setup, except nginx and relay.
5-
$dc up -d --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay)$')
5+
$dc up --wait --remove-orphans $($dc config --services | grep -v -E '^(nginx|relay)$')
66
$dc restart relay
77
$dc exec -T nginx nginx -s reload
88

99
docker run --rm --network="${COMPOSE_PROJECT_NAME}_default" alpine ash \
1010
-c 'while [[ "$(wget -T 1 -q -O- http://web:9000/_health/)" != "ok" ]]; do sleep 0.5; done'
1111

1212
# Make sure everything is up. This should only touch relay and nginx
13-
$dc up -d
13+
$dc up --wait
1414

1515
echo "${_endgroup}"
1616
else
@@ -20,9 +20,9 @@ else
2020
echo "You're all done! Run the following command to get Sentry running:"
2121
echo ""
2222
if [[ "${_ENV}" =~ ".env.custom" ]]; then
23-
echo " $dc_base --env-file ${_ENV} up -d"
23+
echo " $dc_base --env-file ${_ENV} up --wait"
2424
else
25-
echo " $dc_base up -d"
25+
echo " $dc_base up --wait"
2626
fi
2727
echo ""
2828
echo "-----------------------------------------------------------------"

sentry-admin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on the host filesystem. Commands that write files should write them to the '/sen
2222

2323
# Actual invocation that runs the command in the container.
2424
invocation() {
25-
$dc run -v "$VOLUME_MAPPING" --rm -T -e SENTRY_LOG_LEVEL=CRITICAL web "$@" 2>&1
25+
$dcr --quiet-pull -v "$VOLUME_MAPPING" -T -e SENTRY_LOG_LEVEL=CRITICAL web "$@" 2>&1
2626
}
2727

2828
# Function to modify lines starting with `Usage: sentry` to say `Usage: ./sentry-admin.sh` instead.

0 commit comments

Comments
 (0)