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

Docker's Database creation doesn`t have into account the variable DB_NAME #271

Closed
dersteppenwolf opened this issue Jul 30, 2019 · 4 comments

Comments

@dersteppenwolf
Copy link

commented Jul 30, 2019

Docker's Database creation doesn`t have into account the variable DB_NAME
See:

until psql -h "${DB_HOST}" -U "${DB_USER}" -c '\l'; do

Doesn´t work if the database doesn´t have the same name as the user

@justb4

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

@dersteppenwolf Can you expand on your setup? The database (PostgreSQL) should run within another Docker Postgres container (where the DB is created). The line above merely tests if the DB host/service is available, trying to list all the DB's within the PG server (\l command), hence ${DB_NAME} is not required.

But does it work for you if you add ${DBNAME} ? Like

until psql -h "${DB_HOST}" -U "${DB_USER}" -c '\l' ${DBNAME}; do

@dersteppenwolf

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

until psql -h "${DB_HOST}" -U "${DB_USER}" -c '\l' ${DBNAME}; do

Surely in that way it works.
The user I´m using has limited privileges, so that could be the problem.

best.

@justb4

This comment has been minimized.

Copy link
Member

commented Aug 31, 2019

Think pg_isready is a better option: https://www.postgresql.org/docs/10/app-pg-isready.html
Will try that.

@justb4 justb4 self-assigned this Aug 31, 2019

@justb4 justb4 added the bug label Aug 31, 2019

@justb4 justb4 added this to the Version 0.7.0 milestone Aug 31, 2019

@justb4 justb4 added this to In progress in FOSS4G 2019 CodeSprint Aug 31, 2019

justb4 added a commit that referenced this issue Aug 31, 2019

@justb4 justb4 moved this from In progress to Done in FOSS4G 2019 CodeSprint Aug 31, 2019

@justb4

This comment has been minimized.

Copy link
Member

commented Aug 31, 2019

pg_isready works and is in latest GHC Docker version.

@justb4 justb4 closed this Aug 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.