25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Start ExSync manually to ensure it's started if (and only if) Relive

This commit is contained in:
Badlop 2024-08-20 19:50:55 +02:00
parent 6110f213de
commit db3a5d8915
2 changed files with 9 additions and 2 deletions

View File

@ -165,7 +165,7 @@ defmodule Ejabberd.MixProject do
{Mix.env() == :translations, {Mix.env() == :translations,
{:ejabberd_po, git: "https://github.com/processone/ejabberd-po.git"}}, {:ejabberd_po, git: "https://github.com/processone/ejabberd-po.git"}},
{Mix.env() == :dev, {Mix.env() == :dev,
{:exsync, "~> 0.2"}}, {:exsync, "~> 0.2", optional: true, runtime: false}},
{config(:redis), {:eredis, "~> 1.2.0"}}, {config(:redis), {:eredis, "~> 1.2.0"}},
{config(:sip), {:esip, "~> 1.0"}}, {config(:sip), {:esip, "~> 1.0"}},
{config(:zlib), {:ezlib, "~> 1.0"}}, {config(:zlib), {:ezlib, "~> 1.0"}},
@ -183,7 +183,6 @@ defmodule Ejabberd.MixProject do
defp cond_apps do defp cond_apps do
for {:true, app} <- [{config(:stun), :stun}, for {:true, app} <- [{config(:stun), :stun},
{Map.has_key?(System.get_env(), "RELIVE"), :exsync},
{if_version_below(~c"27", true), :jiffy}, {if_version_below(~c"27", true), :jiffy},
{config(:tools), :observer}], do: {config(:tools), :observer}], do:
app app

View File

@ -59,6 +59,7 @@ start(normal, _Args) ->
ejabberd_hooks:run(ejabberd_started, []), ejabberd_hooks:run(ejabberd_started, []),
ejabberd:check_apps(), ejabberd:check_apps(),
ejabberd_systemd:ready(), ejabberd_systemd:ready(),
maybe_start_exsync(),
{T2, _} = statistics(wall_clock), {T2, _} = statistics(wall_clock),
?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs", ?INFO_MSG("ejabberd ~ts is started in the node ~p in ~.2fs",
[ejabberd_option:version(), [ejabberd_option:version(),
@ -198,8 +199,15 @@ start_elixir_application() ->
ok -> ok; ok -> ok;
{error, _Msg} -> ?ERROR_MSG("Elixir application not started.", []) {error, _Msg} -> ?ERROR_MSG("Elixir application not started.", [])
end. end.
maybe_start_exsync() ->
case os:getenv("RELIVE") of
"true" -> rpc:call(node(), 'Elixir.ExSync.Application', start, []);
_ -> ok
end.
-else. -else.
setup_if_elixir_conf_used() -> ok. setup_if_elixir_conf_used() -> ok.
register_elixir_config_hooks() -> ok. register_elixir_config_hooks() -> ok.
start_elixir_application() -> ok. start_elixir_application() -> ok.
maybe_start_exsync() -> ok.
-endif. -endif.