Skip to content

Commit

Permalink
fix: expose EPMD and Erlang RPC ports
Browse files Browse the repository at this point in the history
  • Loading branch information
firestack committed Oct 8, 2024
1 parent d58fcc3 commit 472d236
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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", "--"]

Expand Down
10 changes: 9 additions & 1 deletion lib/notifications/notification_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ defmodule Notifications.NotificationServer do

use GenServer

require Logger

alias Notifications.Bridge
alias Notifications.Notification
alias Notifications.NotificationReason
Expand Down Expand Up @@ -207,7 +209,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
Expand Down
14 changes: 10 additions & 4 deletions rel/env.sh.eex
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions rel/vm.args.eex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 472d236

Please sign in to comment.