Postgresql 无法使用钢筋生成epgsql启动发布
当我用rebar生成发布应用程序并尝试用key console启动它时,我发现了一个错误 {“init终止于do_boot”,{'cannot load',pgsql,get_file}。 在app.src和reltool.config的所有文件中,我都添加了epgsql应用程序 app.src:Postgresql 无法使用钢筋生成epgsql启动发布,postgresql,erlang,rebar,Postgresql,Erlang,Rebar,当我用rebar生成发布应用程序并尝试用key console启动它时,我发现了一个错误 {“init终止于do_boot”,{'cannot load',pgsql,get_file}。 在app.src和reltool.config的所有文件中,我都添加了epgsql应用程序 app.src: {application, leasing, [ {description, ""}, {vsn, "1"}, {registered, []}, {applications, [
{application, leasing,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib,
crypto,
ssl,
public_key,
epgsql,
amqp_client,
rabbit_common
]},
{mod, { leasing_app, []}},
{env, []}
]}.
reltool.config
{sys, [
{lib_dirs, ["../deps", "../apps"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "leasingnode", "1",
[
kernel,
stdlib,
sasl,
crypto,
ssl,
public_key,
epgsql,
amqp_client,
rabbit_common,
leasing
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "leasingnode"},
{profile, embedded},
{incl_cond, exclude},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app, sasl, [{incl_cond, include}]},
{app, stdlib, [{incl_cond, include}]},
{app, kernel, [{incl_cond, include}]},
{app, crypto, [{incl_cond, include}]},
{app, ssl, [{incl_cond, include}]},
{app, public_key, [{incl_cond, include}]},
{app, epgsql, [{incl_cond, include}]},
{app, amqp_client, [{incl_cond, include}]},
{app, rabbit_common, [{incl_cond, include}]},
{app, leasing, [{incl_cond, include}]}
]}.
{target_dir, "leasingnode"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/leasingnode", "bin/leasingnode"},
{copy, "files/leasingnode.cmd", "bin/leasingnode.cmd"},
{copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
{copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
{copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
{copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
]}.
当我从ERLShell启动它时,一切正常,但当我生成发布时,我有一个错误。
当我关闭epgsql应用程序启动时,我看到所有应用程序(加密、ssl、公钥已加载),但如果再次添加epgsql,则会出现错误
我做错了什么?我自己也在努力解决同样的问题。我发现,即使我将epgsql依赖项放入应用程序文件中,但在代码中不使用它的任何模块,epgsql应用程序也不会包含在发行版中。原来这不是钢筋的问题。幕后 钢筋使用REL工具。这是一个实际生成版本的工具,在我看来,它使用了来自beam文件的一些信息,并且本身剥离了未使用的应用程序 为了解决这个问题,我想出了两种方法:
- a。在代码中使用任何epgsql模块,甚至pgsql:yyy()也可以:)
- b。将{app,epgsql,[{incl_cond,include}]}添加到reltool.config中