From 6f22b0e9f2d0c9b0374d9a6f9ab79977baa3262e Mon Sep 17 00:00:00 2001
From: Ryn Cao
Date: Fri, 19 Jul 2024 12:08:57 +0800
Subject: [PATCH] refactor: cluster script
---
Taskfile-fly-io.yml | 1 +
Taskfile.yml | 3 ++-
lib/hello_phx/application.ex | 2 +-
lib/hello_phx_web/controllers/page_html/home.html.heex | 2 +-
cluster-with-remote.sh => run/cluster-with-remote.sh | 0
5 files changed, 5 insertions(+), 3 deletions(-)
rename cluster-with-remote.sh => run/cluster-with-remote.sh (100%)
diff --git a/Taskfile-fly-io.yml b/Taskfile-fly-io.yml
index 1bf75b3..0c71f8f 100644
--- a/Taskfile-fly-io.yml
+++ b/Taskfile-fly-io.yml
@@ -37,6 +37,7 @@ tasks:
# Opening https://fly.io/apps/hello-phx-up
board: fly dashboard
# Add a dedicated ipv4 with: fly ips allocate-v4
+ ips: fly ip private
## DB
# fly checks list -a hello-phx-up-db
diff --git a/Taskfile.yml b/Taskfile.yml
index 8f66a12..434e77f 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -145,7 +145,8 @@ tasks:
lv-help: task lv-start -- --help
lv-install: mix archive.install hex livebook
# https://fly.io/docs/elixir/advanced-guides/clustering-from-home-to-your-app-in-fly/
- lv-fly-remote: ./cluster-with-remote.sh
+ lv-fly-remote: run/cluster-with-remote.sh
+ dns-query: dig hello-phx-up.internal aaaa
## DB Setup
pgcli: pgcli postgresql://postgres:postgres@localhost:5433
diff --git a/lib/hello_phx/application.ex b/lib/hello_phx/application.ex
index bba929b..846a5bb 100644
--- a/lib/hello_phx/application.ex
+++ b/lib/hello_phx/application.ex
@@ -17,7 +17,7 @@ defmodule HelloPhx.Application do
# Start the Finch HTTP client for sending emails
{Finch, name: HelloPhx.Finch},
# setup for clustering
- {Cluster.Supervisor, [topologies, [name: HelloPhx.ClusterSupervisor]]},
+ {Cluster.Supervisor, [topologies, name: HelloPhx.ClusterSupervisor]},
# Start a worker by calling: HelloPhx.Worker.start_link(arg)
# {HelloPhx.Worker, arg},
# Start to serve requests, typically the last entry
diff --git a/lib/hello_phx_web/controllers/page_html/home.html.heex b/lib/hello_phx_web/controllers/page_html/home.html.heex
index 7507fa1..24fa80a 100644
--- a/lib/hello_phx_web/controllers/page_html/home.html.heex
+++ b/lib/hello_phx_web/controllers/page_html/home.html.heex
@@ -60,7 +60,7 @@
<% end %>
- Mode: <%= HelloPhx.build_mode() %> || <%= HelloPhx.commit() |> inspect %> on v<%= HelloPhx.vsn() %> || Locale: <%= @locale %>
+ Mode: <%= HelloPhx.build_mode() %> || v<%= HelloPhx.vsn() %> commit at: <%= HelloPhx.commit().commit_time %> head: <%= HelloPhx.commit().commit_id |> String.slice(0, 6) %> || Locale: <%= @locale %>
diff --git a/cluster-with-remote.sh b/run/cluster-with-remote.sh
similarity index 100%
rename from cluster-with-remote.sh
rename to run/cluster-with-remote.sh