diff --git a/installer/cloud.go b/installer/cloud.go index 177a98ebe..5cb8548a2 100644 --- a/installer/cloud.go +++ b/installer/cloud.go @@ -212,6 +212,8 @@ func Cloud(c *types.Config, update bool) error { fmt.Println("Initializing User Auditor database [OK]") } + fmt.Println("Checking OpenSearch status") + indexURL := "http://localhost:9200/.utm-geoip?pretty" indexExists, err := utils.CheckIndexExistsWithRetry(indexURL) if err != nil { @@ -228,6 +230,8 @@ func Cloud(c *types.Config, update bool) error { return err } fmt.Println("Initializing OpenSearch [OK]") + } else { + fmt.Println("OpenSearch status [OK]") } fmt.Println("Waiting for Backend to be ready. This may take a while.") diff --git a/installer/master.go b/installer/master.go index 27e540b65..3e6643eb5 100644 --- a/installer/master.go +++ b/installer/master.go @@ -200,6 +200,8 @@ func Master(c *types.Config) error { fmt.Println("Initializing User Auditor database [OK]") } + fmt.Println("Checking OpenSearch status") + indexURL := "http://localhost:9200/.utm-geoip?pretty" indexExists, err := utils.CheckIndexExistsWithRetry(indexURL) if err != nil { @@ -216,6 +218,8 @@ func Master(c *types.Config) error { return err } fmt.Println("Initializing OpenSearch [OK]") + } else { + fmt.Println("OpenSearch status [OK]") } fmt.Println("Waiting for Backend to be ready. This may take a while.") diff --git a/installer/utils/elastic.go b/installer/utils/elastic.go index dae3da2c2..1418b4924 100644 --- a/installer/utils/elastic.go +++ b/installer/utils/elastic.go @@ -30,7 +30,7 @@ func CheckIndexExists(url string) (bool, error) { // retrying every 5 seconds up to a total duration of 1 minute. func CheckIndexExistsWithRetry(url string) (bool, error) { - timeout := time.Minute + timeout := 5 * time.Minute interval := 5 * time.Second deadline := time.Now().Add(timeout) @@ -41,8 +41,7 @@ func CheckIndexExistsWithRetry(url string) (bool, error) { return exists, nil } lastErr = err - fmt.Printf("Attempt failed: %v. Retrying in %v...\n", err, interval) time.Sleep(interval) } - return false, fmt.Errorf("failed after retries: %v", lastErr) + return false, fmt.Errorf("OpenSearch status check failed after retries: %v", lastErr) }