Skip to content

Don't pollute output when testing Postgres connection#33

Closed
aaa2000 wants to merge 1 commit into
api-platform:masterfrom
aaa2000:fix-output-when-waiting-postgres
Closed

Don't pollute output when testing Postgres connection#33
aaa2000 wants to merge 1 commit into
api-platform:masterfrom
aaa2000:fix-output-when-waiting-postgres

Conversation

@aaa2000

@aaa2000 aaa2000 commented Sep 19, 2018

Copy link
Copy Markdown
Contributor

Following issue #31 and the comment #31 (comment)

@dunglas

dunglas commented Sep 19, 2018

Copy link
Copy Markdown
Member

I just noticed that this has already been fixed upstream, see https://github.com/api-platform/api-platform/blob/master/api/docker/php/docker-entrypoint.sh#L17

What we have to do is just to sync this file with the one in api-platform/api-platform.

@aaa2000
aaa2000 force-pushed the fix-output-when-waiting-postgres branch from 4852c1a to fa5e752 Compare September 19, 2018 20:54
@aaa2000
aaa2000 force-pushed the fix-output-when-waiting-postgres branch from fa5e752 to 9fffd40 Compare September 19, 2018 21:47
@aaa2000

aaa2000 commented Sep 19, 2018

Copy link
Copy Markdown
Contributor Author

I restore the command pg_isready removed from #31 and use the same DATABASE_URL of https://github.com/api-platform/api-platform but there is the same error /tmp:5432 - no response that #30 (comment)

I have the postgres image

postgres                                        9.6-alpine          5433943ddb9f        7 days ago          38.6MB

composer install --prefer-dist --no-progress --no-suggest --no-interaction
>&2 echo "Waiting for Postgres to be ready..."
until bin/console doctrine:query:sql "SELECT 1" --quiet; do
until pg_isready --timeout=0 --dbname="${DATABASE_URL}"; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we prefer using a Postgres database for performances reasons, this command definitively connects this entrypoint to the database system & driver. I don't find it very useful, especially if the final user wants to use a different system.
WDYT @dunglas?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a better way. Thanks to the Sylius peeps who used it: https://github.com/Sylius/Sylius-Standard/blob/943125142f0267ac49903efeaab85e24de08424d/docker/php/docker-entrypoint.sh#L20-L23

Let's adopt the same method as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the same, but what is the purpose of using >/dev/null 2>&1 instead of --quiet?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used this Doctrine command long ago, but I can't remember why we switched. pg_isready looks more reliable anyway.

Even if we prefer using a Postgres database for performances reasons, this command definitively connects this entrypoint to the database system & driver. I don't find it very useful, especially if the final user wants to use a different system.

It's the same for the PDO driver and so on. The entrypoint is part of the infrastructure, to me it's ok and intended to couple it with the services we use.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, please update api-platform/api-platform first, and the demo after by copying it.

@pborreli
pborreli force-pushed the master branch 2 times, most recently from 10cf5c2 to 8882512 Compare March 22, 2019 10:38
@vincentchalamon

vincentchalamon commented Nov 6, 2019

Copy link
Copy Markdown
Contributor

Is this PR still maintained @aaa2000 ? /cc @dunglas

@soyuka

soyuka commented Nov 8, 2019

Copy link
Copy Markdown
Member

We should be consistent with https://github.com/api-platform/api-platform/blob/master/api/docker/php/docker-entrypoint.sh#L25 closing this

@soyuka soyuka closed this Nov 8, 2019
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

Successfully merging this pull request may close these issues.

5 participants