diff --git a/Dockerfile b/Dockerfile index 6c8f1d6de..d2811f919 100644 --- a/Dockerfile +++ b/Dockerfile @@ -71,7 +71,8 @@ COPY --from=app-builder --chown=skate:skate /root/_build/prod/rel/skate . COPY --from=app-builder --chown=skate:skate /root/aws-cert-bundle.pem ./priv/aws-cert-bundle.pem -EXPOSE 4000 +# Expose HTTP, EPMD, and Erlang RPC +EXPOSE 4000 4369 57195 ENTRYPOINT ["/usr/bin/dumb-init", "--"] diff --git a/lib/notifications/notification_server.ex b/lib/notifications/notification_server.ex index bfbc1e770..f10d4daf7 100644 --- a/lib/notifications/notification_server.ex +++ b/lib/notifications/notification_server.ex @@ -8,6 +8,8 @@ defmodule Notifications.NotificationServer do use GenServer + require Logger + alias Notifications.Bridge alias Notifications.Notification alias Notifications.NotificationReason @@ -164,7 +166,13 @@ defmodule Notifications.NotificationServer do # Skate instances currently do not "specialize", and therefore we need to # send the notification to all instances - for node <- Node.list() do + nodes = Node.list() + + Logger.info( + "notifying other instances of detour notification_id=#{notification_id} nodes=#{inspect(nodes)}" + ) + + for node <- nodes do GenServer.cast({server, node}, {:broadcast_new_detour_notification, notification_id}) end end diff --git a/rel/env.sh.eex b/rel/env.sh.eex index 3114eb703..5ab3f0c24 100644 --- a/rel/env.sh.eex +++ b/rel/env.sh.eex @@ -1,5 +1,11 @@ #!/bin/sh -INSTANCE_ID=$(curl --max-time 5 -s http://169.254.169.254/latest/meta-data/instance-id || true) -if [ -n "${INSTANCE_ID}" ]; then - export RELEASE_NODE=skate-${INSTANCE_ID} -fi +ip_address=$(hostname -i) + +## Use "long names" for node names for Distributed Elixir +## https://hexdocs.pm/elixir/main/config-and-releases.html#operating-system-environment-configuration +export RELEASE_DISTRIBUTION=name +## Set our node's "long name" so we can find each instance using DNSCluster +export RELEASE_NODE="skate@$ip_address" + +echo "Release Distribution: $RELEASE_DISTRIBUTION" +echo "Release Node: $RELEASE_NODE" diff --git a/rel/vm.args.eex b/rel/vm.args.eex index 8ab7174a9..7091d232c 100644 --- a/rel/vm.args.eex +++ b/rel/vm.args.eex @@ -3,3 +3,7 @@ ## Give more memory to the literal allocator, used by :persistent_term +MIscs 2048 + +## Set and restrict Erlang RPC port +-kernel inet_dist_listen_min 57195 +-kernel inet_dist_listen_max 57195