Issues when changing password in .env and docker-compose.yml
ShadowCrafter011 opened this issue · comments
Everything worked well I cloned the repository and followerd the setup steps but because I changed the postgres password when running the third setup set I ran into an authentication error for postgres.
PG::ConnectionBad: FATAL: password authentication failed for user "postgres"
I assume I have to change the password somewhere else. I just can't figure out where that is.
I would be grateful if anyone could help me
Assuming you have a .env
file in the root folder, update the PGPASSWORD
variable in there to match the value of the password in the database's service definition in docker-compose.yml (https://github.com/ryanwi/rails7-on-docker/blob/main/docker-compose.yml#L22)
You can also try hardcoding directly in the rails database config as a first step to make sure things are working https://github.com/ryanwi/rails7-on-docker/blob/main/config/database.yml#L32.
I got it working by changing the password in the .env and docker-compose.yml file. But I also had to log in to postgres using the old password and altering it from there
I got it to work, by:
- Change password in .env file
- Change password in docker-compose.yml
- Remove docker volume
rails7-on-docker_pg_data
(docker volume rm [container ID]
) - Start app normally with
docker compose up
- Run now advised
docker compose run --rm web bin/rails db:setup