This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
7
lib/elixir_ai_web/controllers/health_controller.ex
Normal file
7
lib/elixir_ai_web/controllers/health_controller.ex
Normal file
@@ -0,0 +1,7 @@
|
||||
defmodule ElixirAiWeb.HealthController do
|
||||
use ElixirAiWeb, :controller
|
||||
|
||||
def index(conn, _params) do
|
||||
json(conn, %{status: "ok"})
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user