简体   繁体   English

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

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

I have an umbrella project, includes main_app, app1, app2.我有一个伞形项目,包括 main_app、app1、app2。 main_app can work singe, or can work with and manage app1 and app2. main_app 可以单独工作,也可以使用和管理 app1 和 app2。

The decision about the launching of app1 and app2 is on external side (special config file, filled by a user). app1 和 app2 的启动决定在外部(特殊配置文件,由用户填写)。

I use rebar.config, part of it:我使用 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"}
    ]}
  ]}
]}.

If I use sudo rebar3 shell - I can manage app1 and app2.如果我使用sudo rebar3 shell - 我可以管理 app1 和 app2。 But if I pack a release by sudo rebar3 as prod tar - I get a tar archive which does not include beam files of app1 and app2.但是,如果我将sudo rebar3 as prod tar的发布sudo rebar3 as prod tar - 我会得到一个不包含 app1 和 app2 的束文件的 tar 存档。 I know, if I put app1 and app2 to release section in the list with kernel, sasl, main_app - my needed apps will be added to release, but they will be automatically launched (I need to launch by myself)!我知道,如果我将 app1 和 app2 放在带有kernel, sasl, main_app的列表中的 release 部分 - 我需要的应用程序将被添加到 release 中,但它们会自动启动(我需要自己启动)!

How to configure rebar for adding all the libraries or applications to tar release, but not to launch them during starting main_app?如何配置 rebar 以将所有库或应用程序添加到 tar 版本,但在启动 main_app 期间不启动它们?

Thanks in advance!提前致谢!

Use the {app, load} syntax:使用{app, load}语法:

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

That way, the application is loaded but not started.这样,应用程序已加载但未启动。 If you want to neither load nor start the application, use {app, none} (the code is still loaded, though).如果您既不想加载也不想启动应用程序,请使用{app, none} (尽管代码仍会加载)。

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

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