health endpoint
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 31s

This commit is contained in:
2026-03-16 20:53:12 -06:00
parent 842f727f4f
commit a4568d124a
3 changed files with 23 additions and 4 deletions

View File

@@ -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

View File

@@ -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.

View 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