Skip to content

Wait for database availability in workflows.#2511

Merged
ratkosrb merged 1 commit intovmangos:developmentfrom
mserajnik:wait-for-db
Feb 13, 2024
Merged

Wait for database availability in workflows.#2511
ratkosrb merged 1 commit intovmangos:developmentfrom
mserajnik:wait-for-db

Conversation

@mserajnik
Copy link
Contributor

🍰 Pullrequest

This ensures that the MySQL database is available during the GitHub workflows before trying to access it. This (hopefully) prevents failing workflows like this one.

Proof

  • None

Issues

  • None

How2Test

  • None

Todo / Checklist

  • None

@ratkosrb ratkosrb merged commit 3b8d5b5 into vmangos:development Feb 13, 2024
@mserajnik
Copy link
Contributor Author

I've just had the issue occur in a workflow run in my fork so it seems like this isn't a fix after all (at least not a fully correct one).
I can only assume that checking the port from the host via nc might not be reliable as Docker maybe reports the port as open before it's mapped to the container's internal port; the database might still not be up and ready at that point.

I'll look into alternative methods; I think inspecting the container health might be a viable (and more appropriate) solution.
If I find something that seems to work, I'll make a new PR.

@imranh2
Copy link
Contributor

imranh2 commented Feb 27, 2024

If we are embracing github actions fully then the usual approach is via container healthchecks while also using service/auxiliary containers, see https://docs.github.com/en/actions/using-containerized-services/about-service-containers#creating-service-containers

Here's a postgress example we can steal and tweak https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers#running-jobs-in-containers

mysql healthcheck example: docker-library/mysql#930 (comment)

@mserajnik mserajnik deleted the wait-for-db branch March 10, 2024 10:26
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.

3 participants