Redash installation failed on Ubuntu 20.04: "password authentification failed for user 'postgres'"

Issue Summary

I never get the database connection to work if I try to run the docker-compose command. Or do I have to run “follow-up” commands, to finish the installation?

I read this thread: FATAL: password authentication failed for user "postgres", after "docker-compose up -d" on your EC2 AMI - #12 by arikfr

But it still fails :confused:

After running docker-compose, everything seems to be smoothly running, until I do

wget localhost.
--2021-11-24 11:17:53-- http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: http://localhost/login?next=http%3A%2F%2Flocalhost%2F [following]
--2021-11-24 11:17:53-- http://localhost/login?next=http%3A%2F%2Flocalhost%2F
Reusing existing connection to localhost:80.
TTP request sent, awaiting response... 500 INTERNAL SERVER ERROR 2021-11-24 11:17:53 ERROR 500: INTERNAL SERVER ERROR.

sudo docker logs data_postgres_1
PostgreSQL Database directory appears to contain a database; Skipping initialization LOG: database system was interrupted; last known up at 2021-11-24 10:53:15 UTC LOG: database system was not properly shut down; automatic recovery in progress LOG: invalid record length at 0/14EEEF8: wanted 24, got 0 LOG: redo is not required LOG: MultiXact member wraparound protections are now enabled LOG: database system is ready to accept connections LOG: autovacuum launcher started FATAL: password authentication failed for user “postgres” DETAIL: Password does not match for user “postgres”. Connection matched pg_hba.conf line 95: “host all all all md5” FATAL: password authentication failed for user “postgres” DETAIL: Password does not match for user “postgres”. Connection matched pg_hba.conf line 95: “host all all all md5”

My docker-compose file

version: "2"
x-redash-service: &redash-service
  image: redash/redash:10.1.0.b50633
  depends_on:
    - postgres
    - redis
  env_file: /opt/redash/env
  restart: always
services:
  server:
    <<: *redash-service
    command: server
    ports:
      - "5000:5000"
    environment:
      REDASH_WEB_WORKERS: 4
  scheduler:
    <<: *redash-service
    command: scheduler
  scheduled_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "scheduled_queries,schemas"
      WORKERS_COUNT: 1
  adhoc_worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "queries"
      WORKERS_COUNT: 2
  worker:
    <<: *redash-service
    command: worker
    environment:
      QUEUES: "periodic emails default"
      WORKERS_COUNT: 1
  redis:
    image: redis:5.0-alpine
    restart: always
  postgres:
    image: postgres:9.6-alpine
    env_file: /opt/redash/env
    volumes:
      - /opt/redash/postgres-data:/var/lib/postgresql/data
    restart: always
  nginx:
    image: redash/nginx:latest
    ports:
      - "80:80"
    depends_on:
      - server
    links:
      - server:redash
    restart: always

My env file

PYTHONUNBUFFERED=0 REDASH_LOG_LEVEL=INFO REDASH_REDIS_URL=redis://redis:6379/0 POSTGRES_PASSWORD=2ncXTlL03k8uqzlDFtInlNHEh7YBEwDX REDASH_COOKIE_SECRET=VcL08bwCD4n4DJOUBc7mQZQiUyLSprRk REDASH_SECRET_KEY=puM2FMpI1NokVaqGKwfwuD9aYiUFrHHL REDASH_DATABASE_URL=postgresql://postgres:2ncXTlL03k8uqzlDFtInlNHEh7YBEwDX@postgres/postgres

Technical details:

  • Redash Version: 10.0.1
  • Browser/OS: Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal
  • How did you install Redash: Using docker-compose

If you’re installing from the setup script, this tends to happen when you do the installation of Redash for a 2nd time, but forget to remove the “postgres-data” directory before hand.

So, the setup runs and generates a new configuration… but the existing PostgreSQL database is seen and used (with the old values, including the old password). So, things don’t work at that point.

Assuming this is supposed to be a totally fresh installation of Redash (eg you don’t need to keep the existing Redash database), you should be able to:

  1. Shut down the docker containers (docker-compose down)
  2. Wipe the /opt/redash directory (rm -rf /opt/redash)
  3. Then run the setup.sh script again
1 Like

worked, thanks a lot for the help!

1 Like