mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Switch "make rel" and "make dev" to paths: conf, database, logs
This commit is contained in:
parent
a852c31c6c
commit
45c7fbb5ae
26
Makefile.in
26
Makefile.in
@ -278,29 +278,29 @@ relive:
|
||||
relivelibdir=$(shell pwd)/$(DEPSDIR)
|
||||
relivedir=$(shell pwd)/_build/relive
|
||||
iexpath=$(shell which iex)
|
||||
CONFIG_DIR = ${relivedir}/conf
|
||||
SPOOL_DIR = ${relivedir}/database
|
||||
LOGS_DIR = ${relivedir}/logs
|
||||
|
||||
ejabberdctl.relive:
|
||||
$(SED) -e "s*{{rootdir}}*@prefix@*g" \
|
||||
-e "s*{{installuser}}*@INSTALLUSER@*g" \
|
||||
$(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \
|
||||
-e "s*{{config_dir}}*${CONFIG_DIR}*g" \
|
||||
-e "s*{{logs_dir}}*${LOGS_DIR}*g" \
|
||||
-e "s*{{spool_dir}}*${SPOOL_DIR}*g" \
|
||||
-e "s*{{bindir}}/iex*$(iexpath)*g" \
|
||||
-e "s*{{bindir}}*@bindir@*g" \
|
||||
-e "s*{{libdir}}*${relivelibdir}*g" \
|
||||
-e "s*{{sysconfdir}}/ejabberd*$(relivedir)/conf*g" \
|
||||
-e "s*{{localstatedir}}/log/ejabberd*$(relivedir)/logs*g" \
|
||||
-e "s*{{localstatedir}}/lib/ejabberd*$(relivedir)/database*g" \
|
||||
-e "s*{{docdir}}*@docdir@*g" \
|
||||
-e "s*{{erl}}*@ERL@*g" \
|
||||
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
|
||||
> ejabberdctl.relive
|
||||
|
||||
ejabberdctl.example:
|
||||
$(SED) -e "s*{{rootdir}}*@prefix@*g" \
|
||||
-e "s*{{installuser}}*@INSTALLUSER@*g" \
|
||||
ejabberdctl.example: vars.config
|
||||
$(SED) -e "s*{{installuser}}*@INSTALLUSER@*g" \
|
||||
-e "s*{{config_dir}}*${ETCDIR}*g" \
|
||||
-e "s*{{logs_dir}}*${LOGDIR}*g" \
|
||||
-e "s*{{spool_dir}}*${SPOOLDIR}*g" \
|
||||
-e "s*{{bindir}}*@bindir@*g" \
|
||||
-e "s*{{libdir}}*@libdir@*g" \
|
||||
-e "s*{{sysconfdir}}*@sysconfdir@*g" \
|
||||
-e "s*{{localstatedir}}*@localstatedir@*g" \
|
||||
-e "s*{{docdir}}*@docdir@*g" \
|
||||
-e "s*{{erl}}*@ERL@*g" \
|
||||
-e "s*{{epmd}}*@EPMD@*g" ejabberdctl.template \
|
||||
> ejabberdctl.example
|
||||
@ -417,7 +417,7 @@ distclean: clean clean-rel
|
||||
rel:
|
||||
$(REBARREL)
|
||||
|
||||
DEV_CONFIG = _build/dev/rel/ejabberd/etc/ejabberd/ejabberd.yml
|
||||
DEV_CONFIG = _build/dev/rel/ejabberd/conf/ejabberd.yml
|
||||
|
||||
dev $(DEV_CONFIG):
|
||||
$(REBARDEV)
|
||||
|
@ -1,18 +1,13 @@
|
||||
import Config
|
||||
|
||||
case System.get_env("RELIVE", "false") do
|
||||
"true" ->
|
||||
rootpath = System.get_env("RELEASE_ROOT", "_build/relive")
|
||||
config :ejabberd,
|
||||
file: Path.join(rootpath, "conf/ejabberd.yml"),
|
||||
log_path: Path.join(rootpath, 'logs/ejabberd.log')
|
||||
config :mnesia,
|
||||
dir: Path.join(rootpath, 'database/')
|
||||
"false" ->
|
||||
rootpath = System.get_env("RELEASE_ROOT", "")
|
||||
config :ejabberd,
|
||||
file: Path.join(rootpath, "etc/ejabberd/ejabberd.yml"),
|
||||
log_path: Path.join(rootpath, 'var/log/ejabberd/ejabberd.log')
|
||||
config :mnesia,
|
||||
dir: Path.join(rootpath, 'var/lib/ejabberd/')
|
||||
rootdefault = case System.get_env("RELIVE", "false") do
|
||||
"true" -> "_build/relive"
|
||||
"false" -> ""
|
||||
end
|
||||
|
||||
rootpath = System.get_env("RELEASE_ROOT", rootdefault)
|
||||
config :ejabberd,
|
||||
file: Path.join(rootpath, "conf/ejabberd.yml"),
|
||||
log_path: Path.join(rootpath, 'logs/ejabberd.log')
|
||||
config :mnesia,
|
||||
dir: Path.join(rootpath, 'database/')
|
||||
|
@ -50,20 +50,20 @@ while [ $# -gt 0 ]; do
|
||||
-l|--logs) LOGS_DIR=$2; shift 2;;
|
||||
-f|--config) EJABBERD_CONFIG_PATH=$2; shift 2;;
|
||||
-c|--ctl-config) EJABBERDCTL_CONFIG_PATH=$2; shift 2;;
|
||||
-d|--config-dir) ETC_DIR=$2; shift 2;;
|
||||
-d|--config-dir) CONFIG_DIR=$2; shift 2;;
|
||||
-t|--no-timeout) NO_TIMEOUT="--no-timeout"; shift;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# define ejabberd variables if not already defined from the command line
|
||||
: "${ETC_DIR:="{{sysconfdir}}/ejabberd"}"
|
||||
: "${LOGS_DIR:="{{localstatedir}}/log/ejabberd"}"
|
||||
: "${SPOOL_DIR:="{{localstatedir}}/lib/ejabberd"}"
|
||||
: "${EJABBERD_CONFIG_PATH:="$ETC_DIR/ejabberd.yml"}"
|
||||
: "${EJABBERDCTL_CONFIG_PATH:="$ETC_DIR/ejabberdctl.cfg"}"
|
||||
: "${CONFIG_DIR:="{{config_dir}}"}"
|
||||
: "${LOGS_DIR:="{{logs_dir}}"}"
|
||||
: "${SPOOL_DIR:="{{spool_dir}}"}"
|
||||
: "${EJABBERD_CONFIG_PATH:="$CONFIG_DIR/ejabberd.yml"}"
|
||||
: "${EJABBERDCTL_CONFIG_PATH:="$CONFIG_DIR/ejabberdctl.cfg"}"
|
||||
# Allows passing extra Erlang command-line arguments in vm.args file
|
||||
: "${VMARGS:="$ETC_DIR/vm.args"}"
|
||||
: "${VMARGS:="$CONFIG_DIR/vm.args"}"
|
||||
# shellcheck source=ejabberdctl.cfg.example
|
||||
[ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH"
|
||||
[ -n "$ERLANG_NODE_ARG" ] && ERLANG_NODE="$ERLANG_NODE_ARG"
|
||||
@ -85,7 +85,7 @@ fi
|
||||
[ -f "$VMARGS" ] && ERLANG_OPTS="$ERLANG_OPTS -args_file $VMARGS"
|
||||
ERL_LIBS='{{libdir}}'
|
||||
ERL_CRASH_DUMP="$LOGS_DIR"/erl_crash_$(date "+%Y%m%d-%H%M%S").dump
|
||||
ERL_INETRC="$ETC_DIR"/inetrc
|
||||
ERL_INETRC="$CONFIG_DIR"/inetrc
|
||||
|
||||
# define ejabberd parameters
|
||||
EJABBERD_OPTS="$EJABBERD_OPTS\
|
||||
@ -193,7 +193,7 @@ help()
|
||||
echo " started|stopped Wait for the node to fully start|stop"
|
||||
echo ""
|
||||
echo "Optional parameters when starting an ejabberd node:"
|
||||
echo " --config-dir dir Config ejabberd: $ETC_DIR"
|
||||
echo " --config-dir dir Config ejabberd: $CONFIG_DIR"
|
||||
echo " --config file Config ejabberd: $EJABBERD_CONFIG_PATH"
|
||||
echo " --ctl-config file Config ejabberdctl: $EJABBERDCTL_CONFIG_PATH"
|
||||
echo " --logs dir Directory for logs: $LOGS_DIR"
|
||||
|
16
mix.exs
16
mix.exs
@ -235,7 +235,9 @@ defmodule Ejabberd.MixProject do
|
||||
libdir: config(:libdir),
|
||||
sysconfdir: config(:sysconfdir),
|
||||
localstatedir: config(:localstatedir),
|
||||
docdir: config(:docdir),
|
||||
config_dir: config(:config_dir),
|
||||
logs_dir: config(:logs_dir),
|
||||
spool_dir: config(:spool_dir),
|
||||
erl: config(:erl),
|
||||
epmd: config(:epmd),
|
||||
bindir: Path.join([config(:release_dir), "releases", version()]),
|
||||
@ -286,15 +288,15 @@ defmodule Ejabberd.MixProject do
|
||||
|
||||
suffix = case Mix.env() do
|
||||
:dev ->
|
||||
Mix.Generator.copy_file("test/ejabberd_SUITE_data/ca.pem", "#{ro}/etc/ejabberd/ca.pem")
|
||||
Mix.Generator.copy_file("test/ejabberd_SUITE_data/cert.pem", "#{ro}/etc/ejabberd/cert.pem")
|
||||
Mix.Generator.copy_file("test/ejabberd_SUITE_data/ca.pem", "#{ro}/conf/ca.pem")
|
||||
Mix.Generator.copy_file("test/ejabberd_SUITE_data/cert.pem", "#{ro}/conf/cert.pem")
|
||||
".example"
|
||||
_ -> ""
|
||||
end
|
||||
|
||||
Mix.Generator.copy_file("ejabberd.yml.example", "#{ro}/etc/ejabberd/ejabberd.yml#{suffix}")
|
||||
Mix.Generator.copy_file("ejabberdctl.cfg.example", "#{ro}/etc/ejabberd/ejabberdctl.cfg#{suffix}")
|
||||
Mix.Generator.copy_file("inetrc", "#{ro}/etc/ejabberd/inetrc")
|
||||
Mix.Generator.copy_file("ejabberd.yml.example", "#{ro}/conf/ejabberd.yml#{suffix}")
|
||||
Mix.Generator.copy_file("ejabberdctl.cfg.example", "#{ro}/conf/ejabberdctl.cfg#{suffix}")
|
||||
Mix.Generator.copy_file("inetrc", "#{ro}/conf/inetrc")
|
||||
|
||||
Enum.each(File.ls!("sql"),
|
||||
fn x ->
|
||||
@ -316,8 +318,6 @@ defmodule Ejabberd.MixProject do
|
||||
&& File.cp_r!(source_dir, target_dir)
|
||||
end
|
||||
|
||||
Mix.Generator.create_directory("#{ro}/var/lib/ejabberd")
|
||||
|
||||
case Mix.env() do
|
||||
:dev -> execute.("REL_DIR_TEMP=$PWD/rel/overlays/ rel/setup-dev.sh")
|
||||
_ -> :ok
|
||||
|
20
rebar.config
20
rebar.config
@ -190,12 +190,12 @@
|
||||
{sys_config, "./rel/sys.config"},
|
||||
{vm_args, "./rel/vm.args"},
|
||||
{overlay_vars, "vars.config"},
|
||||
{overlay, [{mkdir, "var/log/ejabberd"},
|
||||
{mkdir, "var/lib/ejabberd"},
|
||||
{mkdir, "etc/ejabberd"},
|
||||
{overlay, [{mkdir, "logs"},
|
||||
{mkdir, "database"},
|
||||
{mkdir, "conf"},
|
||||
{copy, "rel/files/erl", "erts-\{\{erts_vsn\}\}/bin/erl"},
|
||||
{template, "ejabberdctl.template", "bin/ejabberdctl"},
|
||||
{copy, "inetrc", "etc/ejabberd/inetrc"},
|
||||
{copy, "inetrc", "conf/inetrc"},
|
||||
{copy, "tools/captcha*.sh", "lib/ejabberd-\{\{release_version\}\}/priv/bin/"},
|
||||
{copy, "rel/files/install_upgrade.escript", "bin/install_upgrade.escript"}]}
|
||||
]}.
|
||||
@ -206,8 +206,8 @@
|
||||
{include_src, true},
|
||||
{generate_start_script, false},
|
||||
{overlay, [{copy, "sql/*", "lib/ejabberd-\{\{release_version\}\}/priv/sql/"},
|
||||
{copy, "ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg"},
|
||||
{copy, "ejabberd.yml.example", "etc/ejabberd/ejabberd.yml"}]}]}]},
|
||||
{copy, "ejabberdctl.cfg.example", "conf/ejabberdctl.cfg"},
|
||||
{copy, "ejabberd.yml.example", "conf/ejabberd.yml"}]}]}]},
|
||||
{dev, [{post_hooks, [{release, "rel/setup-dev.sh"}]},
|
||||
{relx, [{debug_info, keep},
|
||||
{dev_mode, true},
|
||||
@ -215,10 +215,10 @@
|
||||
{include_src, false},
|
||||
{generate_start_script, true},
|
||||
{extended_start_script, true},
|
||||
{overlay, [{copy, "ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg.example"},
|
||||
{copy, "ejabberd.yml.example", "etc/ejabberd/ejabberd.yml.example"},
|
||||
{copy, "test/ejabberd_SUITE_data/ca.pem", "etc/ejabberd/"},
|
||||
{copy, "test/ejabberd_SUITE_data/cert.pem", "etc/ejabberd/"}]}]}]},
|
||||
{overlay, [{copy, "ejabberdctl.cfg.example", "conf/ejabberdctl.cfg.example"},
|
||||
{copy, "ejabberd.yml.example", "conf/ejabberd.yml.example"},
|
||||
{copy, "test/ejabberd_SUITE_data/ca.pem", "conf/"},
|
||||
{copy, "test/ejabberd_SUITE_data/cert.pem", "conf/"}]}]}]},
|
||||
{test, [{erl_opts, [nowarn_export_all]}]}]}.
|
||||
|
||||
{alias, [{relive, [{shell, "--apps ejabberd \
|
||||
|
@ -88,15 +88,15 @@ Sys = [{lib_dirs, []},
|
||||
end, OTPApps).
|
||||
|
||||
Overlay = [
|
||||
{mkdir, "var/log/ejabberd"},
|
||||
{mkdir, "var/lib/ejabberd"},
|
||||
{mkdir, "etc/ejabberd"},
|
||||
{mkdir, "logs"},
|
||||
{mkdir, "database"},
|
||||
{mkdir, "conf"},
|
||||
{mkdir, "doc"},
|
||||
{template, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
||||
{template, "../ejabberdctl.template", "bin/ejabberdctl"},
|
||||
{copy, "../ejabberdctl.cfg.example", "etc/ejabberd/ejabberdctl.cfg"},
|
||||
{copy, "../ejabberd.yml.example", "etc/ejabberd/ejabberd.yml"},
|
||||
{copy, "../inetrc", "etc/ejabberd/inetrc"},
|
||||
{copy, "../ejabberdctl.cfg.example", "conf/ejabberdctl.cfg"},
|
||||
{copy, "../ejabberd.yml.example", "conf/ejabberd.yml"},
|
||||
{copy, "../inetrc", "conf/inetrc"},
|
||||
{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"}
|
||||
],
|
||||
|
||||
|
@ -2,10 +2,10 @@ echo -n "===> Preparing dev configuration files: "
|
||||
|
||||
PWD_DIR=`pwd`
|
||||
REL_DIR=$PWD_DIR/_build/dev/rel/ejabberd/
|
||||
CON_DIR=$REL_DIR/etc/ejabberd/
|
||||
CON_DIR=$REL_DIR/conf/
|
||||
|
||||
[ -z "$REL_DIR_TEMP" ] && REL_DIR_TEMP=$REL_DIR
|
||||
CON_DIR_TEMP=$REL_DIR_TEMP/etc/ejabberd/
|
||||
CON_DIR_TEMP=$REL_DIR_TEMP/conf/
|
||||
BIN_DIR_TEMP=$REL_DIR_TEMP/bin/
|
||||
|
||||
cd $CON_DIR_TEMP
|
||||
|
@ -1,2 +1,2 @@
|
||||
[{ejabberd, [{config, "etc/ejabberd/ejabberd.yml"},
|
||||
{log_path, "var/log/ejabberd/ejabberd.log"}]}].
|
||||
[{ejabberd, [{config, "conf/ejabberd.yml"},
|
||||
{log_path, "logs/ejabberd.log"}]}].
|
||||
|
@ -4,7 +4,7 @@
|
||||
## Cookie for distributed erlang
|
||||
#-setcookie ejabberd
|
||||
|
||||
-mnesia dir \"var/lib/ejabberd\"
|
||||
-mnesia dir \"database\"
|
||||
|
||||
## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
|
||||
## (Disabled by default..use with caution!)
|
||||
|
@ -59,6 +59,11 @@
|
||||
{libdir, "{{release_dir}}/lib"}.
|
||||
{docdir, "{{release_dir}}/doc"}.
|
||||
|
||||
%% OTP release
|
||||
{config_dir, "{{release_dir}}/conf"}.
|
||||
{logs_dir, "{{release_dir}}/logs"}.
|
||||
{spool_dir, "{{release_dir}}/database"}.
|
||||
|
||||
{latest_deps, @latest_deps@}.
|
||||
{system_deps, @system_deps@}.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user