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

Wait for Postgres to start up #158

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Wait for Postgres to start up #158

merged 1 commit into from
Nov 8, 2023

Conversation

seanh
Copy link
Contributor

@seanh seanh commented Nov 8, 2023

We've been seeing the commands to create the databases failing on CI
with this error:

psql: error: connection to server at "localhost" (::1), port 5437 failed: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

The problem looks like a race condition between starting the Postgres
docker container and the command that creates the DB: we're trying to
create the DB before Postgres has finished starting up.

Fix this by setting Postgres docker container options that cause it to
wait for Postgres to be up and running before continuing.

See:

https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers#running-jobs-in-containers

We've been seeing the commands to create the databases failing on CI
with this error:

    psql: error: connection to server at "localhost" (::1), port 5437 failed: server closed the connection unexpectedly
            This probably means the server terminated abnormally
            before or while processing the request.

The problem looks like a race condition between starting the Postgres
docker container and the command that creates the DB: we're trying to
create the DB before Postgres has finished starting up.

Fix this by setting Postgres docker container options that cause it to
wait for Postgres to be up and running before continuing.

See:

https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers#running-jobs-in-containers
@seanh seanh merged commit 83166fc into main Nov 8, 2023
4 checks passed
@seanh seanh deleted the wait-for-postgres-to-start branch November 8, 2023 10:55
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.

2 participants