Redash: After upgrade to 5.0 (with docker-compose): failed to connect to server

Created on 15 Oct 2018  路  8Comments  路  Source: getredash/redash

Everything was working fine and we upgraded form v3 to v4 to v5 with the docker-compose upgrade command, and the redash UI is loading fine, but cannot execute any query.

The UI displays an error: Error running query: (psycopg2.OperationalError) could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

And the docker-compose logs shows the following:

redash-worker | [2018-10-15 10:40:30,331][PID:46][INFO][Worker-13] waiting tracker 14a3e1bd6ffb17fda50f3ef34071f77f finished
redash-worker | [2018-10-15 10:40:30,332][PID:46][INFO][Worker-13] waiting tracker e321600e578ecd0d5e4bbfd0cb7eb0a7 finished
redash-worker | [2018-10-15 10:40:30,333][PID:1][INFO][MainProcess] Task redash.tasks.cleanup_tasks[bd77acf9-104f-45f6-a037-b54e64f638fd] succeeded in 0.0124485739998s: None
redash-worker | [2018-10-15 10:40:30,377][PID:14][INFO][Beat] Scheduler: Sending due task refresh_queries (redash.tasks.refresh_queries)
redash-worker | [2018-10-15 10:40:30,380][PID:1][INFO][MainProcess] Received task: redash.tasks.refresh_queries[29fcf6b1-9873-425d-ac6e-0972299e6bd3]
redash-worker | [2018-10-15 10:40:30,381][PID:49][INFO][Worker-14] task_name=redash.tasks.refresh_queries task_id=29fcf6b1-9873-425d-ac6e-0972299e6bd3 Refreshing queries...
redash-worker | [2018-10-15 10:40:30,390][PID:1][ERROR][MainProcess] Task redash.tasks.refresh_queries[29fcf6b1-9873-425d-ac6e-0972299e6bd3] raised unexpected: OperationalError('(psycopg2.OperationalError) could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?\n',)

Any ideas?
Thank you so much

Most helpful comment


The docker-compose.yml file we use:

version: '3'

services:

  server:
    image: redash/redash:latest
    container_name: redash
    restart: unless-stopped
    command: server
    depends_on:
      - postgres
      - redis
    ports:
      - "6000:5000"

    environment:
      PYTHONUNBUFFERED: 0
      REDASH_HOST: https://xxx
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      REDASH_COOKIE_SECRET: xxxx
      REDASH_WEB_WORKERS: 4
      VIRTUAL_HOST: xxx
      VIRTUAL_PORT: 5000
      LETSENCRYPT_HOST: xxx
      LETSENCRYPT_EMAIL: gitlab@xxx
      REDASH_MAIL_SERVER: "ssl0.ovh.net"
      REDASH_MAIL_PORT: "587"
      REDASH_MAIL_USE_TLS: "true"
      REDASH_MAIL_USE_SSL: "false"
      REDASH_MAIL_USERNAME: "gitlab@xxx"
      REDASH_MAIL_PASSWORD: xxxx
      REDASH_MAIL_DEFAULT_SENDER: "no-reply@xxx"

  worker:
    image: redash/redash:latest
    container_name: redash-worker
    command: scheduler
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      QUEUES: "queries,scheduled_queries,celery"
      WORKERS_COUNT: 2
      REDASH_MAIL_SERVER: "ssl0.ovh.net"
      REDASH_MAIL_PORT: "587"
      REDASH_MAIL_USE_TLS: "true"
      REDASH_MAIL_USE_SSL: "false"
      REDASH_MAIL_USERNAME: "gitlab@xxx"
      REDASH_MAIL_PASSWORD: "xxxx"
      REDASH_MAIL_DEFAULT_SENDER: "no-reply@xxx"
    restart: always

  redis:
    container_name: redash-redis
    image: redis:3.0-alpine
    restart: always

  postgres:
    container_name: redash-db
    image: postgres:9.5.6-alpine
    restart: always
    volumes:
      - ./data:/var/lib/postgresql/data

networks:
  default:
    external:
      name: nginx-proxy

All 8 comments


The docker-compose.yml file we use:

version: '3'

services:

  server:
    image: redash/redash:latest
    container_name: redash
    restart: unless-stopped
    command: server
    depends_on:
      - postgres
      - redis
    ports:
      - "6000:5000"

    environment:
      PYTHONUNBUFFERED: 0
      REDASH_HOST: https://xxx
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      REDASH_COOKIE_SECRET: xxxx
      REDASH_WEB_WORKERS: 4
      VIRTUAL_HOST: xxx
      VIRTUAL_PORT: 5000
      LETSENCRYPT_HOST: xxx
      LETSENCRYPT_EMAIL: gitlab@xxx
      REDASH_MAIL_SERVER: "ssl0.ovh.net"
      REDASH_MAIL_PORT: "587"
      REDASH_MAIL_USE_TLS: "true"
      REDASH_MAIL_USE_SSL: "false"
      REDASH_MAIL_USERNAME: "gitlab@xxx"
      REDASH_MAIL_PASSWORD: xxxx
      REDASH_MAIL_DEFAULT_SENDER: "no-reply@xxx"

  worker:
    image: redash/redash:latest
    container_name: redash-worker
    command: scheduler
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
      QUEUES: "queries,scheduled_queries,celery"
      WORKERS_COUNT: 2
      REDASH_MAIL_SERVER: "ssl0.ovh.net"
      REDASH_MAIL_PORT: "587"
      REDASH_MAIL_USE_TLS: "true"
      REDASH_MAIL_USE_SSL: "false"
      REDASH_MAIL_USERNAME: "gitlab@xxx"
      REDASH_MAIL_PASSWORD: "xxxx"
      REDASH_MAIL_DEFAULT_SENDER: "no-reply@xxx"
    restart: always

  redis:
    container_name: redash-redis
    image: redis:3.0-alpine
    restart: always

  postgres:
    container_name: redash-db
    image: postgres:9.5.6-alpine
    restart: always
    volumes:
      - ./data:/var/lib/postgresql/data

networks:
  default:
    external:
      name: nginx-proxy

Considering that the app works, I assume this errors comes from the query runner. Check the data source settings, to make sure they make sense and have a host setup.

Data source is MongoDB and the "test connexion" results with a success

You have a typo in your REDASH_DATABASE_URL value for the worker container: postgresql:///... (note 3 times / instead of 2). I guess this is why it tries to connect to a socket file.

Sorry I'm always trying to change that between postgresql://postgres@postgres/postgres which leads to (psycopg2.OperationalError) fe_sendauth: no password supplied issues and postgresql:///postgress which leads to could not connect to server

When I remove the 3 / to put // instead it just fails to instantiate and even the UI crashes with an Interval Server Error

At least in the comment you have another type: .../postgress instead of ../postgres (double s). You should use the exact same value that you used for the server container.

Just a typo here, it's correct in the docker-compose file.
I have REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres" in the server container and REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres" in the worker container, and the result of the docker-compose up -d command is:
OperationalError: (psycopg2.OperationalError) fe_sendauth: no password supplied

(I'm guessing we have no password for the postgres user, and when I add one in the postgress sql it just ends up with a failed authentication error)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

idoDavid picture idoDavid  路  3Comments

arikfr picture arikfr  路  3Comments

atharvai picture atharvai  路  4Comments

ccakes picture ccakes  路  3Comments

susodapop picture susodapop  路  3Comments