From eb975268f43d6df7d7d7b2d7398a6a1f498a2a12 Mon Sep 17 00:00:00 2001 From: Badlop Date: Tue, 23 Apr 2024 16:47:50 +0200 Subject: [PATCH] Add ExSync tool to "make relive" with Mix How to use: - Compile ejabberd with Mix - Start ejabberd with "make relive" - Edit some ejabberd source code file - Save the file, and ExSync will compile and reload it automatically ExSync depends on FileSystem library, which requires inotify-tools, see https://github.com/falood/file_system#system-support References: https://hex.pm/packages/exsync https://github.com/falood/exsync --- config/runtime.exs | 2 ++ mix.exs | 3 +++ mix.lock | 2 ++ 3 files changed, 7 insertions(+) diff --git a/config/runtime.exs b/config/runtime.exs index fb2372ea6..adfc18c06 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -11,3 +11,5 @@ config :ejabberd, log_path: Path.join(rootpath, "logs/ejabberd.log") config :mnesia, dir: Path.join(rootpath, "database/") +config :exsync, + reload_callback: {:ejabberd_admin, :update, []} diff --git a/mix.exs b/mix.exs index 3e2145f56..448555b49 100644 --- a/mix.exs +++ b/mix.exs @@ -164,6 +164,8 @@ defmodule Ejabberd.MixProject do for {:true, dep} <- [{config(:pam), {:epam, "~> 1.0"}}, {Mix.env() == :translations, {:ejabberd_po, git: "https://github.com/processone/ejabberd-po.git"}}, + {Mix.env() == :dev, + {:exsync, "~> 0.2"}}, {config(:redis), {:eredis, "~> 1.2.0"}}, {config(:sip), {:esip, "~> 1.0"}}, {config(:zlib), {:ezlib, "~> 1.0"}}, @@ -180,6 +182,7 @@ defmodule Ejabberd.MixProject do defp cond_apps do for {:true, app} <- [{config(:stun), :stun}, + {Map.has_key?(System.get_env(), "RELIVE"), :exsync}, {config(:tools), :observer}], do: app end diff --git a/mix.lock b/mix.lock index fb8dc7fac..ea5a398b6 100644 --- a/mix.lock +++ b/mix.lock @@ -9,10 +9,12 @@ "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "esip": {:hex, :esip, "1.0.52", "a2840287c493a4280e6fba57a257706843b025c315875e38b03fd07190e22dba", [:rebar3], [{:fast_tls, "1.1.19", [hex: :fast_tls, repo: "hexpm", optional: false]}, {:p1_utils, "1.0.25", [hex: :p1_utils, repo: "hexpm", optional: false]}, {:stun, "1.2.12", [hex: :stun, repo: "hexpm", optional: false]}], "hexpm", "6f00165395900500aa262ce0297162d93931c78c1464d89fd0edc6e3d6bc011f"}, "ex_doc": {:hex, :ex_doc, "0.32.1", "21e40f939515373bcdc9cffe65f3b3543f05015ac6c3d01d991874129d173420", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "5142c9db521f106d61ff33250f779807ed2a88620e472ac95dc7d59c380113da"}, + "exsync": {:hex, :exsync, "0.4.0", "41d1f1975a387ba7983c5b341541d9feaa90b9b654eaf245cde814d26dcea1c5", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "e1c4aed25806f1f9b60c6373a4b3f0e0db06e1d00e111e77eab9f21a997a5eef"}, "ezlib": {:hex, :ezlib, "1.0.12", "ffe906ba10d03aaee7977e1e0e81d9ffc3bb8b47fb9cd8e2e453507a2e56221f", [:rebar3], [{:p1_utils, "1.0.25", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "30e94355fb42260aab6e12582cb0c56bf233515e655c8aeaf48760e7561e4ebb"}, "fast_tls": {:hex, :fast_tls, "1.1.19", "f52731a4b35259fa06cf23e2a0732920ad9efce7c3d68377f129a474998747bb", [:rebar3], [{:p1_utils, "1.0.25", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "db34322c8782d4c5139ccb80709d8ec8c38089b44262edd0c2f660ac495bd389"}, "fast_xml": {:hex, :fast_xml, "1.1.51", "a7f8c6942591632309099386d5c339c89997ac2bbdd1216f6c196dee6d7828a9", [:rebar3], [{:p1_utils, "1.0.25", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "7fce41b7d1a4ba438a2d7a088dabe74a3ca0739f1af2abcb77e62daf43e0409a"}, "fast_yaml": {:hex, :fast_yaml, "1.0.36", "65413a34a570fd4e205a460ba602e4ee7a682f35c22d2e1c839025dbf515105c", [:rebar3], [{:p1_utils, "1.0.25", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "1abe8f758fc2a86b08edff80bbc687cfd41ebc1412cfec0ef4a0acfcd032052f"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"}, "jiffy": {:hex, :jiffy, "1.1.1", "aca10f47aa91697bf24ab9582c74e00e8e95474c7ef9f76d4f1a338d0f5de21b", [:rebar3], [], "hexpm", "62e1f0581c3c19c33a725c781dfa88410d8bff1bbafc3885a2552286b4785c4c"}, "jose": {:hex, :jose, "1.11.10", "a903f5227417bd2a08c8a00a0cbcc458118be84480955e8d251297a425723f83", [:mix, :rebar3], [], "hexpm", "0d6cd36ff8ba174db29148fc112b5842186b68a90ce9fc2b3ec3afe76593e614"},