health endpoint
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 31s
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 31s
This commit is contained in:
@@ -52,14 +52,14 @@ spec:
|
|||||||
memory: 512Mi
|
memory: 512Mi
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /health
|
||||||
port: 4000
|
port: 4000
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 3
|
||||||
periodSeconds: 10
|
periodSeconds: 3
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /health
|
||||||
port: 4000
|
port: 4000
|
||||||
initialDelaySeconds: 30
|
initialDelaySeconds: 30
|
||||||
periodSeconds: 30
|
periodSeconds: 30
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
defmodule CobblemonUiWeb.Endpoint do
|
defmodule CobblemonUiWeb.Endpoint do
|
||||||
use Phoenix.Endpoint, otp_app: :cobblemon_ui
|
use Phoenix.Endpoint, otp_app: :cobblemon_ui
|
||||||
|
|
||||||
|
plug CobblemonUiWeb.Plugs.HealthCheck
|
||||||
|
|
||||||
# The session will be stored in the cookie and signed,
|
# The session will be stored in the cookie and signed,
|
||||||
# this means its contents can be read but not tampered with.
|
# this means its contents can be read but not tampered with.
|
||||||
# Set :encryption_salt if you would also like to encrypt it.
|
# Set :encryption_salt if you would also like to encrypt it.
|
||||||
|
|||||||
17
lib/cobblemon_ui_web/health_check.ex
Normal file
17
lib/cobblemon_ui_web/health_check.ex
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
defmodule CobblemonUiWeb.Plugs.HealthCheck do
|
||||||
|
@moduledoc """
|
||||||
|
A lightweight health check plug that responds before hitting the router.
|
||||||
|
This avoids unnecessary processing and logging for health check requests.
|
||||||
|
"""
|
||||||
|
import Plug.Conn
|
||||||
|
|
||||||
|
def init(opts), do: opts
|
||||||
|
|
||||||
|
def call(%Plug.Conn{request_path: "/health"} = conn, _opts) do
|
||||||
|
conn
|
||||||
|
|> send_resp(200, ~s({"status":"ok"}))
|
||||||
|
|> halt()
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(conn, _opts), do: conn
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user