Could not translate host name "postgres" to address: Name or service not known

Version: onpremise-21.6.1 or 21.6.0
Error: django.db.utils.OperationalError: could not translate host name “postgres” to address: Name or service not known.
Output as below:

+++ basename ./install.sh
++ [[ install.sh = \i\n\s\t\a\l\l\.\s\h ]]
+++ dirname ./install.sh
++ cd ./install/
+++ realpath ../.env
++ _ENV=/root/onpremise-21.6.1/.env
+++ mktemp
++ t=/tmp/tmp.zKnXslSHeC
++ export -p
++ set -a
++ . /root/onpremise-21.6.1/.env
+++ COMPOSE_PROJECT_NAME=sentry_onpremise
+++ SENTRY_EVENT_RETENTION_DAYS=90
+++ SENTRY_BIND=9000
+++ SENTRY_IMAGE=getsentry/sentry:21.6.1
+++ SNUBA_IMAGE=getsentry/snuba:21.6.1
+++ RELAY_IMAGE=getsentry/relay:21.6.1
+++ SYMBOLICATOR_IMAGE=getsentry/symbolicator:0.3.4
+++ WAL2JSON_VERSION=latest
++ set +a
++ . /tmp/tmp.zKnXslSHeC
+++ declare -x CELERY_RESULT_BACKEND_URL=redis://127.0.0.1:6379/15
+++ declare -x CORS_ORIGINS=True
+++ declare -x DEBUG=True
+++ declare -x 'DINGTALK_WEBHOOK=https://oapi.dingtalk.com/robot/send?access_token=8e8fdff193f2220780e7089588459891ecf9111ee259a64115138c544ac72743'
+++ declare -x GDB_PASSWORD=Tianjian_yun_kn%
+++ declare -x GDB_USERNAME=tianjian_yun_kn
+++ declare -x GUNICORN_BIND=127.0.0.1:8007
+++ declare -x GUNICORN_GROUP=root
+++ declare -x GUNICORN_USER=root
+++ declare -x HISTCONTROL=ignoredups
+++ declare -x HISTSIZE=100000
+++ declare -x HOME=/root
+++ declare -x HOSTNAME=centos7.localdomain
+++ declare -x JWT_SECRET_KEY=5ula6epxRZeS8OwYdDbS7b/S4sf08UPggDO/AzAUN7w=
+++ declare -x KNOWLEDGE_REDIS_DEFAULT_LOCATION=redis://127.0.0.1:6379/10
+++ declare -x KNOWLEDGE_REDIS_LABEL_LOCATION=redis://127.0.0.1:6379/13
+++ declare -x KNOWLEDGE_REDIS_SESSION_LOCATION=redis://127.0.0.1:6379/12
+++ declare -x LANG=en_US.UTF-8
+++ declare -x 'LESSOPEN=||/usr/bin/lesspipe.sh %s'
+++ declare -x LOGNAME=root
+++ declare -x 'LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:'
+++ declare -x MAIL=/var/spool/mail/root
+++ declare -x NOTIFYTYPE=
+++ declare -x NOTIFY_MSG=知识图谱工作台异常告警-测试环境
+++ declare -x OLDPWD=/root/onpremise-21.6.1
+++ declare -x OSS_ACCESSKEYID=LTAI4G2LfkTureHi7wPqy6Sv
+++ declare -x OSS_ACCESSKEY_SECRET=7nv340IB0cPz776aphznfuNrpxAUXM
+++ declare -x OSS_RAM_ROLE_ARN=acs:ram::50256575:role/aliyunserviceroleforgdb
+++ declare -x PATH=/root/.pyenv/shims:/root/.pyenv/plugins/pyenv-virtualenv/shims:/root/.pyenv/shims:/root/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
+++ declare -x PWD=/root/onpremise-21.6.1/install
+++ declare -x PYENV_ROOT=/root/.pyenv
+++ declare -x PYENV_SHELL=bash
+++ declare -x PYENV_VIRTUALENV_INIT=1
+++ declare -x PYTHON_BUILD_MIRROR_URL=https://npm.taobao.org/mirrors/python/
+++ declare -x PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
+++ declare -x REDIS_MAX_CONNECTION=1000
+++ declare -x SELINUX_LEVEL_REQUESTED=
+++ declare -x SELINUX_ROLE_REQUESTED=
+++ declare -x SELINUX_USE_CURRENT_RANGE=
+++ declare -x SENTRY=
+++ declare -x SENTRY_BODY=always
+++ declare -x SENTRY_DEBUG=
+++ declare -x SENTRY_DSN=https://a726a5d61dff497e881299062af8db4c@o378815.ingest.sentry.io/5796270
+++ declare -x SENTRY_ENV=JedoreCentOS
+++ declare -x SHELL=/bin/bash
+++ declare -x SHLVL=2
+++ declare -x SMS_ACCESS_KEY_ID=LTAI5t7uLfnJD1LJj6L3QS91
+++ declare -x SMS_ACCESS_KEY_SECRET=TXgWl8gtO6AKsJV6vO4OtwUnm11Cdp
+++ declare -x SMS_CAPTCHA_SIGN_NAME=天健云计算
+++ declare -x SMS_CAPTCHA_TEMPLATE_CODE=SMS_217405321
+++ declare -x SMS_EXCEPTION_SIGN_NAME=天健云计算
+++ declare -x SMS_EXCEPTION_TEMPLATE_CODE=SMS_217405328
+++ declare -x 'SSH_CLIENT=192.168.90.203 59393 22'
+++ declare -x 'SSH_CONNECTION=192.168.90.203 59393 192.168.90.141 22'
+++ declare -x SSH_TTY=/dev/pts/1
+++ declare -x TERM=xterm
+++ declare -x USER=root
+++ declare -x XDG_RUNTIME_DIR=/run/user/0
+++ declare -x XDG_SESSION_ID=5
++ rm /tmp/tmp.zKnXslSHeC
++ unset t
++ '[' '' = true ']'
++ _group='▶ '
++ _endgroup=
++ dc='docker-compose --no-ansi'
++ dcr='docker-compose --no-ansi run --rm'
++ SENTRY_CONFIG_PY=../sentry/sentry.conf.py
++ SENTRY_CONFIG_YML=../sentry/config.yml
++ STOP_TIMEOUT=60
+ source parse-cli.sh
++ echo '▶ Parsing command line ...'
▶ Parsing command line ...
++ SKIP_USER_PROMPT=
++ MINIMIZE_DOWNTIME=
++ ((  0  ))
++ echo ''

+ source error-handling.sh
++ echo '▶ Setting up error handling ...'
▶ Setting up error handling ...
++ DID_CLEAN_UP=0
++ trap_with_arg cleanup ERR INT TERM EXIT
++ func=cleanup
++ shift
++ for sig in '"$@"'
++ trap 'cleanup ERR $LINENO' ERR
++ for sig in '"$@"'
++ trap 'cleanup INT $LINENO' INT
++ for sig in '"$@"'
++ trap 'cleanup TERM $LINENO' TERM
++ for sig in '"$@"'
++ trap 'cleanup EXIT $LINENO' EXIT
++ echo ''

+ source check-minimum-requirements.sh
++ echo '▶ Checking minimum requirements ...'
▶ Checking minimum requirements ...
++ MIN_DOCKER_VERSION=19.03.6
++ MIN_COMPOSE_VERSION=1.24.1
++ MIN_RAM_HARD=3800
++ MIN_RAM_SOFT=7800
++ MIN_CPU_HARD=2
++ MIN_CPU_SOFT=4
+++ docker version --format '{{.Server.Version}}'
++ DOCKER_VERSION=19.03.15
+++ docker-compose --no-ansi --version
+++ sed 's/docker-compose version \(.\{1,\}\),.*/\1/'
++ COMPOSE_VERSION=1.29.2
+++ docker run --rm busybox free -m
+++ awk '/Mem/ {print $2}'
++ RAM_AVAILABLE_IN_DOCKER=7820
+++ docker run --rm busybox nproc --all
++ CPU_AVAILABLE_IN_DOCKER=4
+++ ver 19.03.15
+++ echo 19.03.15
+++ awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'
+++ ver 19.03.6
+++ echo 19.03.6
+++ awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'
++ [[ 19003015 -lt 19003006 ]]
+++ ver 1.29.2
+++ echo 1.29.2
+++ awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'
+++ ver 1.24.1
+++ echo 1.24.1
+++ awk -F. '{ printf("%d%03d%03d", $1,$2,$3); }'
++ [[ 1029002 -lt 1024001 ]]
++ [[ 4 -lt 2 ]]
++ [[ 4 -lt 4 ]]
++ [[ 7820 -lt 3800 ]]
++ [[ 7820 -lt 7800 ]]
+++ docker run --rm busybox grep -c 'Common KVM processor' /proc/cpuinfo
+++ :
++ IS_KVM=0
++ [[ 0 -eq 0 ]]
+++ docker run --rm busybox grep -c sse4_2 /proc/cpuinfo
++ SUPPORTS_SSE42=4
++ [[ 4 -eq 0 ]]
++ echo ''

+ source create-docker-volumes.sh
++ echo '▶ Creating volumes for persistent storage ...'
▶ Creating volumes for persistent storage ...
+++ docker volume create --name=sentry-clickhouse
++ echo 'Created sentry-clickhouse.'
Created sentry-clickhouse.
+++ docker volume create --name=sentry-data
++ echo 'Created sentry-data.'
Created sentry-data.
+++ docker volume create --name=sentry-kafka
++ echo 'Created sentry-kafka.'
Created sentry-kafka.
+++ docker volume create --name=sentry-postgres
++ echo 'Created sentry-postgres.'
Created sentry-postgres.
+++ docker volume create --name=sentry-redis
++ echo 'Created sentry-redis.'
Created sentry-redis.
+++ docker volume create --name=sentry-symbolicator
++ echo 'Created sentry-symbolicator.'
Created sentry-symbolicator.
+++ docker volume create --name=sentry-zookeeper
++ echo 'Created sentry-zookeeper.'
Created sentry-zookeeper.
++ echo ''

+ source ensure-files-from-examples.sh
++ echo '▶ Ensuring files from examples ...'
▶ Ensuring files from examples ...
++ ensure_file_from_example ../sentry/sentry.conf.py
++ [[ -f ../sentry/sentry.conf.py ]]
++ echo '../sentry/sentry.conf.py already exists, skipped creation.'
../sentry/sentry.conf.py already exists, skipped creation.
++ ensure_file_from_example ../sentry/config.yml
++ [[ -f ../sentry/config.yml ]]
++ echo '../sentry/config.yml already exists, skipped creation.'
../sentry/config.yml already exists, skipped creation.
++ ensure_file_from_example ../symbolicator/config.yml
++ [[ -f ../symbolicator/config.yml ]]
++ echo '../symbolicator/config.yml already exists, skipped creation.'
../symbolicator/config.yml already exists, skipped creation.
++ ensure_file_from_example ../sentry/requirements.txt
++ [[ -f ../sentry/requirements.txt ]]
++ echo '../sentry/requirements.txt already exists, skipped creation.'
../sentry/requirements.txt already exists, skipped creation.
++ echo ''

+ source generate-secret-key.sh
++ echo '▶ Generating secret key ...'
▶ Generating secret key ...
++ grep -xq 'system.secret-key: '\''!!changeme!!'\''' ../sentry/config.yml
++ echo ''

+ source replace-tsdb.sh
++ echo '▶ Replacing TSDB ...'
▶ Replacing TSDB ...
++ replace_tsdb
++ [[ -f ../sentry/sentry.conf.py ]]
++ grep -xq 'SENTRY_TSDB = "sentry.tsdb.redissnuba.RedisSnubaTSDB"' ../sentry/sentry.conf.py
++ echo ''

+ source update-docker-images.sh
++ echo '▶ Fetching and updating Docker images ...'
▶ Fetching and updating Docker images ...
++ docker-compose --no-ansi pull -q --ignore-pull-failures
++ grep -v -- -onpremise-local
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Some service image(s) must be built from source by running:
    docker-compose build symbolicator-cleanup snuba-transactions-cleanup snuba-cleanup sentry-cleanup
++ docker pull getsentry/sentry:21.6.1
21.6.1: Pulling from getsentry/sentry
Digest: sha256:2fd9160a1fa8be1208da10added416ba420dad25a20bf775cac079ee5e60c71d
Status: Image is up to date for getsentry/sentry:21.6.1
docker.io/getsentry/sentry:21.6.1
++ echo ''

+ source build-docker-images.sh
++ echo '▶ Building and tagging Docker images ...'
▶ Building and tagging Docker images ...
++ echo ''

++ docker-compose --no-ansi build --force-rm
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
smtp uses an image, skipping
memcached uses an image, skipping
redis uses an image, skipping
postgres uses an image, skipping
zookeeper uses an image, skipping
kafka uses an image, skipping
clickhouse uses an image, skipping
geoipupdate uses an image, skipping
snuba-api uses an image, skipping
snuba-consumer uses an image, skipping
snuba-outcomes-consumer uses an image, skipping
snuba-sessions-consumer uses an image, skipping
snuba-transactions-consumer uses an image, skipping
snuba-replacer uses an image, skipping
snuba-subscription-consumer-events uses an image, skipping
snuba-subscription-consumer-transactions uses an image, skipping
symbolicator uses an image, skipping
web uses an image, skipping
cron uses an image, skipping
worker uses an image, skipping
ingest-consumer uses an image, skipping
post-process-forwarder uses an image, skipping
subscription-consumer-events uses an image, skipping
subscription-consumer-transactions uses an image, skipping
relay uses an image, skipping
nginx uses an image, skipping
Building snuba-cleanup
Sending build context to Docker daemon  3.072kB

Step 1/5 : ARG BASE_IMAGE
Step 2/5 : FROM ${BASE_IMAGE}
 ---> 824ef97a4247
Step 3/5 : RUN apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*
 ---> Using cache
 ---> 5489581eb2f2
Step 4/5 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> d7df7bf70e92
Step 5/5 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Using cache
 ---> a96887974a94
Successfully built a96887974a94
Successfully tagged snuba-cleanup-onpremise-local:latest
Building snuba-transactions-cleanup
Sending build context to Docker daemon  3.072kB

Step 1/5 : ARG BASE_IMAGE
Step 2/5 : FROM ${BASE_IMAGE}
 ---> 824ef97a4247
Step 3/5 : RUN apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*
 ---> Using cache
 ---> 5489581eb2f2
Step 4/5 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> d7df7bf70e92
Step 5/5 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Using cache
 ---> a96887974a94
Successfully built a96887974a94
Successfully tagged snuba-cleanup-onpremise-local:latest
Building symbolicator-cleanup
Sending build context to Docker daemon  3.072kB

Step 1/5 : ARG BASE_IMAGE
Step 2/5 : FROM ${BASE_IMAGE}
 ---> 64ccdf50243f
Step 3/5 : RUN apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*
 ---> Using cache
 ---> 29fe2a57c1c6
Step 4/5 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> 2a244629d5bb
Step 5/5 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Using cache
 ---> 4e1b5fb7f6c1
Successfully built 4e1b5fb7f6c1
Successfully tagged symbolicator-cleanup-onpremise-local:latest
Building sentry-cleanup
Sending build context to Docker daemon  3.072kB

Step 1/5 : ARG BASE_IMAGE
Step 2/5 : FROM ${BASE_IMAGE}
 ---> 8528f0dc2278
Step 3/5 : RUN apt-get update && apt-get install -y --no-install-recommends cron &&     rm -r /var/lib/apt/lists/*
 ---> Using cache
 ---> 96586ed6014b
Step 4/5 : COPY entrypoint.sh /entrypoint.sh
 ---> Using cache
 ---> 30ae46ffba84
Step 5/5 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Using cache
 ---> c1430d941dfb
Successfully built c1430d941dfb
Successfully tagged sentry-cleanup-onpremise-local:latest
++ echo ''

++ echo 'Docker images built.'
Docker images built.
++ echo ''

+ source turn-things-off.sh
++ echo '▶ Turning things off ...'
▶ Turning things off ...
++ [[ -n '' ]]
++ docker-compose --no-ansi -p onpremise down -t 60 --rmi local --remove-orphans
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Removing network onpremise_default
Network onpremise_default not found.
++ docker-compose --no-ansi down -t 60 --rmi local --remove-orphans
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Removing network sentry_onpremise_default
++ echo ''

+ source set-up-zookeeper.sh
++ echo '▶ Setting up Zookeeper ...'
▶ Setting up Zookeeper ...
+++ docker-compose --no-ansi run --rm zookeeper bash -c 'ls 2>/dev/null -Ubad1 -- /var/lib/zookeeper/data/version-2 | wc -l | tr -d [:space:]'
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating network "sentry_onpremise_default" with the default driver
Creating sentry_onpremise_zookeeper_run ... 
Creating sentry_onpremise_zookeeper_run ... done
++ ZOOKEEPER_SNAPSHOT_FOLDER_EXISTS='
1'
++ [[ 
1 -eq 1 ]]
set-up-zookeeper.sh: line 4: [[: 
1: syntax error: operand expected (error token is "
1")
++ echo ''

+ source install-wal2json.sh
++ echo '▶ Downloading and installing wal2json ...'
▶ Downloading and installing wal2json ...
++ FILE_TO_USE=../postgres/wal2json/wal2json.so
+++ uname -m
++ ARCH=x86_64
++ FILE_NAME=wal2json-Linux-x86_64-glibc.so
++ DOCKER_CURL='docker run --rm curlimages/curl'
++ [[ latest == \l\a\t\e\s\t ]]
+++ grep '"tag_name":'
+++ sed -E 's/.*"([^"]+)".*/\1/'
+++ docker run --rm curlimages/curl https://api.github.com/repos/getsentry/wal2json/releases/latest
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100  5416  100  5416    0     0   2616      0  0:00:02  0:00:02 --:--:--  2617
++ VERSION=0.0.2
++ [[ ! -n 0.0.2 ]]
++ ls ../postgres/wal2json
0.0.2
++ mkdir -p ../postgres/wal2json
++ ls ../postgres/wal2json
0.0.2
++ '[' '!' -f ../postgres/wal2json/0.0.2/wal2json-Linux-x86_64-glibc.so ']'
++ ls ../postgres/wal2json
0.0.2
++ echo ''

+ source bootstrap-snuba.sh
++ echo '▶ Bootstrapping and migrating Snuba ...'
▶ Bootstrapping and migrating Snuba ...
++ docker-compose --no-ansi run --rm snuba-api bootstrap --no-migrate --force
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_clickhouse_1 ... 
Creating sentry_onpremise_redis_1      ... 
Creating sentry_onpremise_zookeeper_1  ... 
Creating sentry_onpremise_redis_1      ... done
Creating sentry_onpremise_zookeeper_1  ... done
Creating sentry_onpremise_kafka_1      ... 
Creating sentry_onpremise_clickhouse_1 ... done
Creating sentry_onpremise_kafka_1      ... done
Creating sentry_onpremise_snuba-api_run ... 
Creating sentry_onpremise_snuba-api_run ... done
2021-06-18 02:42:11,953 Attempting to connect to Kafka (attempt 0)...
2021-06-18 02:42:14,008 Attempting to connect to Kafka (attempt 1)...
2021-06-18 02:42:16,017 Attempting to connect to Kafka (attempt 2)...
2021-06-18 02:42:18,030 Attempting to connect to Kafka (attempt 3)...
2021-06-18 02:42:18,061 Connected to Kafka on attempt 3
2021-06-18 02:42:18,062 Creating Kafka topics...
++ docker-compose --no-ansi run --rm snuba-api migrations migrate --force
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_snuba-api_run ... 
Creating sentry_onpremise_snuba-api_run ... done
Finished running migrations
++ echo ''

+ source create-kafka-topics.sh
++ echo '▶ Creating additional Kafka topics ...'
▶ Creating additional Kafka topics ...
+++ docker-compose --no-ansi run --rm kafka kafka-topics --list --bootstrap-server kafka:9092
++ EXISTING_KAFKA_TOPICS='__consumer_offsets
cdc
event-replacements
event-replacements-legacy
events
events-subscription-results
ingest-attachments
ingest-events
ingest-metrics
ingest-sessions
ingest-transactions
outcomes
snuba-commit-log
snuba-queries
transactions-subscription-results
'
++ NEEDED_KAFKA_TOPICS='ingest-attachments ingest-transactions ingest-events'
++ for topic in '$NEEDED_KAFKA_TOPICS'
++ echo '__consumer_offsets
cdc
event-replacements
event-replacements-legacy
events
events-subscription-results
ingest-attachments
ingest-events
ingest-metrics
ingest-sessions
ingest-transactions
outcomes
snuba-commit-log
snuba-queries
transactions-subscription-results
'
++ grep -wq ingest-attachments
++ for topic in '$NEEDED_KAFKA_TOPICS'
++ grep -wq ingest-transactions
++ echo '__consumer_offsets
cdc
event-replacements
event-replacements-legacy
events
events-subscription-results
ingest-attachments
ingest-events
ingest-metrics
ingest-sessions
ingest-transactions
outcomes
snuba-commit-log
snuba-queries
transactions-subscription-results
'
++ for topic in '$NEEDED_KAFKA_TOPICS'
++ grep -wq ingest-events
++ echo '__consumer_offsets
cdc
event-replacements
event-replacements-legacy
events
events-subscription-results
ingest-attachments
ingest-events
ingest-metrics
ingest-sessions
ingest-transactions
outcomes
snuba-commit-log
snuba-queries
transactions-subscription-results
'
++ echo ''

+ source upgrade-postgres.sh
++ echo '▶ Ensuring proper PostgreSQL version ...'
▶ Ensuring proper PostgreSQL version ...
+++ docker volume ls -q --filter name=sentry-postgres
++ [[ -n sentry-postgres ]]
+++ docker run --rm -v sentry-postgres:/db busybox cat /db/PG_VERSION
++ [[ '' == \9\.\5 ]]
++ echo ''

+ source set-up-and-migrate-database.sh
++ echo '▶ Setting up / migrating database ...'
▶ Setting up / migrating database ...
++ [[ -n '' ]]
++ [[ 0 == 1 ]]
++ docker-compose --no-ansi run --rm web upgrade
--no-ansi option is deprecated and will be removed in future versions. Use `--ansi never` instead.
Creating sentry_onpremise_postgres_1 ... 
Creating sentry_onpremise_symbolicator_1 ... 
Creating sentry_onpremise_smtp_1         ... 
Creating sentry_onpremise_memcached_1    ... 
Creating sentry_onpremise_snuba-subscription-consumer-events_1 ... 
Creating sentry_onpremise_snuba-subscription-consumer-transactions_1 ... 
Creating sentry_onpremise_snuba-sessions-consumer_1                  ... 
Creating sentry_onpremise_snuba-outcomes-consumer_1                  ... 
Creating sentry_onpremise_snuba-transactions-consumer_1              ... 
Creating sentry_onpremise_snuba-api_1                                ... 
Creating sentry_onpremise_snuba-replacer_1                           ... 
Creating sentry_onpremise_snuba-consumer_1                           ... 
Creating sentry_onpremise_memcached_1                                ... done
Creating sentry_onpremise_snuba-subscription-consumer-transactions_1 ... done
Creating sentry_onpremise_symbolicator_1                             ... done
Creating sentry_onpremise_snuba-outcomes-consumer_1                  ... done
Creating sentry_onpremise_snuba-transactions-consumer_1              ... done
Creating sentry_onpremise_snuba-subscription-consumer-events_1       ... done
Creating sentry_onpremise_snuba-sessions-consumer_1                  ... done
Creating sentry_onpremise_snuba-api_1                                ... done
Creating sentry_onpremise_postgres_1                                 ... done
Creating sentry_onpremise_snuba-replacer_1                           ... done
Creating sentry_onpremise_snuba-consumer_1                           ... done
Creating sentry_onpremise_smtp_1                                     ... done
Creating sentry_onpremise_web_run                                    ... 
Creating sentry_onpremise_web_run                                    ... done
02:42:40 [WARNING] sentry.utils.geo: Error opening GeoIP database: /geoip/GeoLite2-City.mmdb
02:42:40 [WARNING] sentry.utils.geo: Error opening GeoIP database in Rust: /geoip/GeoLite2-City.mmdb
02:43:23 [INFO] sentry.plugins.github: apps-not-configured
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "postgres" to address: Name or service not known


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/__init__.py", line 196, in main
    func(**kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/decorators.py", line 29, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 171, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair, with_nodestore)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 118, in _upgrade
    _migrate_from_south(verbosity)
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 90, in _migrate_from_south
    if not _has_south_history(connection):
  File "/usr/local/lib/python3.6/site-packages/sentry/runner/commands/upgrade.py", line 75, in _has_south_history
    cursor = connection.cursor()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 254, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.6/site-packages/sentry/db/postgres/decorators.py", line 40, in inner
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/sentry/db/postgres/base.py", line 96, in _cursor
    return super()._cursor()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 229, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
    self.connect()
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/base/base.py", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python3.6/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not translate host name "postgres" to address: Name or service not known

1
+++ cleanup ERR 12
+++ [[ 0 -eq 1 ]]
+++ DID_CLEAN_UP=1
+++ [[ ERR != \E\X\I\T ]]
+++ echo 'An error occurred, caught SIGERR on line 12'
An error occurred, caught SIGERR on line 12
+++ [[ -n '' ]]
+++ echo 'Cleaning up...'
Cleaning up...
+++ [[ -z '' ]]
+++ docker-compose --no-ansi stop -t 60
+ cleanup EXIT 1
+ [[ 1 -eq 1 ]]
+ return 0

And postgres container logs as below:

Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory
Setting up Change Data Capture
Replication config already present in pg_hba. Not changing anything.
cp: cannot stat '/opt/sentry/wal2json/wal2json.so': No such file or directory

Any one can solve this ? Thanks.

Downgrade to 21.5.1, no this problem.

How about 21.6.3? It includes some changes to install-wal2json.sh that might be relevant.

Hello @chadwhitacre .

I am having the same problem. Sentry deploy works with 21.5.1. But when I try any version from 21.6.0 (21.6.3 too) to 21.8.0 I receive the error in postgres container:
“cp: cannot stat ‘/opt/sentry/wal2json/wal2json.so’: No such file or directory”

I’m sorry, I’ve just used command docker-compose up -d that was a problem. We have to use install.sh script first and it works with 21.6.3.
Thanks.