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

fix: always restart logs aggregator #1841

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,14 @@ func (backend *DockerKurtosisBackend) CreateLogsCollectorForEnclave(
if maybeLogsAggregator == nil {
logrus.Warnf("Logs aggregator container does not exist. This is unexpected as docker should have restarted the container automatically.")
logrus.Warnf("This can be fixed by restarting the engine using `kurtosis engine restart` and attempting to create the enclave again.")
return nil, stacktrace.Propagate(err, "No logs aggregator container exists. The logs collector cannot be run without a logs aggregator.")
return nil, stacktrace.NewError("No logs aggregator container exists. The logs collector cannot be run without a logs aggregator.")
}
if maybeLogsAggregator.GetStatus() != container.ContainerStatus_Running {
logrus.Warnf("Logs aggregator exists but is not running. Instead container status is '%v'. This is unexpected as docker should have restarted the container automatically.",
maybeLogsAggregator.GetStatus())
logrus.Warnf("This can be fixed by restarting the engine using `kurtosis engine restart` and attempting to create the enclave again.")
return nil, stacktrace.Propagate(err,
"The logs aggregator container exists but is not running. Instead container status is '%v'. The logs collector cannot be run without a logs aggregator.",
return nil, stacktrace.NewError(
"The logs aggregator container exists but is not running. Instead logs aggregator container status is '%v'. The logs collector cannot be run without a logs aggregator.",
maybeLogsAggregator.GetStatus(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (vector *vectorContainerConfigProvider) GetContainerArgs(

// The logs aggregator should ALWAYS be running to ensure that no logs are lost for services in enclaves
// Thus, instruct docker to restart the container if it exits with non-zero status code for whatever reason
restartPolicy := docker_manager.RestartPolicy("on-failure")
restartPolicy := docker_manager.RestartPolicy(docker_manager.RestartAlways)

createAndStartArgs := docker_manager.NewCreateAndStartContainerArgsBuilder(
containerImage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const (
type RestartPolicy string

const (
RestartAlways = "always"
RestartOnFailure = "on-failure"
NoRestart = ""
)
Expand Down
Loading