aboutsummaryrefslogtreecommitdiff
path: root/rel
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2022-01-17 11:49:16 +0100
committerBadlop <badlop@process-one.net>2022-02-03 18:21:47 +0100
commitadbccbe852e3d9980e531ff206bebd6b2c983fba (patch)
tree04d4b8ae5447fc1f41e87d1f152fd79b70b8e855 /rel
parentmod_pubsub: Unsubscribe JID on whitelist removal (diff)
New "make relive" similar to "ejabberdctl live" without installing
Prepare with: ./autogen.sh && ./configure --with-rebar=./rebar3 && make Or use this if you installed Elixir: ./autogen.sh && ./configure --with-rebar=mix && make Start without installing (it recompiles when necessary): make relive It stores config, database and logs in _build/relive/ There's available the well-known script: _build/relive/ejabberdctl Please note this fails immediately: r3:do(compile). This crashes a few seconds later: rebar3:run(["compile"]). Workaround that works correctly: ejabberd_admin:update().
Diffstat (limited to 'rel')
-rw-r--r--rel/relive.config3
-rw-r--r--rel/relive.escript26
-rwxr-xr-xrel/setup-relive.sh30
3 files changed, 59 insertions, 0 deletions
diff --git a/rel/relive.config b/rel/relive.config
new file mode 100644
index 000000000..7e3901fd4
--- /dev/null
+++ b/rel/relive.config
@@ -0,0 +1,3 @@
+[{mnesia, [{dir, "_build/relive/database"}]},
+ {ejabberd, [{config, "_build/relive/conf/ejabberd.yml"},
+ {log_path, "_build/relive/logs/ejabberd.log"}]}].
diff --git a/rel/relive.escript b/rel/relive.escript
new file mode 100644
index 000000000..3ee2de0f3
--- /dev/null
+++ b/rel/relive.escript
@@ -0,0 +1,26 @@
+#!/usr/bin/env escript
+
+main(_) ->
+ Base = "_build/relive",
+ prepare(Base, "", none),
+ prepare(Base, "conf", {os, cmd, "rel/setup-relive.sh"}),
+ prepare(Base, "database", none),
+ prepare(Base, "logs", none),
+ c:erlangrc([os:cmd("echo -n $HOME")]),
+ ok.
+
+prepare(BaseDir, SuffixDir, MFA) ->
+ Dir = filename:join(BaseDir, SuffixDir),
+ case file:make_dir(Dir) of
+ ok ->
+ io:format("Preparing relive dir ~s...~n", [Dir]),
+ case MFA of
+ none -> ok;
+ {M, F, A} -> M:F(A)
+ end;
+ {error, eexist} ->
+ ok;
+ {error, LogsError} ->
+ io:format("Error creating dir ~s: ~p~n", [Dir, LogsError]),
+ halt(1)
+ end.
diff --git a/rel/setup-relive.sh b/rel/setup-relive.sh
new file mode 100755
index 000000000..4e726be88
--- /dev/null
+++ b/rel/setup-relive.sh
@@ -0,0 +1,30 @@
+PWD_DIR=`pwd`
+REL_DIR=$PWD_DIR/_build/relive/
+CON_DIR=$REL_DIR/conf/
+
+[ -z "$REL_DIR_TEMP" ] && REL_DIR_TEMP=$REL_DIR
+CON_DIR_TEMP=$REL_DIR_TEMP/conf/
+
+make ejabberdctl.relive
+chmod +x ejabberdctl.relive
+mv ejabberdctl.relive $REL_DIR/ejabberdctl
+
+cp inetrc $CON_DIR/
+cp ejabberdctl.cfg.example $CON_DIR/ejabberdctl.cfg.example
+cp ejabberd.yml.example $CON_DIR/ejabberd.yml.example
+cp test/ejabberd_SUITE_data/ca.pem $CON_DIR
+cp test/ejabberd_SUITE_data/cert.pem $CON_DIR
+
+cd $CON_DIR_TEMP
+
+sed -i "s|# certfiles:|certfiles:\n - $CON_DIR/cert.pem|g" ejabberd.yml.example
+sed -i "s|certfiles:|ca_file: $CON_DIR/ca.pem\ncertfiles:|g" ejabberd.yml.example
+sed -i 's|^acl:$|acl:\n admin: [user: admin]|g' ejabberd.yml.example
+[ ! -f "$CON_DIR/ejabberd.yml" ] \
+ && echo -n "ejabberd.yml " \
+ && mv ejabberd.yml.example ejabberd.yml
+
+sed -i "s|#' POLL|EJABBERD_BYPASS_WARNINGS=true\n\n#' POLL|g" ejabberdctl.cfg.example
+[ ! -f "$CON_DIR/ejabberdctl.cfg" ] \
+ && echo -n "ejabberdctl.cfg " \
+ && mv ejabberdctl.cfg.example ejabberdctl.cfg