Skip to content

Commit 9d1a6ab

Browse files
committed
switch to bluegreen deployments
1 parent 02a8653 commit 9d1a6ab

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

fly.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ kill_signal = 'SIGTERM'
1010
[build]
1111

1212
[deploy]
13+
strategy = "bluegreen"
1314
release_command = '/app/bin/migrate'
1415

1516
[env]
@@ -24,7 +25,16 @@ kill_signal = 'SIGTERM'
2425
min_machines_running = 1
2526
processes = ['app']
2627

27-
[http_service.concurrency]
28-
type = 'connections'
29-
hard_limit = 1000
30-
soft_limit = 100
28+
[http_service.concurrency]
29+
type = 'connections'
30+
hard_limit = 1000
31+
soft_limit = 100
32+
33+
[[http_service.checks]]
34+
grace_period = "10s"
35+
interval = "15s"
36+
timeout = "2s"
37+
method = "GET"
38+
path = "/health"
39+
[http_service.checks.headers]
40+
X-Forwarded-Proto = "https"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
defmodule AlgoraWeb.HealthController do
2+
use AlgoraWeb, :controller
3+
4+
def index(conn, _params) do
5+
send_resp(conn, 200, "OK")
6+
end
7+
end

lib/algora_web/endpoint.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ defmodule AlgoraWeb.Endpoint do
6666
# Legacy tRPC endpoint
6767
defp canonical_host(%{path_info: ["api", "trpc" | _]} = conn, _opts), do: conn
6868

69+
defp canonical_host(%{path_info: ["health"]} = conn, _opts), do: conn
70+
6971
defp canonical_host(%{host: "docs.algora.io"} = conn, _opts),
7072
do: redirect_to_canonical_host(conn, Path.join(["/docs", conn.request_path]))
7173

lib/algora_web/router.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ defmodule AlgoraWeb.Router do
4747
forward "/ingest", AlgoraWeb.Plugs.RewriteIngestPlug, upstream: :ingest_url
4848
forward "/observe/script.js", AlgoraWeb.Plugs.RewriteObserveJSPlug, upstream: "https://plausible.io/js/script.js"
4949
forward "/observe/event", AlgoraWeb.Plugs.RewriteObserveEventPlug, upstream: "https://plausible.io/api/event"
50+
51+
get "/health", AlgoraWeb.HealthController, :index
5052
end
5153

5254
scope "/", AlgoraWeb do

0 commit comments

Comments
 (0)