Postgres error occured when running './install.sh'

Hi,i use ubuntu & docker to build sentry v9.1.2. But when i run ‘./install.sh’, some errors occured.

==================

django.db.utils.OperationalError: could not translate host name “postgres” to address: Temporary failure in name resolution

I am new for sentry, and i don’t know how to fix it.

And If i use sentry v21.10.0 , there is another error occured with postgres when running ‘./install.sh’

===============

FATAL: no pg_hba.conf entry for host “192.168.32.18”, user “postgres”, database “postgres”, SSL off

Here is the logs I found after I running docker container logs --follow sentry_onpremise_nginx_1

======================

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
172.18.0.1 - - [25/Oct/2021:08:03:39 +0000] “GET / HTTP/1.1” 302 0 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
2021/10/25 08:03:56 [error] 22#22: *2 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: “GET /auth/login/ HTTP/1.1”, upstream: “(new user can only put 2links, so i block this link)/auth/login/”, host: “localhost:9000”
172.18.0.1 - - [25/Oct/2021:08:03:56 +0000] “GET /auth/login/ HTTP/1.1” 502 552 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
172.18.0.1 - - [25/Oct/2021:08:03:56 +0000] “GET /favicon.ico HTTP/1.1” 404 0 “http: //localhost:9000/auth/login/” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
172.18.0.1 - - [25/Oct/2021:08:04:18 +0000] “GET /auth/login/ HTTP/1.1” 499 0 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
172.18.0.1 - - [25/Oct/2021:08:04:18 +0000] “GET / HTTP/1.1” 302 0 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
2021/10/25 08:04:35 [error] 22#22: *8 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: “GET /auth/login/ HTTP/1.1”, upstream: “(new user can only put 2links, so i block this link)/auth/login/”, host: “localhost:9000”
172.18.0.1 - - [25/Oct/2021:08:04:35 +0000] “GET /auth/login/ HTTP/1.1” 502 552 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”
2021/10/25 08:10:01 [error] 22#22: *14 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: “GET /auth/login/ HTTP/1.1”, upstream: “(new user can only put 2links, so i block this link)/auth/login/”, host: “localhost:9000”
172.18.0.1 - - [25/Oct/2021:08:10:01 +0000] “GET /auth/login/ HTTP/1.1” 502 552 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36” “-”

to build sentry v9.1.2

Why such an old version? Can you use a more recent version?

Yes, i have tried v21.10.0, but it failed again with postgres. :sob:

the log is:

FATAL: no pg_hba.conf entry for host “192.168.32.18”, user “postgres”, database “postgres”, SSL off

And i can’t find the file which is to setup pg_hba.conf.

I fix it !!! finally~
It seems like the problem with the security policy with postgres.

I change the cdc_setup_hba_conf method in postgres-entrypoint.sh like this

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+all" "$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
}

and init_hba.sh like this:

{ echo "host all all all trust"; } >> "$PGDATA/pg_hba.conf"

and then it works!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.