aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2022-05-31 13:35:15 +0200
committerBadlop <badlop@process-one.net>2022-09-13 17:55:17 +0200
commit5ee1dc9e8d80d52ec9f3dd3f043dfdd4c90c303a (patch)
tree6fca595c16d44cccddc0f77d20624b01d01c4428 /.github
parentSupport ERL_DIST_PORT option to work without epmd (diff)
Container: Support ERL_DIST_PORT
Diffstat (limited to '.github')
-rw-r--r--.github/container/Dockerfile2
-rwxr-xr-x.github/container/ejabberdctl.template16
2 files changed, 17 insertions, 1 deletions
diff --git a/.github/container/Dockerfile b/.github/container/Dockerfile
index 541dabd66..a60446c32 100644
--- a/.github/container/Dockerfile
+++ b/.github/container/Dockerfile
@@ -113,7 +113,7 @@ HEALTHCHECK \
WORKDIR $HOME
USER ejabberd
VOLUME ["$HOME/conf", "$HOME/database", "$HOME/logs", "$HOME/upload"]
-EXPOSE 1883 4369-4399 5222 5269 5280 5443
+EXPOSE 1883 4369-4399 5210 5222 5269 5280 5443
ENTRYPOINT ["/usr/local/bin/ejabberdctl"]
CMD ["foreground"]
diff --git a/.github/container/ejabberdctl.template b/.github/container/ejabberdctl.template
index 7ba20d68e..de3826a46 100755
--- a/.github/container/ejabberdctl.template
+++ b/.github/container/ejabberdctl.template
@@ -82,6 +82,7 @@ if [ -n "$INET_DIST_INTERFACE" ] ; then
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
fi
fi
+[ -n "$ERL_DIST_PORT" ] && ERLANG_OPTS="$ERLANG_OPTS -erl_epmd_port $ERL_DIST_PORT -start_epmd false"
# if vm.args file exists in config directory, pass it to Erlang VM
[ -f "$VMARGS" ] && ERLANG_OPTS="$ERLANG_OPTS -args_file $VMARGS"
ERL_LIBS='{{libdir}}'
@@ -103,6 +104,7 @@ export EJABBERD_LOG_PATH
export EJABBERD_PID_PATH
export ERL_CRASH_DUMP
export ERL_EPMD_ADDRESS
+export ERL_DIST_PORT
export ERL_INETRC
export ERL_MAX_PORTS
export ERL_MAX_ETS_TABLES
@@ -111,6 +113,11 @@ export CONTRIB_MODULES_CONF_DIR
export ERL_LIBS
export SCRIPT_DIR
+set_dist_client()
+{
+ [ -n "$ERL_DIST_PORT" ] && ERLANG_OPTS="$ERLANG_OPTS -dist_listen false"
+}
+
# run command either directly or via su $INSTALLUSER
run_cmd()
{
@@ -233,6 +240,7 @@ uid()
# stop epmd if there is no other running node
stop_epmd()
{
+ [ -n "$ERL_DIST_PORT" ] && return
"$EPMD" -names 2>/dev/null | grep -q name || "$EPMD" -kill >/dev/null
}
@@ -240,6 +248,7 @@ stop_epmd()
# if all ok, ensure runtime directory exists and make it current directory
check_start()
{
+ [ -n "$ERL_DIST_PORT" ] && return
"$EPMD" -names 2>/dev/null | grep -q " ${ERLANG_NODE%@*} " && {
pgrep -f "$ERLANG_NODE" >/dev/null && {
echo "ERROR: The ejabberd node '$ERLANG_NODE' is already running."
@@ -328,14 +337,17 @@ case $1 in
;;
debug)
debugwarning
+ set_dist_client
exec_erl "$(uid debug)" -hidden -remsh "$ERLANG_NODE"
;;
etop)
+ set_dist_client
exec_erl "$(uid top)" -hidden -node "$ERLANG_NODE" -s etop \
-s erlang halt -output text
;;
iexdebug)
debugwarning
+ set_dist_client
exec_iex "$(uid debug)" --remsh "$ERLANG_NODE"
;;
iexlive)
@@ -345,20 +357,24 @@ case $1 in
ping)
PEER=${2:-$ERLANG_NODE}
[ "$PEER" = "${PEER%.*}" ] && PS="-s"
+ set_dist_client
exec_cmd "$ERL" ${PS:--}name "$(uid ping "$(hostname $PS)")" $ERLANG_OPTS \
-noinput -hidden -eval 'io:format("~p~n",[net_adm:ping('"'$PEER'"')])' \
-s erlang halt -output text
;;
started)
+ set_dist_client
wait_status 0 30 2 # wait 30x2s before timeout
;;
stopped)
+ set_dist_client
wait_status 3 30 2 && stop_epmd # wait 30x2s before timeout
;;
post_waiter)
post_waiter_waiting
;;
*)
+ set_dist_client
run_erl "$(uid ctl)" -hidden -noinput -s ejabberd_ctl \
-extra "$ERLANG_NODE" $NO_TIMEOUT "$@"
result=$?