Skip to content

Commit

Permalink
fix: restart APICs containers when the engine is restarted (#2441)
Browse files Browse the repository at this point in the history
## Description
Fixing the issue when running the `kurtosis engine restart
--restart-apic-containers`. The issue was happening when the Engine's
REST API was trying to reconnect to all the enclaves while the APIC
containers were in the restart process.

We are also increasing the engine's readiness check time because the
restart process could take more than 1 minutes if there are many APIC
containers running


## REMINDER: Tag Reviewers, so they get notified to review

## Is this change user facing?
YES

## References (if applicable)
This is part of the `upgrade kurtosis from the UI` project
  • Loading branch information
leoporoli committed May 9, 2024
1 parent 75a730b commit e93f3f2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const (
enclaveManagerUIPort = 9711
enclaveManagerAPIPort = 8081
engineDebugServerPort = 50102 // in ClI this is 50101 and 50103 for the APIC
maxWaitForEngineAvailabilityRetries = 10
timeBetweenWaitForEngineAvailabilityRetries = 1 * time.Second
maxWaitForEngineAvailabilityRetries = 40
timeBetweenWaitForEngineAvailabilityRetries = 2 * time.Second
logsStorageDirPath = "/var/log/kurtosis/"
)

Expand Down
12 changes: 6 additions & 6 deletions engine/server/engine/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ func runMain() error {
}
}()

if serverArgs.RestartAPIContainers {
if err := enclaveManager.RestartAllEnclaveAPIContainers(ctx); err != nil {
return stacktrace.Propagate(err, "An error occurred restarting all API containers.")
}
}

go func() {
err := restApiServer(
ctx,
Expand Down Expand Up @@ -292,12 +298,6 @@ func runMain() error {
}
}()

if serverArgs.RestartAPIContainers {
if err := enclaveManager.RestartAllEnclaveAPIContainers(ctx); err != nil {
return stacktrace.Propagate(err, "An error occurred restarting all API containers.")
}
}

engineHttpServer := connect_server.NewConnectServer(serverArgs.GrpcListenPortNum, grpcServerStopGracePeriod, handler, apiPath)
if err := engineHttpServer.RunServerUntilInterruptedWithCors(cors.AllowAll()); err != nil {
return stacktrace.Propagate(err, "An error occurred running the server.")
Expand Down

0 comments on commit e93f3f2

Please sign in to comment.