diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-14 18:08:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-14 18:08:22 +0300 |
commit | 0ef9ecf0ce8714a47105d735ca9c265a2b206f8e (patch) | |
tree | 6cee489ed03e0e93eb1879bcf72e6739967266f5 /workhorse/internal/badgateway | |
parent | a5c4a731c88de720e6c23be355e44d916c34985f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'workhorse/internal/badgateway')
-rw-r--r-- | workhorse/internal/badgateway/embed/gitlab-logo-500.png | bin | 0 -> 6263 bytes | |||
-rw-r--r-- | workhorse/internal/badgateway/roundtripper.go | 54 |
2 files changed, 38 insertions, 16 deletions
diff --git a/workhorse/internal/badgateway/embed/gitlab-logo-500.png b/workhorse/internal/badgateway/embed/gitlab-logo-500.png Binary files differnew file mode 100644 index 00000000000..516f5bb27a1 --- /dev/null +++ b/workhorse/internal/badgateway/embed/gitlab-logo-500.png diff --git a/workhorse/internal/badgateway/roundtripper.go b/workhorse/internal/badgateway/roundtripper.go index 240a4ebc86b..cc982b092a7 100644 --- a/workhorse/internal/badgateway/roundtripper.go +++ b/workhorse/internal/badgateway/roundtripper.go @@ -2,6 +2,8 @@ package badgateway import ( "bytes" + _ "embed" + "encoding/base64" "fmt" "html/template" "io" @@ -12,6 +14,9 @@ import ( "gitlab.com/gitlab-org/gitlab/workhorse/internal/log" ) +//go:embed embed/gitlab-logo-500.png +var gitlabLogo []byte + // Error is a custom error for pretty Sentry 'issues' type sentryError struct{ error } @@ -68,9 +73,10 @@ func (t *roundTripper) RoundTrip(r *http.Request) (*http.Response, error) { func developmentModeResponse(err error) (body string, contentType string) { data := TemplateData{ - Time: time.Now().Format("15:04:05"), - Error: err.Error(), - ReloadSeconds: 5, + Time: time.Now().Format("15:04:05"), + Error: err.Error(), + ReloadSeconds: 5, + Base64EncodedGitLabLogo: base64.StdEncoding.EncodeToString(gitlabLogo), } buf := &bytes.Buffer{} @@ -82,28 +88,44 @@ func developmentModeResponse(err error) (body string, contentType string) { } type TemplateData struct { - Time string - Error string - ReloadSeconds int + Time string + Error string + ReloadSeconds int + Base64EncodedGitLabLogo string } var developmentErrorTemplate = template.Must(template.New("error502").Parse(` -<html> +<!DOCTYPE html> +<html lang="en"> + <head> -<title>502: GitLab is not responding</title> -<script> -window.setTimeout(function() { location.reload() }, {{.ReloadSeconds}} * 1000) -</script> + <title>Waiting for GitLab to boot</title> </head> <body> -<h1>502</h1> -<p>GitLab is not responding. The error was:</p> + <div style="text-align: center; font-family: Source Sans Pro, sans-serif"> + <img style="padding: 60px 0" src="data:image/png;base64,{{.Base64EncodedGitLabLogo}}" alt="GitLab" /> + + <h1>Waiting for GitLab to boot</h1> + + <pre>{{.Error}}</pre> -<pre>{{.Error}}</pre> + <br/> -<p>If you just started GDK it can take 60-300 seconds before GitLab has finished booting. This page will automatically reload every {{.ReloadSeconds}} seconds.</p> -<footer>Generated by gitlab-workhorse running in development mode at {{.Time}}.</footer> + <p>It can take 60-180 seconds for GitLab to boot completely.</p> + <p>This page will automatically reload every {{.ReloadSeconds}} seconds.</p> + + <br/> + + <footer> + <p>Generated by gitlab-workhorse running in development mode at {{.Time}}.</p> + </footer> + </div> + + <script> + window.setTimeout(function() { location.reload(); }, {{.ReloadSeconds}} * 1000) + </script> </body> + </html> `)) |