繁体   English   中英

Erlang / Rebar3 - 如何添加要发布但不启动的应用程序?

[英]Erlang / Rebar3 - How to add an application to release but not launch it?

我有一个伞形项目,包括 main_app、app1、app2。 main_app 可以单独工作,也可以使用和管理 app1 和 app2。

app1 和 app2 的启动决定在外部(特殊配置文件,由用户填写)。

我使用 rebar.config,其中的一部分:

{lib_dirs, ["apps"]}.
{sub_dirs, [
  "apps/main_app",
  "apps/app1",
  "apps/app2"
]}.

{relx, [{release, {main_app, "0.8.6"},
         [kernel,
          sasl,
          main_app]},
        {sys_config,  "./config/sys.config"},
        {vm_args,     "./config/vm.args"},
        {dev_mode, true},
        {include_src, true},
        {include_erts, false},
        {extended_start_script, true}]
}.

{profiles, [
  {prod, [
    {relx, [
      {dev_mode, false},
      {include_erts, false},
      {include_src, false},
      {sys_config,  "./config/prod_sys.config"},
      {vm_args,     "./config/prod_vm.args"}
    ]}
  ]}
]}.

如果我使用sudo rebar3 shell - 我可以管理 app1 和 app2。 但是,如果我将sudo rebar3 as prod tar的发布sudo rebar3 as prod tar - 我会得到一个不包含 app1 和 app2 的束文件的 tar 存档。 我知道,如果我将 app1 和 app2 放在带有kernel, sasl, main_app的列表中的 release 部分 - 我需要的应用程序将被添加到 release 中,但它们会自动启动(我需要自己启动)!

如何配置 rebar 以将所有库或应用程序添加到 tar 版本,但在启动 main_app 期间不启动它们?

提前致谢!

使用{app, load}语法:

{relx, [
    {release, { Project, Version }, [
        {app1, load}
...

这样,应用程序已加载但未启动。 如果您既不想加载也不想启动应用程序,请使用{app, none} (尽管代码仍会加载)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM