Skip to content

Commit

Permalink
fix: the web container startup time should be more generous, fixes #5343
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Oct 26, 2023
1 parent c973686 commit 4a49f82
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/ddevapp/app_compose_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ services:
{{ end }}
interval: 1s
retries: 120
start_period: 120s
timeout: "{{ .DefaultContainerTimeout }}s"
start_period: "{{ .DefaultContainerTimeout }}s"
start_interval: 1s
timeout: 70s
{{ end }} {{/* end if not .OmitDB */}}

web:
Expand Down Expand Up @@ -240,8 +241,9 @@ services:
healthcheck:
interval: 1s
retries: 120
start_period: 120s
timeout: "{{ .DefaultContainerTimeout }}s"
start_period: "{{ .DefaultContainerTimeout }}s"
start_interval: 1s
timeout: 70s

networks:
ddev_default:
Expand Down
4 changes: 4 additions & 0 deletions pkg/ddevapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ func NewApp(appRoot string, includeOverrides bool) (*DdevApp, error) {

if app.DefaultContainerTimeout == "" {
app.DefaultContainerTimeout = nodeps.DefaultDefaultContainerTimeout
// On Windows the default timeout may be too short for mutagen to succeed.
if runtime.GOOS == "windows" {
app.DefaultContainerTimeout = "240"
}
}

// Migrate UploadDir to UploadDirs
Expand Down
4 changes: 4 additions & 0 deletions pkg/ddevapp/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ func (app *DdevApp) RestoreSnapshot(snapshotName string) error {
_ = os.Setenv("DDEV_DB_CONTAINER_COMMAND", restoreCmd)
// nolint: errcheck
defer os.Unsetenv("DDEV_DB_CONTAINER_COMMAND")
// Allow extra time by default for the snapshot restore. This is arbitrary but may help.
origTimeout := app.DefaultContainerTimeout
app.DefaultContainerTimeout = "600"
err = app.Start()
if err != nil {
return fmt.Errorf("failed to start project for RestoreSnapshot: %v", err)
Expand Down Expand Up @@ -251,6 +254,7 @@ func (app *DdevApp) RestoreSnapshot(snapshotName string) error {
fmt.Print(".")
}
}
app.DefaultContainerTimeout = origTimeout
util.Success("\nDatabase snapshot %s was restored in %vs", snapshotName, int(time.Since(start).Seconds()))
err = app.ProcessHooks("post-restore-snapshot")
if err != nil {
Expand Down

0 comments on commit 4a49f82

Please sign in to comment.