-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Postgres not recognizing the user #1678
Comments
If I run the command Edit: Also tried change the user password in the DB that the user must have access |
Are you running the |
@emilepetrone eval what? mind helping me out? |
https://cookiecutter-django.readthedocs.io/en/latest/developing-locally-docker.html?highlight=Eval
This way you are sending commands to the right machine. |
@emilepetrone I don't have docker-machine installed, it would make a difference if I install and try to use the |
I've tried to alter the user password on all of the databases, still getting the same error. |
@sconetto The issue is most likely that you think you are working with your production machine - but actually are working with the production settings locally (at least that is what I did). To work with your production machine you need to run:
|
@emilepetrone what is strange to me is that I don't configured any docker-machine on my host, I just configured the .env files and built the containers with |
This issue might be related: docker-library/postgres#203 |
I've tried to change my DB_NAME to be the same as my DB_USER, now when I run postgres_1 | 2018-06-21T17:05:20.394067049Z 2018-06-21 17:05:20.393 UTC [164] FATAL: password authentication failed for user "drdown"
postgres_1 | 2018-06-21T17:05:20.394205209Z 2018-06-21 17:05:20.393 UTC [164] DETAIL: Password does not match for user "drdown".
postgres_1 | 2018-06-21T17:05:20.405545257Z Connection matched pg_hba.conf line 95: "host all all all md5"
postgres_1 | 2018-06-21T17:05:21.658483913Z 2018-06-21 17:05:21.658 UTC [165] FATAL: password authentication failed for user "drdown"
postgres_1 | 2018-06-21T17:05:21.658531473Z 2018-06-21 17:05:21.658 UTC [165] DETAIL: Password does not match for user "drdown".
postgres_1 | 2018-06-21T17:05:21.658538458Z Connection matched pg_hba.conf line 95: "host all all all md5" any workaround guys? I need to deliver the project next week 😞 Edit 1: I've tried now to add the environment variables into the |
@sconetto Is it possible that you generate the project more than once? In this scenario you get the error that you mention in your first post here. Here is what happens:
If that is the case, and your object is to start a fresh production environment then you can delete the postgres volume. |
@demestav That was not the case, I've only generated the project one time, when I was configuring I removed all the volumes and containers, so for me, I think, this shouldn't happen, still having the issue but now the project is on a pause. Although thank you for trying to help! |
@demestav That's my issue, but killing all docker containers and deleting all images didn't fix it. Edit: Had to delete the docker volumes
|
I think a lot of people (my past self included) are hitting this issue because of a gotcha of how Docker works and cache resources. It's not obvious that if you re-generate the same project from scratch with the same name, Docker will re-use pre-existing resources, it took me some deeper understanding of Docker to get that. Because of the nature of this project, I think it's expected to be used by people with little experience with Docker. We could add some documentation or link to external docs regarding how Docker caching may have cross-projects side effects. It's pretty common for people to generate the same project multiple times when they realise they messed up something and want to start over... What do folks think of a disclaimer at the top of the Docker documentation? PS: if you want to clear your ENTIRE Docker cache/volumes/networks, you can do so with |
@browniebroke This project I was working on is now over, but I think you may be right, the nature of cookie cutter is to help people with little, maybe none, experience with Docker or Django, to get started. So, at least, I'm on board with the disclaimer to aim this issue and help people! |
@browniebroke Yes I also agree with the addition of a disclaimer. On a related note, I was thinking that having few shortcut commands about docker, could benefit both new and experienced docker users. For example, |
Where did your {{project_name}} come from in the volumes? I actually need to include the project name because I have this issue when running multiple projects. EDIT: nvm, this is of course done through Still, if one forgets to add the Maybe add a |
@svleeuwen it looks docker-compose should default to using the directory name for that option, which I believe is the case for me. Docker forum thread on automatic prepending: https://forums.docker.com/t/docker-compose-prepends-directory-name-to-named-volumes/32835/7 |
I experienced this issue after destroying a project and creating a new one with the same name and DB name at a later date. @demestav's comment from 2018 - #1678 (comment) is correct. Docker will use the same container from the previous project.
|
I can confirm the solution is to run: |
hi, Faced the same issue you need to recreate your existing docker network and try it once, hope it helps. |
I appreciate this thread. My scenario was a bit different. I had first brought up the containers using local.yml, shut them down, then brought up the containers using production.yml. Deleting the production volumes fixed my problem: |
Not sure if it is precisely relevant to this scenario, but I've had a test environment where the password for a user got corrupted. After extensive testing I had to change the password in the postgresql database for the user to something else "adsf" or whatever, and then back to desired password. It worked, did not have to delete/recreate volumes at all. I was pulling the whole thing from a public helm chart, so I wasn't actually making the images myself. |
I had the same issue with user being un-recognized, I managed to log in to the DB using psql -U <POSTGRES_USER> <POSTGRES_DB> when in the postgres container ! Values are to find in |
What happened?
On the production environment the postgre container can't connect to the DB saying that the user that is configured in the .env file can't connect to the DB
Some log:
What should've happened instead?
Connect to the DB and run the application
Steps to reproduce
Don't know to reproduce and don't which files can help figure this out (new on this)
Host system configuration:
p.s.: apologizes for my english, I'm actually Brazilian.
The text was updated successfully, but these errors were encountered: