-
Notifications
You must be signed in to change notification settings - Fork 18
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
chore: add docker-compose healthcheck for postgres #437
Conversation
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.
LGTM, thanks for picking up this
ports: | ||
- 5432:5432 | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
healthcheck: | ||
test: ['CMD', 'pg_isready', "-q", "-d", "postgres", "-U", "postgres"] | ||
interval: 5s |
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.
doesn't matter much but maybe this should be shorter, like 2s (and more retries)?
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, could be shorter. Just left it the same as earlier.
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.
Looking at this more closely, the healthcheck will keep being tested at this interval while the container is running. So when originally setting this up (for Kalix) the 5s interval was a balance, for getting to healthy but also not checking too frequently during running. Shorter is probably fine though.
There's a new start-interval setting coming, so that the regular healthcheck interval can be longer, and the interval during startup can be much shorter. Maybe we use that, once it's released and available. Scheduled for docker engine version 25.0.
# TODO: could we poll the port instead of sleep? | ||
sleep 10 | ||
docker exec -i docker_postgres-db_1 psql -U postgres -t < ddl-scripts/create_tables_postgres.sql | ||
docker compose -f docker/docker-compose-postgres.yml up --wait |
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.
and just to repeat, the fix is:
Looks like there are two versions of docker-compose in the image, both v1 and v2. Where docker-compose is v1, while using docker compose will use the v2 plugin.
Fresh attempt for #401.