This commit is contained in:
@@ -3,17 +3,6 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: ai-ha-elixir
|
name: ai-ha-elixir
|
||||||
namespace: 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:
|
spec:
|
||||||
ingressClassName: nginx
|
ingressClassName: nginx
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -48,14 +48,14 @@ spec:
|
|||||||
key: AI_TOKEN
|
key: AI_TOKEN
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /health
|
||||||
port: 4000
|
port: 4000
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
periodSeconds: 5
|
periodSeconds: 5
|
||||||
failureThreshold: 3
|
failureThreshold: 3
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /health
|
||||||
port: 4000
|
port: 4000
|
||||||
initialDelaySeconds: 20
|
initialDelaySeconds: 20
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
@@ -67,4 +67,3 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
memory: "512Mi"
|
memory: "512Mi"
|
||||||
cpu: "500m"
|
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"
|
cookie_key: "request_logger"
|
||||||
|
|
||||||
plug Plug.RequestId
|
plug Plug.RequestId
|
||||||
|
|
||||||
|
plug Plug.Logger, log: :info, filter: &ElixirAiWeb.Endpoint.filter_health_check/1
|
||||||
|
|
||||||
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
||||||
|
|
||||||
plug Plug.Parsers,
|
plug Plug.Parsers,
|
||||||
@@ -49,4 +52,8 @@ defmodule ElixirAiWeb.Endpoint do
|
|||||||
plug Plug.Head
|
plug Plug.Head
|
||||||
plug Plug.Session, @session_options
|
plug Plug.Session, @session_options
|
||||||
plug ElixirAiWeb.Router
|
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
|
end
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ defmodule ElixirAiWeb.Router do
|
|||||||
plug :accepts, ["json"]
|
plug :accepts, ["json"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scope "/", ElixirAiWeb do
|
||||||
|
pipe_through :api
|
||||||
|
|
||||||
|
get "/health", HealthController, :index
|
||||||
|
end
|
||||||
|
|
||||||
scope "/", ElixirAiWeb do
|
scope "/", ElixirAiWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user