Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues when changing password in .env and docker-compose.yml #165

Open
ShadowCrafter011 opened this issue Sep 14, 2022 · 3 comments
Open

Comments

@ShadowCrafter011
Copy link

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

@ryanwi
Copy link
Owner

ryanwi commented Sep 14, 2022

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.

@ShadowCrafter011
Copy link
Author

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

@alexkhalevine
Copy link

I got it to work, by:

  1. Change password in .env file
  2. Change password in docker-compose.yml
  3. Remove docker volume rails7-on-docker_pg_data (docker volume rm [container ID])
  4. Start app normally with docker compose up
  5. Run now advised docker compose run --rm web bin/rails db:setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants