I'm trying to create a client extension for an app I wrote, and the devservice for this will need both the app and mongo running (my app requires Mongo). Is there a graceful way to do this, and in a way that ensures Mongo is stood up first?
@BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
public DevServicesResultBuildItem createContainer(LaunchModeBuildItem launchMode) {
DockerImageName dockerImageName = DockerImageName.parse("my/app:1.0.0");
// You might want to use Quarkus config here to customise the container
OtherWebServiceContainer container = new OtherWebServiceContainer(dockerImageName)
.withEnv("whatever", "true")
.withEnv("otherenv", "something")
;
container.start();
Map<String, String> props = Map.of(
"mynew.url",
"https://" + container.getHost() + ":" + container.getPort()
);
return new DevServicesResultBuildItem.RunningDevService(
FEATURE,
container.getContainerId(),
container::close,
props
)
.toBuildItem();
}
Can I return a List from this method, where the first item would be for Mongo, and another for my app? Would I need a separate method to supply the other service (and if so, how to ensure Mongo starts first?)? Can I bring in the mongo extension for test only and just rely on that (while somehow requiring Mongo starts first?)?