|
|
@ -112,19 +112,21 @@ class DockerComposeLifecycleManager {
|
|
|
|
Start start = this.properties.getStart();
|
|
|
|
Start start = this.properties.getStart();
|
|
|
|
Stop stop = this.properties.getStop();
|
|
|
|
Stop stop = this.properties.getStop();
|
|
|
|
Wait wait = this.properties.getReadiness().getWait();
|
|
|
|
Wait wait = this.properties.getReadiness().getWait();
|
|
|
|
if (lifecycleManagement.shouldStart() && !dockerCompose.hasRunningServices()) {
|
|
|
|
List<RunningService> runningServices = dockerCompose.getRunningServices();
|
|
|
|
|
|
|
|
if (lifecycleManagement.shouldStart() && runningServices.isEmpty()) {
|
|
|
|
start.getCommand().applyTo(dockerCompose, start.getLogLevel());
|
|
|
|
start.getCommand().applyTo(dockerCompose, start.getLogLevel());
|
|
|
|
|
|
|
|
runningServices = dockerCompose.getRunningServices();
|
|
|
|
wait = (wait != Wait.ONLY_IF_STARTED) ? wait : Wait.ALWAYS;
|
|
|
|
wait = (wait != Wait.ONLY_IF_STARTED) ? wait : Wait.ALWAYS;
|
|
|
|
if (lifecycleManagement.shouldStop()) {
|
|
|
|
if (lifecycleManagement.shouldStop()) {
|
|
|
|
this.shutdownHandlers.add(() -> stop.getCommand().applyTo(dockerCompose, stop.getTimeout()));
|
|
|
|
this.shutdownHandlers.add(() -> stop.getCommand().applyTo(dockerCompose, stop.getTimeout()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<RunningService> runningServices = new ArrayList<>(dockerCompose.getRunningServices());
|
|
|
|
List<RunningService> relevantServices = new ArrayList<>(runningServices);
|
|
|
|
runningServices.removeIf(this::isIgnored);
|
|
|
|
relevantServices.removeIf(this::isIgnored);
|
|
|
|
if (wait == Wait.ALWAYS || wait == null) {
|
|
|
|
if (wait == Wait.ALWAYS || wait == null) {
|
|
|
|
this.serviceReadinessChecks.waitUntilReady(runningServices);
|
|
|
|
this.serviceReadinessChecks.waitUntilReady(relevantServices);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
publishEvent(new DockerComposeServicesReadyEvent(this.applicationContext, runningServices));
|
|
|
|
publishEvent(new DockerComposeServicesReadyEvent(this.applicationContext, relevantServices));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected DockerComposeFile getComposeFile() {
|
|
|
|
protected DockerComposeFile getComposeFile() {
|
|
|
|