henrywhitaker3 / Speedtest-Tracker

Continuously track your internet speed
GNU General Public License v3.0
1.54k stars 121 forks source link

[Feature Request] Better Health Check than HTTP 200 at / ? #605

Open sOblivionsCall opened 3 years ago

sOblivionsCall commented 3 years ago

Describe the feature More of a question than anything, and you don't have a general questions template. Is there a better method / endpoint for checking application health than looking for http 200 at / ? I am starting to add health checking in to the downstream k8s Helm Chart.

Additional context As an end user I would like to be able to have an endpoint that reflects the applications overall health, not just the ability to serve a static webpage.

Possible Solutions Expose an api at "/healthz" that returns status codes for the state of the application. There is a good write up here: https://kubernetesbyexample.com/healthz/

henrywhitaker3 commented 3 years ago

Haven't implemented a specific healthcheck endpoint, the demo site runs on k8s, but I just use on of the API endpoints for the readiness/liveniness checks

sOblivionsCall commented 3 years ago

@henrywhitaker3 can you share the deployment/pod spec you are using? I currently have:

          {{- if .Values.livenessProbe.enabled }}
          livenessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.livenessProbe.successThreshold }}
            failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
          {{- end }}
          {{- if .Values.readinessProbe.enabled }}
          readinessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
            successThreshold: {{ .Values.readinessProbe.successThreshold }}
            failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
          {{- end }}
          {{- if .Values.startupProbe.enabled }}
          startupProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
            periodSeconds: {{ .Values.startupProbe.periodSeconds }}
            timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
            successThreshold: {{ .Values.startupProbe.successThreshold }}
            failureThreshold: {{ .Values.startupProbe.failureThreshold }}
          {{- end }}

This was just a basic "get probes working" implementation, but if you feel hitting the api endpoints accomplish the goal; then i will go ahead and implement them in the chart.

the Chart is located here just in case you need a quick link