diff --git a/app.json b/app.json new file mode 100644 index 0000000..1d1254b --- /dev/null +++ b/app.json @@ -0,0 +1,23 @@ +{ + "name": "aprs.me", + "description": "APRS web service", + "scripts": { + "dokku": { + "predeploy": "", + "postdeploy": "" + } + }, + "checks": { + "web": [ + { + "type": "http", + "name": "web-health", + "path": "/health", + "attempts": 3, + "timeout": 5, + "wait": 10, + "initial_delay": 10 + } + ] + } +} diff --git a/lib/aprs_web/controllers/page_controller.ex b/lib/aprs_web/controllers/page_controller.ex index 9a524b9..a0d7536 100644 --- a/lib/aprs_web/controllers/page_controller.ex +++ b/lib/aprs_web/controllers/page_controller.ex @@ -12,4 +12,8 @@ defmodule AprsWeb.PageController do def packets(conn, _params) do render(conn, :packets) end + + def health(conn, _params) do + json(conn, %{status: "ok", version: Application.spec(:aprs, :vsn)}) + end end diff --git a/lib/aprs_web/router.ex b/lib/aprs_web/router.ex index 4bf2ee6..737bc67 100644 --- a/lib/aprs_web/router.ex +++ b/lib/aprs_web/router.ex @@ -17,6 +17,11 @@ defmodule AprsWeb.Router do plug :accepts, ["json"] end + scope "/", AprsWeb do + pipe_through :api + get "/health", PageController, :health + end + scope "/", AprsWeb do pipe_through :browser