Issue Summary

Today we setup EC2 instance according to https://redash.io/help/open-source/setup#aws .

After setup, redash worked perfectly.

But we execute sudo -E docker-compose up -d command, then Internal Server Error always occurs. (No fix in /opt/redash/env file.)

According to sudo -E docker-compose logs result of this command, the following error occurred.

OperationalError: (psycopg2.OperationalError) FATAL:  password authentication failed for user "postgres"

What is the reason for this error?

Seems like your containers started with the wrong configuration. Try stopping all the containers and run the compose command from /opt/redash.

Thank you for your reply. After new instance is created,

cd /opt/redash
sudo docker-compose up -d

It is still Internal Server Error. AMIs version 5.0.1 are having some problems?

sudo docker-compose down
sudo docker-compose up -d

I tried it like this, but it did not solve it.

I have exactly same issue

2 Likes

Do you still see the same error in the logs?

I just posted about the exact same issue.

1 Like

Yes.

server_1            |   File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
server_1            |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
server_1            | OperationalError: (psycopg2.OperationalError) FATAL:  password authentication failed for user "postgres"
server_1            |  (Background on this error at: http://sqlalche.me/e/e3q8)
server_1            | [2018-10-11 01:59:54,183][PID:14][INFO][metrics] method=GET path=/login endpoint=redash_login status=500 content_type=? content_length=-1 duration=13.08 query_count=0 query_duration=0.00

Check the content of /opt/redash/env: is the password set in POSTGRES_PASSWORD same as the one in REDASH_DATABASE_URL?

Got the AMI and trying to set up to play around.

Was following these instructions, updated the configs, and tried to re-start docker. When re-accessing the app from the browser, I get the following message.

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

On the server logs, I see

scheduler_1 | OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user “postgres”

Anybody know what’s up?

The password is a default password written on /opt/redash/env (not editted.)

If you do yourself on EC2 using provided AMI by redash, the problem will be reproduced.

I managed to reproduce this. The issue is the following: when the Postgres container is run for the first time it creates its configuration and after that point you can no longer change the postgres user password.

When the instance boots we update the COOKIE SECRET and Postgres password to new values, so that not all the instances share the same ones. But for Postgres this has no effect.

To fix this, update your /opt/redash/env files to includes the following values:

POSTGRES_PASSWORD=26aeSTZnG2NpumVfD8AyWXtqaggmuOrJ
REDASH_DATABASE_URL=postgresql://postgres:26aeSTZnG2NpumVfD8AyWXtqaggmuOrJ@postgres/postgres

As an alternative, you can login to Postgres with the above password and update the password of the postgres user to use the new one that was generated by your instance. This is actually more secure.

We will create new AMIs now to avoid this issue for future users.

1 Like

I solved this problem completely according to the solution, thank you!

1 Like

@arikfr

I have the very same issue, however, the POSTGRES_PASSWORD you gave does not work for me.

I am using the redash-5-0-1 gcloud image from the example at https://redash.io/help/open-source/setup#-google-compute-engine

Hello
I have the very same issue -(
run ./setup.sh
error
File “/usr/local/lib/python2.7/dist-packages/psycopg2/init.py”, line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user “postgres”

Any update? I also tried arikfr solution that says to edit env file, but got 500 Internal Server Error

Same here I tried Arik solution and it does not work. I edited /opt/redash/env but then same error message appear when running ./setup.

1 Like

In what environment do you host Redash? Docker? AMI?

Hi there,
Thank you for your answer, with Docker.

If I apply the technique described by Arik, I will get the following question during the setup process:
“rm: remove write-protected regular file ‘/opt/redash/env’?”
which will rewrite the credentials we just wrote in env.

Could you tell me what to do here?

Thank you