From 6c387a1d0785765a4846888d252f24b586aef2fe Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Thu, 17 Sep 2015 10:10:04 +1000 Subject: [PATCH] cmd/tipgodoc: implement health checking and enable auto-scaling Change-Id: I860d0913d051616d7958a88a3c7b11a26ec1d4d6 Reviewed-on: https://go-review.googlesource.com/14661 Reviewed-by: Chris Broadfoot --- cmd/tipgodoc/app.yaml | 8 +++----- cmd/tipgodoc/tip.go | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/tipgodoc/app.yaml b/cmd/tipgodoc/app.yaml index 596f1811..f5d68943 100644 --- a/cmd/tipgodoc/app.yaml +++ b/cmd/tipgodoc/app.yaml @@ -3,12 +3,10 @@ runtime: custom api_version: go1 vm: true -manual_scaling: - instances: 1 +automatic_scaling: + min_num_instances: 1 + max_num_instances: 2 handlers: - url: /.* script: _go_app - -health_check: - enable_health_check: False diff --git a/cmd/tipgodoc/tip.go b/cmd/tipgodoc/tip.go index ab3b8e60..833c0d01 100644 --- a/cmd/tipgodoc/tip.go +++ b/cmd/tipgodoc/tip.go @@ -71,6 +71,10 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.Error(w, s, http.StatusInternalServerError) return } + if r.URL.Path == "/_ah/health" { + fmt.Fprintln(w, "OK") + return + } proxy.ServeHTTP(w, r) }