-
Notifications
You must be signed in to change notification settings - Fork 9
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
upgrade #3
base: master
Are you sure you want to change the base?
upgrade #3
Conversation
@@ -13,5 +13,5 @@ services: | |||
depends_on: | |||
- postgres_db | |||
- mongo_db | |||
entrypoint: /app/docker/web/entrypoint.sh | |||
privileged: true | |||
command: sh "/app/docker/web/entrypoint.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gogobook I am curious as to what this change achieves. In command you are executing the same file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it raise an error when I using "entrypoint" way, so I changed it to command.
>&2 echo "Postgres is unavailable - sleeping" | ||
sleep 1 | ||
done | ||
# until psql -h "postgres_db" -U "postgres" -c '\l'; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gogobook What is the reason for removing this ?
This makes sure that postgres is up and running before we run any migrations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error in my trying, it raise 'Postgres is unavailable - sleeping', when comment these code, it will be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this and I am getting the error that postgres is not available. The Postgres check is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Run 'docker-compose restart web'. And 'web' container will start normally. The error message is 'Is the server running on host "postgres_db" (172.19.0.3) and accepting TCP/IP connections on port 5432?', and add "sleep 3" to entrypoint.sh can solve it. The 'psql' is not exist in 'web' container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sleep 3
doesn't solve the problem, as it assumes that postgres will be up within 3 seconds. We can't make that assumption.
If psql
is not available why don't you add it to Dockerfile
?
Docker docs themselves suggest to use this method.
Check the example in this https://docs.docker.com/compose/startup-order/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need psql, we have to install postgresql to web container, and I don't like this way. If we don't like 'sleep 3', maybe the better solution is 'wait-for' script, action like the example.
upgrade