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

Support docker compose #19

Merged
merged 2 commits into from Jun 14, 2021
Merged

Support docker compose #19

merged 2 commits into from Jun 14, 2021

Conversation

mrproliu
Copy link
Contributor

@mrproliu mrproliu commented Jun 13, 2021

  • Support using docker-compose to setup and cleanup
  • Using Environment to expose the port for query or trigger
  • Add example config

@mrproliu mrproliu added enhancement New feature or request feature labels Jun 13, 2021
@mrproliu mrproliu added this to the 1.0 milestone Jun 13, 2021
Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mrproliu very much for jumping in 🙇, very appreciate, some comments of mine are inline, please take a look

internal/components/setup/compose.go Outdated Show resolved Hide resolved
internal/components/setup/compose.go Outdated Show resolved Hide resolved
waitTimeout = NewTimeout(timeNow, waitTimeout)
timeNow = time.Now()

// wait port and export
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to wait and export, just exporting it is OK, the healthiness check should be done by docker-compose.yml, because the healthiness check should only make sense by the one who write docker-compose.yml, we can cover every possibility of how to check healthiness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but the healthcheck is only working on the service that has depends_on. If we need to use webapp service on trigger or query, it hasn't service dependent on this, so we may not access it. Do I miss anything?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it makes sense to me, can you reuse compose.WithExposedService(service, port, wait.ForListeningPort("<port>/tcp")) to replace waitTCPPortStarted so that we don't replicate the codes? Others generally look good to me, thanks again ❤️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried compose.WithExposedService(service, port, wait.ForListeningPort("<port>/tcp")) method, but currently the second parameter only supports the specified port, so we cannot use it. This error has already been reported and a new PR has been created. I will pay attention to the next release version of the testcontainers-go project. If this bug is fixed, I will use it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the information, can you paste the related issue / PR here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I forget. here: testcontainers/testcontainers-go#330

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new release has been pushed, fixing this. Hope it helps!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new release has been pushed, fixing this. Hope it helps!

Wow, thx a lot. I will continue to work on this.

Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
3 participants