--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2czofZHOZqx3OO2zbTqtUYC7%2B1tbp_fe%2BcZ-MEEn-e2tbA%40mail.gmail.com.
Hi Stuart, I'd say that it is a really nice addition for testing purposes, so yes good and how about:
- Configuration parameters to configure the container (username, password, image, tag, database name)
- Make this automatic process configurable by profile (I think it is using profiles) so for example only integration tests use this approach.
- Another case which will be really nice to support is Kafka.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/69afc343-ed60-4e15-b964-2c383d2eccd1n%40googlegroups.com.
Hi Everyone,Given that everyone seemed happy with the basic idea I proposed in the other thread I thought I would start a design discussion thread to discuss exactly how to do this. This will be a fairly visible change if we do it, so we need to get it right.I propose the following:- For each JDBC extension that has a container image available publicly we add the ability to automatically start the datasource in dev and test mode. If there is no public image we could still add support for it, however it would require the user to configure the image and will not be as seamless. Testcontainers has a hard dependency on JUnit 4, however as this is only used in the -deployment modules it won't pollute the ClassPath. Apparently it is possible to remove this dep if you provide a few empty JUnit classes, so this may be a solution.
- We make quarkus.database.kind optional in many situations:* If only DB extension is installed then this is assumed to be the DB in use, and the kind defaults to this DB* If the launch mode is test and a JDBC URL is provided then we infer the DB kind from the URL. We can do this in test mode because we know it is not going to change at runtime.* If the launch mode is test and there is only one jdbc extension installed with a scope of 'test' then this test scoped extension is assumed to be the default (we do kinda have this information available in CurateOutcomeBuildItem, although we may need a bit more metadata in the extensions).* Note that both reactive and JDBC extensions need to be considered when making this determination, although if you have both the reactive and JDBC version of the same DB then it will still be possible to infer the typeThis means that the majority of applications won't need to configure this, which IMHO fits in with our 'convention over configuration' approach (why should the user need to configure the DB type if there is only a single possible value it could be?).- We add the ability to automatically start a database container in dev and test mode, based on the following conditions:* quarkus.database.type can be automatically inferred (i.e. only one DB extension, or only one test scoped DB extension)* An explicit configuration option is set to start the container (in this we ignore the configured URL, and just start on localhost, but will use the configured username if present)* A global config option will be added to turn this off* Datasources will have a config option to set the container image that should be used
I am not 100% sure what the correct behaviour is if you have both a reactive and JDBC driver for the same database is (i.e. do you start one postgres container and they share it, or do they both get their own container). My gut feeling is that in this case they should share it.
Hopefully what this means is that for the majority of applications you don't need any datasource config to use Quarkus. If you are in dev or test mode Quarkus will just give you a database on startup, and if you are in production these settings are generally provided through env vars. This is not only something that demos really well and helps people get started, but it would also IMHO be a huge help for developers who work on a lot of different apps. You don't need to worry about setting up local databases or making sure you have the correct docker container and DB settings, everything just works out of the box.Stuart
--
On Tue, Feb 2, 2021 at 6:03 AM Stuart Douglas <sdou...@redhat.com> wrote:Hi Everyone,Given that everyone seemed happy with the basic idea I proposed in the other thread I thought I would start a design discussion thread to discuss exactly how to do this. This will be a fairly visible change if we do it, so we need to get it right.I propose the following:- For each JDBC extension that has a container image available publicly we add the ability to automatically start the datasource in dev and test mode. If there is no public image we could still add support for it, however it would require the user to configure the image and will not be as seamless. Testcontainers has a hard dependency on JUnit 4, however as this is only used in the -deployment modules it won't pollute the ClassPath. Apparently it is possible to remove this dep if you provide a few empty JUnit classes, so this may be a solution.I really like the idea- We make quarkus.database.kind optional in many situations:* If only DB extension is installed then this is assumed to be the DB in use, and the kind defaults to this DB* If the launch mode is test and a JDBC URL is provided then we infer the DB kind from the URL. We can do this in test mode because we know it is not going to change at runtime.* If the launch mode is test and there is only one jdbc extension installed with a scope of 'test' then this test scoped extension is assumed to be the default (we do kinda have this information available in CurateOutcomeBuildItem, although we may need a bit more metadata in the extensions).* Note that both reactive and JDBC extensions need to be considered when making this determination, although if you have both the reactive and JDBC version of the same DB then it will still be possible to infer the typeThis means that the majority of applications won't need to configure this, which IMHO fits in with our 'convention over configuration' approach (why should the user need to configure the DB type if there is only a single possible value it could be?).- We add the ability to automatically start a database container in dev and test mode, based on the following conditions:* quarkus.database.type can be automatically inferred (i.e. only one DB extension, or only one test scoped DB extension)* An explicit configuration option is set to start the container (in this we ignore the configured URL, and just start on localhost, but will use the configured username if present)* A global config option will be added to turn this off* Datasources will have a config option to set the container image that should be usedThese rules sound appropriate to me.I am not 100% sure what the correct behaviour is if you have both a reactive and JDBC driver for the same database is (i.e. do you start one postgres container and they share it, or do they both get their own container). My gut feeling is that in this case they should share it.I'd like to hear from Guillaume and Sanne about this.
----Hopefully what this means is that for the majority of applications you don't need any datasource config to use Quarkus. If you are in dev or test mode Quarkus will just give you a database on startup, and if you are in production these settings are generally provided through env vars. This is not only something that demos really well and helps people get started, but it would also IMHO be a huge help for developers who work on a lot of different apps. You don't need to worry about setting up local databases or making sure you have the correct docker container and DB settings, everything just works out of the box.Stuart
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2czofZHOZqx3OO2zbTqtUYC7%2B1tbp_fe%2BcZ-MEEn-e2tbA%40mail.gmail.com.
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CALeTM-kr0aLx%2By4E4d4kH8QvA1okf2Hm%3Dp2C32SRk8Gr3vSokA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAMmsnJiFCXsMXficmxLUywEFwU8_9Ri3EgwttbmqpmH5dS%2BMpA%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/d1757f4b-c9b5-4b35-9073-fbd66ee63de7n%40googlegroups.com.
Hi All,I really like this idea. Just some additional thought: in a multi module project it might be required that the db is only started once (but not necessarily).
Also it would be usefull to be able to inject data with dbunit.
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/d1757f4b-c9b5-4b35-9073-fbd66ee63de7n%40googlegroups.com.
And we can even make the process one step further and I know I am hijacking the thread but how about generating the Kubernetes YAML file with the deployment of the DB in it (or make it configurable to generate it), so can you imagine for a developer and even anyone demoing Quarkus doing a ./mvnw package -Dquarkus.kubernetes.deploy=true and all the app up and running even with the dependencies? And then with Kafka we could add Strimzi, Vault, ...Ok I am getting crazy hahaha
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAOaD6k%2BNPhLizCEcqABDJMjtuVJMsvSNe%2B4Q%3D2qgvD5fuc2KHA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAD%2BL2czv11kH_sYjh2GnfP81EN7XwESCsiS3D-XvK6bJSa76aw%40mail.gmail.com.
Great!!! When you mention "creating them in process" means running docker run right? Could it also be configured to start it using podman?. And ok even more complicated scenario that could be implemented later doing a kubectl create + kubectl port-forward.
On Wed, 10 Feb 2021 at 20:48, Alex Soto Bueno <asot...@redhat.com> wrote:Great!!! When you mention "creating them in process" means running docker run right? Could it also be configured to start it using podman?. And ok even more complicated scenario that could be implemented later doing a kubectl create + kubectl port-forward.The in-process ones are Derby and H2, which I can just launch directly. Postgresql, MySQL and MariaDB are launched using testcontainers.I could make them run using docker/podman directly, although I am pretty sure I would end up just re-implementing testcontainers.
That won't be necessary, Testcontainers can use podman now.
The exception is some containers attempt to do "stuff" [1] which
podman blocks; one of these is DB2, which has been a big annoyance for
me as it means I can't run the full Quarkus integration suite without
several extra hoops. MySQL also has a couple issues - but barring
these the others should just work.
If you want to try it, you can run the tests as usual, but need to
start the podman daemon before:
DOCKER_HOST="unix:/run/user/$(id -u)/podman/podman.sock" podman
system service -t 0
I hope such issues will get ironed out at a different level, and would
suggest to stick with supporting just Testcontainers.