diff --git a/.env b/.env index 430cdac1d5d..db8bdb8dba2 100644 --- a/.env +++ b/.env @@ -11,7 +11,6 @@ SNUBA_IMAGE=getsentry/snuba:nightly RELAY_IMAGE=getsentry/relay:nightly SYMBOLICATOR_IMAGE=getsentry/symbolicator:nightly VROOM_IMAGE=getsentry/vroom:nightly -WAL2JSON_VERSION=latest HEALTHCHECK_INTERVAL=30s HEALTHCHECK_TIMEOUT=1m30s HEALTHCHECK_RETRIES=10 diff --git a/.gitignore b/.gitignore index 7311a09ae9c..13f8982c056 100644 --- a/.gitignore +++ b/.gitignore @@ -98,9 +98,6 @@ geoip/GeoIP.conf geoip/*.mmdb geoip/.geoipupdate.lock -# wal2json download -postgres/wal2json - # integration testing _integration-test/custom-ca-roots/nginx/* sentry/test-custom-ca-roots.py diff --git a/docker-compose.yml b/docker-compose.yml index ce67c1a72e2..654220d4ded 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -126,23 +126,12 @@ services: [ "postgres", "-c", - "wal_level=logical", - "-c", - "max_replication_slots=1", - "-c", - "max_wal_senders=1", - "-c", "max_connections=${POSTGRES_MAX_CONNECTIONS:-100}", ] environment: POSTGRES_HOST_AUTH_METHOD: "trust" - entrypoint: /opt/sentry/postgres-entrypoint.sh volumes: - "sentry-postgres:/var/lib/postgresql/data" - - type: bind - read_only: true - source: ./postgres/ - target: /opt/sentry/ zookeeper: <<: *restart_policy image: "confluentinc/cp-zookeeper:7.6.1" diff --git a/install.sh b/install.sh index ac5a2f0f4b2..ee2e008d1e7 100755 --- a/install.sh +++ b/install.sh @@ -32,7 +32,6 @@ source install/ensure-relay-credentials.sh source install/generate-secret-key.sh source install/update-docker-images.sh source install/build-docker-images.sh -source install/install-wal2json.sh source install/bootstrap-snuba.sh source install/upgrade-postgres.sh source install/set-up-and-migrate-database.sh diff --git a/install/install-wal2json.sh b/install/install-wal2json.sh deleted file mode 100644 index 9df0df7603e..00000000000 --- a/install/install-wal2json.sh +++ /dev/null @@ -1,45 +0,0 @@ -echo "${_group}Downloading and installing wal2json ..." - -WAL2JSON_DIR=postgres/wal2json -FILE_TO_USE="$WAL2JSON_DIR/wal2json.so" -ARCH=$(uname -m) -FILE_NAME="wal2json-Linux-$ARCH-glibc.so" - -docker_curl() { - # The environment variables can be specified in lower case or upper case. - # The lower case version has precedence. http_proxy is an exception as it is only available in lower case. - docker run --rm -e http_proxy -e https_proxy -e HTTPS_PROXY -e no_proxy -e NO_PROXY curlimages/curl:7.77.0 \ - --connect-timeout 5 \ - --max-time 10 \ - --retry 5 \ - --retry-max-time 60 \ - "$@" -} - -if [[ $WAL2JSON_VERSION == "latest" ]]; then - # Hard-code this. Super-hacky. We were curling the GitHub API here but - # hitting rate limits in CI. This library hasn't seen a new release for a - # year and a half at time of writing. - # - # If you're reading this do us a favor and go check: - # - # https://github.com/getsentry/wal2json/releases - # - # If there's a new release can you update this please? If not maybe subscribe - # for notifications on the repo with "Watch > Custom > Releases". Together we - # can make a difference. - VERSION=0.0.2 -else - VERSION=$WAL2JSON_VERSION -fi - -mkdir -p "$WAL2JSON_DIR" -if [ ! -f "$WAL2JSON_DIR/$VERSION/$FILE_NAME" ]; then - mkdir -p "$WAL2JSON_DIR/$VERSION" - docker_curl -L \ - "https://github.com/getsentry/wal2json/releases/download/$VERSION/$FILE_NAME" \ - >"$WAL2JSON_DIR/$VERSION/$FILE_NAME" -fi -cp "$WAL2JSON_DIR/$VERSION/$FILE_NAME" "$FILE_TO_USE" - -echo "${_endgroup}" diff --git a/postgres/init_hba.sh b/postgres/init_hba.sh deleted file mode 100755 index 9952ab14864..00000000000 --- a/postgres/init_hba.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# Initializes the pg_hba file with access permissions to the replication -# slots. - -set -e - -{ echo "host replication all all trust"; } >>"$PGDATA/pg_hba.conf" diff --git a/postgres/postgres-entrypoint.sh b/postgres/postgres-entrypoint.sh deleted file mode 100755 index 68a469f7cae..00000000000 --- a/postgres/postgres-entrypoint.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# This script replaces the default docker entrypoint for postgres in the -# development environment. -# Its job is to ensure postgres is properly configured to support the -# Change Data Capture pipeline (by setting access permissions and installing -# the replication plugin we use for CDC). Unfortunately the default -# Postgres image does not allow this level of configurability so we need -# to do it this way in order not to have to publish and maintain our own -# Postgres image. -# -# This then, at the end, transfers control to the default entrypoint. - -set -e - -prep_init_db() { - cp /opt/sentry/init_hba.sh /docker-entrypoint-initdb.d/init_hba.sh -} - -cdc_setup_hba_conf() { - # Ensure pg-hba is properly configured to allow connections - # to the replication slots. - - PG_HBA="$PGDATA/pg_hba.conf" - if [ ! -f "$PG_HBA" ]; then - echo "DB not initialized. Postgres will take care of pg_hba" - elif [ "$(grep -c -E "^host\s+replication" "$PGDATA"/pg_hba.conf)" != 0 ]; then - echo "Replication config already present in pg_hba. Not changing anything." - else - # Execute the same script we run on DB initialization - /opt/sentry/init_hba.sh - fi -} - -bind_wal2json() { - # Copy the file in the right place - cp /opt/sentry/wal2json/wal2json.so $(pg_config --pkglibdir)/wal2json.so -} - -echo "Setting up Change Data Capture" - -prep_init_db -if [ "$1" = 'postgres' ]; then - cdc_setup_hba_conf - bind_wal2json -fi -exec /usr/local/bin/docker-entrypoint.sh "$@" diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh index e59a1d1eb27..808df09aa17 100755 --- a/scripts/bump-version.sh +++ b/scripts/bump-version.sh @@ -4,11 +4,7 @@ set -eu OLD_VERSION="$1" NEW_VERSION="$2" -WAL2JSON_VERSION=${WAL2JSON_VERSION:-$(curl -s "https://api.github.com/repos/getsentry/wal2json/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')} - -sed -i -e "s/^WAL2JSON_VERSION=\([^:]\+\):.\+\$/WAL2JSON_VERSION=\1:$WAL2JSON_VERSION/" .env sed -i -e "s/^\(SENTRY\|SNUBA\|RELAY\|SYMBOLICATOR\|VROOM\)_IMAGE=\([^:]\+\):.\+\$/\1_IMAGE=\2:$NEW_VERSION/" .env sed -i -e "s/^\# Self-Hosted Sentry .*/# Self-Hosted Sentry $NEW_VERSION/" README.md echo "New version: $NEW_VERSION" -echo "New wal2json version: $WAL2JSON_VERSION"