healthckeck improvements
All checks were successful
CI/CD Pipeline / build (push) Successful in 31s

This commit is contained in:
2026-03-09 15:20:50 -06:00
parent 08f5aedb58
commit 76c4098a19
5 changed files with 22 additions and 14 deletions

View File

@@ -3,17 +3,6 @@ kind: Ingress
metadata:
name: ai-ha-elixir
namespace: ai-ha-elixir
# annotations:
# # WebSocket support for LiveView
# nginx.ingress.kubernetes.io/proxy-read-timeout: "86400"
# nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
# nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
# nginx.ingress.kubernetes.io/configuration-snippet: |
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Forwarded-Host $host;
spec:
ingressClassName: nginx
rules:

View File

@@ -48,14 +48,14 @@ spec:
key: AI_TOKEN
readinessProbe:
httpGet:
path: /
path: /health
port: 4000
initialDelaySeconds: 10
periodSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: /
path: /health
port: 4000
initialDelaySeconds: 20
periodSeconds: 10
@@ -67,4 +67,3 @@ spec:
limits:
memory: "512Mi"
cpu: "500m"

View File

@@ -0,0 +1,7 @@
defmodule ElixirAiWeb.HealthController do
use ElixirAiWeb, :controller
def index(conn, _params) do
json(conn, %{status: "ok"})
end
end

View File

@@ -38,6 +38,9 @@ defmodule ElixirAiWeb.Endpoint do
cookie_key: "request_logger"
plug Plug.RequestId
plug Plug.Logger, log: :info, filter: &ElixirAiWeb.Endpoint.filter_health_check/1
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
plug Plug.Parsers,
@@ -49,4 +52,8 @@ defmodule ElixirAiWeb.Endpoint do
plug Plug.Head
plug Plug.Session, @session_options
plug ElixirAiWeb.Router
# Filter health check requests from logs
def filter_health_check(%{request_path: "/health"}), do: false
def filter_health_check(_), do: :info
end

View File

@@ -14,6 +14,12 @@ defmodule ElixirAiWeb.Router do
plug :accepts, ["json"]
end
scope "/", ElixirAiWeb do
pipe_through :api
get "/health", HealthController, :index
end
scope "/", ElixirAiWeb do
pipe_through :browser