Postgres authentication error makes it impossible to run local and production on same machine (with Docker)
Unless I have misunderstood, this should be possible, per commit message https://github.com/pydanny/cookiecutter-django/commit/ae9dc2e782ccd734ef0dbe136960b09a8da1a760
building production stack on the same machine with local doesn't lead to conflicts anymore;
docker-compose -f local.yml build
docker-compose -f local.yml up
(hit Ctrl+C)
docker-compose -f production.yml build
docker-compose -f production.yml up
Oh dear.
postgres_1 | 2018-09-05 00:25:29.091 UTC [32] FATAL: password authentication failed for user "TjEvhJFUDaxcudETRTQzGgiJqryGIEOM"
postgres_1 | 2018-09-05 00:25:29.091 UTC [32] DETAIL: Password does not match for user "TjEvhJFUDaxcudETRTQzGgiJqryGIEOM".
postgres_1 | Connection matched pg_hba.conf line 95: "host all all all md5"
django_1 | Waiting for PostgreSQL to become available...
project_name [My Awesome Project]:
project_slug [my_awesome_project]:
description [Behold My Awesome Project!]:
author_name [Daniel Roy Greenfeld]:
domain_name [example.com]:
email [[email protected]]:
version [0.1.0]:
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]:
timezone [UTC]:
windows [n]:
use_pycharm [n]:
use_docker [n]: y
Select postgresql_version:
1 - 10.4
2 - 10.3
3 - 10.2
4 - 10.1
5 - 9.6
6 - 9.5
7 - 9.4
8 - 9.3
Choose from 1, 2, 3, 4, 5, 6, 7, 8 [1]:
Select js_task_runner:
1 - None
2 - Gulp
Choose from 1, 2 [1]:
custom_bootstrap_compilation [n]:
use_compressor [n]:
use_celery [n]:
use_mailhog [n]:
use_sentry [n]: y
use_whitenoise [n]: y
use_heroku [n]:
use_travisci [n]:
keep_local_envs_in_vcs [y]:
debug [n]:
Thanks for the bug report and investigation, I think there might indeed be a typo in the commit you link to...
The prod and local images should have different credentials, which are set from the environment in the base Postgres image when we build it.
When building the local image with the local settings, the ..._production_postgres image is built with the local username & password:
Then, when starting the prod stack, compose re-uses the existing image, but the rest of the stack tries to connect to it with the prod credentials, but it's been started with the local credentials, with the error you're getting.
Have you tried to replace ..._production_postgres with ..._local_postgres? Does it fix the problem? Note that you might have to clear the postgres containers, images & volumes...
This may be a bug, but why would you want to build both local and production on the same machine?
@browniebroke Appreciate you getting back to me. I'll try this today and report back.
@sfdye Current project requires 4 separate environments: dev, test, production and demo. We're early enough stage that it doesn't make sense to use a separate server for each.
@chase4646 mind trying it out again, with our latest master?
Will struggle as now full time on another project...
Anyone else with this issue able to confirm?
On Thu, 1 Nov 2018, 10:35 Nikita Shupeyko, notifications@github.com wrote:
@chase4646 https://github.com/chase4646 mind trying it out again, with
our latest master?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/pydanny/cookiecutter-django/issues/1785#issuecomment-435000546,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXwjy2JkIGt2efLB2D_gGQNrGqocx_WGks5uqs6OgaJpZM4WZ_Um
.
I have the same issue with postgresql service not being started on up command. Did initialize my project today with latest master.
I have this issue from time to time after rebuilding. Only using local configs. I usually have to run both docker system prune and docker volume prune.
I am currently having this issue as well. It's trying to run production postgres even tho local.yml was used.
update: i just tried @steverecio prune's and it appears to work now.
Closing as duplicate of #1678
Most helpful comment
I have the same issue with postgresql service not being started on
upcommand. Did initialize my project today with latest master.