|
|
@@ -167,6 +167,7 @@ defmodule EMQXUmbrella.MixProject do
|
|
|
|
|
|
Mix.Generator.create_directory(bin)
|
|
|
Mix.Generator.create_directory(etc)
|
|
|
+ Mix.Generator.create_directory(Path.join(etc, "certs"))
|
|
|
|
|
|
Mix.Generator.copy_file(
|
|
|
"apps/emqx_authz/etc/acl.conf",
|
|
|
@@ -174,19 +175,71 @@ defmodule EMQXUmbrella.MixProject do
|
|
|
force: overwrite?
|
|
|
)
|
|
|
|
|
|
- # FIXME: check if cloud/edge!!
|
|
|
+ # FIXME: check if cloud/edge???
|
|
|
Mix.Generator.copy_file(
|
|
|
"apps/emqx/etc/emqx_cloud/vm.args",
|
|
|
Path.join(etc, "vm.args"),
|
|
|
force: overwrite?
|
|
|
)
|
|
|
|
|
|
+ # FIXME: check if cloud/edge!!
|
|
|
Mix.Generator.copy_file(
|
|
|
"apps/emqx/etc/emqx_cloud/vm.args",
|
|
|
Path.join(release.version_path, "vm.args"),
|
|
|
force: overwrite?
|
|
|
)
|
|
|
|
|
|
+ # required by emqx_authz
|
|
|
+ File.cp_r!(
|
|
|
+ "apps/emqx/etc/certs",
|
|
|
+ Path.join(etc, "certs")
|
|
|
+ )
|
|
|
+
|
|
|
+ # this is required by the produced escript / nodetool
|
|
|
+ Mix.Generator.copy_file(
|
|
|
+ Path.join(release.version_path, "start_clean.boot"),
|
|
|
+ Path.join(bin, "no_dot_erlang.boot"),
|
|
|
+ force: overwrite?
|
|
|
+ )
|
|
|
+
|
|
|
+ # This is generated by `scripts/merge-config.escript` or `make
|
|
|
+ # conf-segs`. So, this should be run before the release.
|
|
|
+ # TODO: run as a "compiler" step???
|
|
|
+
|
|
|
+ conf_rebar_template = File.read!("apps/emqx_conf/etc/emqx.conf.all")
|
|
|
+ # we must not consider surrounding space in the template var name
|
|
|
+ # because some help strings contain informative variables that
|
|
|
+ # should not be interpolated, and those have no spaces.
|
|
|
+ conf_eex_template =
|
|
|
+ Regex.replace(
|
|
|
+ ~r/\{\{ ([a-zA-Z0-9_]+) \}\}/,
|
|
|
+ conf_rebar_template,
|
|
|
+ "<%= \\g{1} %>"
|
|
|
+ )
|
|
|
+
|
|
|
+ # FIXME: change variables by package type???
|
|
|
+ conf_rendered =
|
|
|
+ EEx.eval_string(conf_eex_template,
|
|
|
+ platform_bin_dir: "bin",
|
|
|
+ platform_data_dir: "data",
|
|
|
+ platform_etc_dir: "etc",
|
|
|
+ platform_lib_dir: "lib",
|
|
|
+ platform_log_dir: "log",
|
|
|
+ platform_plugins_dir: "plugins",
|
|
|
+ runner_root_dir: "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)",
|
|
|
+ runner_bin_dir: "$RUNNER_ROOT_DIR/bin",
|
|
|
+ runner_etc_dir: "$RUNNER_ROOT_DIR/etc",
|
|
|
+ runner_lib_dir: "$RUNNER_ROOT_DIR/lib",
|
|
|
+ runner_log_dir: "$RUNNER_ROOT_DIR/log",
|
|
|
+ runner_data_dir: "$RUNNER_ROOT_DIR/data",
|
|
|
+ runner_user: ""
|
|
|
+ )
|
|
|
+
|
|
|
+ File.write!(
|
|
|
+ Path.join(etc, "emqx.conf"),
|
|
|
+ conf_rendered
|
|
|
+ )
|
|
|
+
|
|
|
release
|
|
|
end
|
|
|
|