Replies: 24 comments 1 reply
-
I guess the right way to do this would be to create a Git repo (and consequently Go module) for each canned product? End users would then have to |
Beta Was this translation helpful? Give feedback.
-
One repository for every canned dashboard is to expensive and it does not help with visibility. I don't think we can go with that solution. What I think is the way to go is using https://github.com/go-modules-by-example/submodules Where we can have a |
Beta Was this translation helpful? Give feedback.
-
I agree with @gianarb, repo per canned container sounds like an overkill. |
Beta Was this translation helpful? Give feedback.
-
I had no idea this could be done! TIL |
Beta Was this translation helpful? Give feedback.
-
Sure! I can try to move the already merged canned container to see if the
dependencies in the root `go.mod` will be moved to the new submodule
…On Thu, Nov 14, 2019 at 2:06 PM Giorgio Azzinnaro ***@***.***> wrote:
I had no idea this could be done! TIL
https://golang.org/cmd/go/#hdr-Module_code_layout confirms that this
should work.. I guess we can give it a go?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#112?email_source=notifications&email_token=AAMOAO5JA3G7TUSYJHNOY6DQTVEOVA5CNFSM4JMBSYDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEBYQWQ#issuecomment-553879642>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMOAOYL64EOKVVTEUDIVALQTVEOVANCNFSM4JMBSYDA>
.
--
Gianluca Arbezzano
www.gianarb.it
|
Beta Was this translation helpful? Give feedback.
-
I am indifferent with where the code for canned containers lives, I think a submodule makes sense to try. One concern I do have, it seems like these canned containers don't have a common interface? Or am I missing it? We have a name for "canned containers", but there is really nothing in code that defines what it takes to be a "canned container". I think we should define some interface that makes something a "canned container". The most obvious problem I see in the future is the versioning. I think any canned container should support a default version, but also allow the user to set a version they want. For a so to define this... type CannedContainer interface {
DefaultVersion() string
SetVersion(version string) error
StartContainer() (DockerContainer, error)
} the point I am trying to make is that I think (if we don't do so already) we should define a what do you all think? if you agree, what other common methods should we include? |
Beta Was this translation helpful? Give feedback.
-
+1 on having a clean interface for canned containers, it would help in the development of new cans. And related to packaging, I'd go with a package for cans, having a Go file per can. Anybody will be able to use |
Beta Was this translation helpful? Give feedback.
-
@mdelapenya from your message I do not understand if you would like to have also a What do you think a canned container should expose that is not exposed by the |
Beta Was this translation helpful? Give feedback.
-
I think that the so, if someone wanted to create an Envoy container, their workflow might be something like... envoyContainer := canned.NewEnvoyCannedContainer()
desiredVersion := "v1.12.0"
if envoyContainer.Version() != desiredVersion {
envoyContainer.SetVersion(desiredVersion)
}
envoyContainer.Start(context.Background())
... I would like to ensure that the user has the ability to change the |
Beta Was this translation helpful? Give feedback.
-
Well, in an ideal situation, that would be great: each canned container, a version, which would enforce strong contracts between client code and the canned containers. Another thing is how much manual work we need to do to maintain it. On the other hand, when doing development mode of the testcontainers-go library we can replace the dependencies to use the project itself, which would simplify that. About the common interface, if the |
Beta Was this translation helpful? Give feedback.
-
oh an sorry, @gianarb yes I agree the type CannedContainer interface {
Container
Version() string
SetVersion(string)
} just a rough draft ☝️ |
Beta Was this translation helpful? Give feedback.
-
@gianarb, good point. I think we should try to minimize dependencies a new canned container introduces. In order to start a Postgres container probably, we don't need to add dependency at Postgres client at all. Many customizations could be done environment variables already, waiting via proper host port waiting strategy in combination with log waiting strategy. Even we can SQL initialization scripts if we create another container on-the-fly and copy scripts there to |
Beta Was this translation helpful? Give feedback.
-
Btw, testcontainers-go already depends on Redis and MySQL clients :( |
Beta Was this translation helpful? Give feedback.
-
Aha, I think this is where I should chime in with our experiences of this on the Java side! Please take from this what you want:
These points, plus a lot of other things we learned, are in our contributing new modules docs. Please take a look - I hope this will be useful both in terms of how you implement this and how you maintain it! |
Beta Was this translation helpful? Give feedback.
-
@rnorth thanks for your input about! What is your opinion about the default version of canned containers/modules? |
Beta Was this translation helpful? Give feedback.
-
Yeah, that's a really good question. Changing the version would be unexpected, as you say, so we can't do that. We're probably locked in to these 'starter' versions at least until we release a new major version of the libraries. It's obviously a good idea for users to specify the exact image they want; in the next major version I wonder if we might remove the default versions altogether. I think I'd suggest having a mandatory parameter for the docker image name+tag - it is a little inconvenient for new users, but probably better in the long term. New users will often be reading or copying from documentation, so this does perhaps reduce the inconvenience a bit. BTW, allowing the docker image to be chosen by the user is a double-edged sword. For example, we had quite an adventure finding connection/driver settings for MySQL that work with MySQL versions from 5 through 8+ 😂 . |
Beta Was this translation helpful? Give feedback.
-
@rnorth would the interface I mentioned above be a step in the correct direction to address the version problem? |
Beta Was this translation helpful? Give feedback.
-
@ClaytonNorthey92 I have checked your suggested interface. By the way, we have two types of entities in this lib: request and container. So we should set a version to request and from the container we can only get the effective version. If you have time, I would appreciate some feedback on #117. I have reworked a bit PRs by @giorgioazzinnaro |
Beta Was this translation helpful? Give feedback.
-
I had this missing feeling already when I started this conversation but I think from what @rnorth says I see it getting stronger. Should we really go into the rabbit hole of They are good for onboard but a pain to code and maintain, as a plus it is very hard to find an interface that is flexible enough but not complex (otherwise you will just use to not canned one). So, should we treat this problem as a documentation issue? |
Beta Was this translation helpful? Give feedback.
-
It looks like the debate between submodules and documentation updates hasn't been totally settled yet. One thing I've noticed with the equivalent on Java Testcontainers is that the custom containers provided by the various libraries tend to be coupled to a particular image and version while pretending that you can still just pass in whatever image you want. Some set of environment variables may be specified for you already to make configuration easier but those configurations don't necessarily work for all versions. Additionally, the library containers seems to be just enough to work but when you want to do something that's a little custom (e.g. configure Redis to run in cluster mode instead) it falls apart. I think the documentation route is a better approach here. We can provide some samples on how to set up the containers but ultimately leave the implementation up to the user. If people are clamoring for it, we can always revisit providing official implementations later. But I think that the documentation route is the simplest and quickest path to helping users with this now. I'd be happy to get the ball rolling with a PR. I have a Redis example that I can share and can probably come up with a Kafka + Schema Registry one as well, which I know has been requested before (#246). |
Beta Was this translation helpful? Give feedback.
-
We started this PR, which could be the seed for modules: #618 It creates examples to be consumed by the website, but turning them into modules would be a matter of adjusting the templates. |
Beta Was this translation helpful? Give feedback.
-
Just to let you know, three examples were added since yesterday! Google Cloud's PubSub, Firestore and Datastore Want to try out contributing the technology you use the most? |
Beta Was this translation helpful? Give feedback.
-
Given the example modules are a thing, what do you all think about transitioning them to real modules? For that, I'd like to get volunteers to convert an example into a well-maintained module, doing the following:
On our side, we will update the existing code generator to create modules and/or examples, depending on your needs: we can use examples for incubating modules 🤷 cc/ @kiview |
Beta Was this translation helpful? Give feedback.
-
Given we have a consistent design and folder structure for the modules, I'm closing this discussion as Done. Please let us know if you need anything from us regarding modules. Thank you very much for your support! ❤️ |
Beta Was this translation helpful? Give feedback.
-
Canned containers are a good way to have pre-built container that can be re-used and can support a deep implementation with the application they are running.
When I started to do them I thought it was a good idea but now I would like to avoid testcontainers to become full of third-party dependency to download. That's why at the moment I am not merging them.
Why I like canned containers:
What I do not like:
Do you have any suggestions?! I don't know how
go mod
works with submodules and if they are supported at all. One idea can be to have a foldering like:And we should figure out a way to have the dependency only for that directory and not for the root o the project.
Affected issue/pr until now:
#108
#107
#105
#102
#98
#59
Beta Was this translation helpful? Give feedback.
All reactions