From 1ae5e7737a97365f65608e3e82c22fc982c5206c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Thu, 28 Jun 2018 18:15:05 -0700 Subject: [PATCH] frontend: add liveness/readiness probes Signed-off-by: Ahmet Alp Balkan --- kubernetes-manifests/frontend.yaml | 10 ++++++++++ src/frontend/main.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml index 7dbaf7f..64eb005 100644 --- a/kubernetes-manifests/frontend.yaml +++ b/kubernetes-manifests/frontend.yaml @@ -13,6 +13,16 @@ spec: image: frontend ports: - containerPort: 8080 + readinessProbe: + initialDelaySeconds: 10 + httpGet: + path: "/" + port: 8080 + livenessProbe: + initialDelaySeconds: 10 + httpGet: + path: "/" + port: 8080 env: - name: PRODUCT_CATALOG_SERVICE_ADDR value: "productcatalogservice:3550" diff --git a/src/frontend/main.go b/src/frontend/main.go index 763dc3b..f14f755 100644 --- a/src/frontend/main.go +++ b/src/frontend/main.go @@ -101,7 +101,7 @@ func main() { r.HandleFunc("/cart/checkout", ensureSessionID(svc.placeOrderHandler)).Methods(http.MethodPost) r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) log.Printf("starting server on :" + srvPort) - log.Fatal(http.ListenAndServe("localhost:"+srvPort, r)) + log.Fatal(http.ListenAndServe(":"+srvPort, r)) } func mustMapEnv(target *string, envKey string) {