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

Add wait-for-it.sh to prevent docker-compose race condition. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

chopfitzroy
Copy link

Added wait-for-it.sh script closes #6

@allanlasser
Copy link
Contributor

Thanks @CrashyBang! I just tested your fork and this is a helpful improvement for getting a smooth, errorless run the 1st time.

Per the question you raise in the issue, I think this is a good stopgap for avoiding an obvious error. However, it also reveals a deeper issue that should be addressed at some point, which is that the server should attempt to retry its connection to the database when it catches a SequelizeConnectionRefusedError. That connection is made using the Sequelize library, and there's an open issue for this exact problem.

I'll definitely accept this PR, but I also wonder if you have any thoughts on improving the resilience of the DB connection?

@chopfitzroy
Copy link
Author

chopfitzroy commented May 18, 2017

Hey @allanlasser yeah I totally agree with that, it is not just Sequelize either Knex.js has a similar problem.

As far as making it more resilient we could try and catch the error ourselves, or wait on the outstanding issue.

Also if you don't want to add the wait-for-it.sh to the source I ended doing the following in my own project, because like you say this is a work around and it would be better if we could address the core issue:

RUN curl -o ~/wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh \
    && chmod +x ~/wait-for-it.sh

ENTRYPOINT ~/wait-for-it.sh postgres:5432 -- npm run start

Thoughts?

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.

Fix race condition when doing initial build between Postgres and the Feathers app.
2 participants