Mongooseim with rabbitMQ: mochijson2 potentially included by two different applications - erlang

I am trying to build mongooseim with rabbitMQ. Im getting the below error while doing make rel.
==> rel (generate)
ERROR: generate failed while processing /home/mongoose/MongooseIM/rel: {'EXIT',{{badmatch,{error,"Module mochijson2 potentially included by two different applications: mochijson2 and rabbit_common."}},
[{rebar_reltool,generate,2,[]},
{rebar_core,run_modules,4,[]},
{rebar_core,execute,5,[]},
{rebar_core,process_dir1,6,[]},
{rebar_core,process_each,5,[]},
{rebar_core,process_dir1,6,[]},
{rebar_core,process_commands,2,[]},
{rebar,main,1,[]}]}}
make: *** [rel] Error 1
What should be the best way to fix this? I didnt get much info from google. My rebar configuration file is as below:
{ok, Path} = file:get_cwd(),
ConfigureOut = Path ++ "/../configure.out",
Conf = case file:consult(ConfigureOut) of
{ok, Terms} -> Terms;
E -> io:format("WARN: error ~p reading file: ~p - using default rel config~n", [E, ConfigureOut]), []
end,
BaseAppsToRun = [compiler,
lager,
kernel,
mnesia,
sasl,
ssl,
stdlib,
ejabberd,
inets,
syntax_tools,
p1_stringprep,
exml,
cowboy,
fusco,
folsom,
exometer,
xmerl,
amqp_client,
rabbit_common],
AppsToRunIn = BaseAppsToRun ++ proplists:get_value(apps_to_run, Conf, []),
AppsToRun = ordsets:to_list(ordsets:from_list(AppsToRunIn)),
BaseAppsToInclude = AppsToRun ++
[asn1,
crypto,
public_key,
goldrush,
runtime_tools,
p1_utils,
ranch,
cowlib,
bear,
mochijson2,
p1_cache_tab,
pa,
base16,
cuesport,
alarms,
idna,
recon,
setup,
xmerl,
amqp_client,
rabbit_common],
RemovedApps = [mysql,pgsql,redo,seestar,odbc],
AppsToIncludeIn = BaseAppsToInclude ++ proplists:get_value(apps_to_include, Conf, []),
AppsToInclude = ordsets:to_list(ordsets:from_list(AppsToIncludeIn)),
IncludeApps = lists:map(fun(App) -> {app, App, [{incl_cond, include}]} end, AppsToInclude),
[{sys, [
{lib_dirs, ["../apps", "../deps"]},
{incl_cond, exclude},
{rel, "mongooseim", "", [mongoose | AppsToRun]},
{rel, "start_clean", "", [kernel,stdlib]},
{boot_rel, "mongooseim"},
{profile, embedded},
{excl_archive_filters, [".*"]}, % do no archive built libs
{excl_sys_filters, ["^bin/.*",
"^erts.*/bin/(dialyzer|typer)"]},
{app, mongoose, [{incl_cond, include}, {lib_dir, ".."}]}
] ++ IncludeApps},
{target_dir, "mongooseim"},
{overlay_vars, "vars.config"},
{overlay, [{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/mongooseim", "bin/mongooseim"},
{copy, "files/mongooseimctl", "bin/mongooseimctl"},
{copy, "files/app.config", "etc/app.config"},
{template, "files/vm.args", "etc/vm.args"},
{template, "files/ejabberd.cfg", "etc/ejabberd.cfg"},
{mkdir, "var"},
{mkdir, "var/log"}
]}
].

I have faced the same problem before. There are several ways to solve the problem.
use older version of rabbitmq common. common's 2.8.2 version doesn't contain mochijson2 module.
In the "reltool.config" file, try to exclude mochijson2 for rabbitmq common or from mochiweb. ( it need to read carefully release-related documents).

Related

Erlang rebar3 builds

I am building a server based on 'cowboy', using 'jiffy' for json processing. The problem I am running into is that after starting the shell by executing the binary generated by rebar3, only 'cowboy' is functioning as expected, but I have no access to mnesia, which is part of OTP. Also running rebar3 using the .config file produces this output:
>There are missing function calls in the release.
===> Make sure all applications needed at runtime are included in the release.
===> db_access:init_tables/0 calls undefined function **mnesia:create_table/2**
===> db_access:insert_apod_entries/1 calls undefined function **mnesia:transaction/1**
===> db_access:insert_apod_entries/1 calls undefined function **mnesia:write/1**
If I start Erlang by issuing the command 'erl' then mnesia is availabe.
I've include the rebar.config I'm using. Any help with this issue would be greatly appreciated.
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%% escript_incl_extra is for internal rebar-private use only.
%% Do not use outside rebar. Config interface is not stable.
{require_erts_vsn, ".*"}.
{require_otp_vsn, ".*"}.
{require_min_otp_vsn, ".*"}.
{escript_incl_extra, [{"priv/templates/*", "."}]}.
{include_src, false}.
{deps, [
{jiffy, "1.1.1", "deps/"},
{cowlib,"2.11.0", "deps/"},
{cowboy, "2.9.0", "deps/"}
]}.
{erl_first_files, ["src/db_access.erl",
"src/tar_watch_handler.erl",
"star_watch_server_app.erl",
"star_watch_server_sup.erl"
]}.
% {artifacts, ["/home/oleg/Projects/erlang_practice/star_watch_server/deps/jiffy/priv/jiffy.so"]}.
{plugins, [
{ pc, {git, "git#github.com:blt/port_compiler.git", {branch, "master"}}}
]}.
{overrides,
[{override, jiffy, [
{plugins, [pc]},
{artifacts, ["priv/jiffy.so"]},
{provider_hooks, [
{post,
[
{compile, {pc, compile}},
{clean, {pc, clean}}
]
}]
}
]}
]}.
{base_dir, "_build"}.
%% directory in '<base_dir>/<profile>/' where deps go
{deps_dir, "lib"}.
%% where rebar3 operates from; defaults to the current working directory
{root_dir, "."}.
%% where checkout dependencies are to be located
{checkouts_dir, "_checkouts"}.
%% where, under <base_dir>/<profile> checkout dependencies are to be built
{checkouts_out_dir, "checkouts"}.
%% directory in '<base_dir>/<profile>/' where plugins go
{plugins_dir, "plugins"}.
%% directories where OTP applications for the project can be located
{project_app_dirs, ["apps/*", "lib/*", "."]}.
%% Directories where source files for an OTP application can be found
{src_dirs, ["src"]}.
%% Paths to miscellaneous Erlang files to compile for an app
%% without including them in its modules list
{extra_src_dirs, []}.
%% Types dict:dict() and digraph:digraph() have been introduced in Erlang 17.
%% At the same time, their counterparts dict() and digraph() are to be
%% deprecated in Erlang 18. namespaced_types option is used to select proper
%% type name depending on the OTP version used.
{erl_opts,
[
{platform_define, "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'},
{platform_define, "(linux|freebsd)", 'BACKLOG', 128},
{platform_define, "R13", 'old_inets'},
{src_dirs, ["src"]}
]}.
{minimum_otp_vsn, "25.0.4"}.
{application_resource_extensions, [
".app.src.script", ".app.src"
]}.
{cover_enabled, true}.
{validate_app_modules, true}.
{base_dir, "_build"}.
%% directory in '<base_dir>/<profile>/' where deps go
{deps_dir, "lib"}.
%% where rebar3 operates from; defaults to the current working directory
{root_dir, "."}.
%% where checkout dependencies are to be located
{checkouts_dir, "_checkouts"}.
%% where, under <base_dir>/<profile> checkout dependencies are to be built
{checkouts_out_dir, "checkouts"}.
{xref_checks, []}.
{xref_queries,
[{"(XC - UC) || (XU - X - B
- (\"escript\":\"foldl\"/\"3\")
- (\"eunit_test\":\"function_wrapper\"/\"2\")
- (\"eflame\":\"apply\"/\"5\")
- (\"abnfc\":\"file\"/\"2\")
- (\"erlydtl\":\"compile\"/\"3\")
- (\"lfe_comp\":\"file\"/\"2\")
- (\"neotoma\":\"file\"/\"2\")
- (\"protobuffs_compile\":\"scan_file\"/\"2\")
- (\"gpb_compile\":\"file\"/\"2\")
- (\"gpb_compile\":\"format_error\"/\"1\")
- (\"diameter_codegen\":\"from_dict\"/\"4\")
- (\"diameter_dict_util\":\"format_error\"/\"1\")
- (\"diameter_dict_util\":\"parse\"/\"2\")
- (\"erlang\":\"timestamp\"/\"0\")
- (\"rebar_rnd\":\"seed\"/\"1\")
- (\"rebar_rnd\":\"uniform\"/\"0\"))",
[]}]}.
{dialyzer,
[
{plt_extra_apps, [diameter]},
{warnings,
[
unmatched_returns,
error_handling,
race_conditions
]}
]}.
You will need to add mnesia to your app's app.src file.
From http://rebar3.org/docs/workflow/#setting-up-dependencies
If the dependency is needed at runtime by your application in order for it to work (e.g. you need a web server or call the library directly), add it to your application’s .app.src file under the {applications, [stdlib, kernel, ...]} tuple.
The tool that generates the release (relx) also uses the same definition to figure out which applications to include in the release.

Errors occurred when EMQ started after adding plug-ins: You've tried to set XXX, but there is no set with that name

I use emqttd-windows 10-v2.3.11
I want to load custom plug-ins in EMQTT.
I placed the plug-in file under the EMQTT\emqttd-windows10-v2.3.11\emqttd\lib directory and the configuration file under the EMQTT\emqttd-windows 10-v2.3.11\emqttd\etc\plugins directory.
The following error occurred when the command ". binemqttd console" was executed in CMD to start EMQ. Errors may mean that EMQTT cannot find new variables in the plug-in.
D:\softwareBag\EMQTT\emqttd-windows10-v2.3.11\emqttd>.\bin\emqttd console
21:47:46.858 [error] You've tried to set wunaozai.auth.redis.server, but there is no setting with that name.
21:47:46.858 [error] Did you mean one of these?
21:47:46.906 [error] auth.redis.server
21:47:46.906 [error] auth.ldap.servers
21:47:46.906 [error] auth.mongo.server
21:47:46.906 [error] You've tried to set wunaozai.auth.redis.pool, but there is no setting with that name.
21:47:46.906 [error] Did you mean one of these?
21:47:46.948 [error] auth.redis.pool
21:47:46.948 [error] auth.mongo.pool
21:47:46.948 [error] auth.mysql.pool
21:47:46.949 [error] You've tried to set wunaozai.auth.redis.database, but there is no setting with that name.
21:47:46.949 [error] Did you mean one of these?
21:47:46.994 [error] auth.redis.database
21:47:46.994 [error] auth.mongo.database
21:47:46.994 [error] auth.mysql.database
21:47:46.995 [error] You've tried to set wunaozai.auth.redis.auth_cmd, but there is no setting with that name.
21:47:46.995 [error] Did you mean one of these?
21:47:47.056 [error] auth.redis.auth_cmd
21:47:47.056 [error] auth.redis.acl_cmd
21:47:47.056 [error] auth.redis.super_cmd
21:47:47.056 [error] You've tried to set wunaozai.auth.redis.password_hash, but there is no setting with that name.
21:47:47.057 [error] Did you mean one of these?
21:47:47.130 [error] auth.redis.password_hash
21:47:47.130 [error] auth.ldap.password_hash
21:47:47.130 [error] auth.mongo.auth_query.password_hash
21:47:47.130 [error] You've tried to set wunaozai.auth.redis.super_cmd, but there is no setting with that name.
21:47:47.130 [error] Did you mean one of these?
21:47:47.202 [error] auth.redis.super_cmd
21:47:47.202 [error] auth.redis.auth_cmd
21:47:47.202 [error] auth.redis.acl_cmd
21:47:47.202 [error] You've tried to set wunaozai.auth.redis.acl_cmd, but there is no setting with that name.
21:47:47.202 [error] Did you mean one of these?
21:47:47.266 [error] auth.redis.acl_cmd
21:47:47.266 [error] auth.redis.auth_cmd
21:47:47.266 [error] auth.redis.super_cmd
21:47:47.267 [error] You've tried to set wunaozai.msg.kafka.server, but there is no setting with that name.
21:47:47.267 [error] Did you mean one of these?
21:47:47.328 [error] auth.mongo.server
21:47:47.328 [error] auth.mysql.server
21:47:47.328 [error] auth.pgsql.server
21:47:47.336 [error] Error generating configuration in phase transform_datatypes
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.msg.kafka.server
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.acl_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.super_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.password_hash
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.auth_cmd
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.database
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.pool
21:47:47.336 [error] Conf file attempted to set unknown variable: wunaozai.auth.redis.server
I have consulted EMQTT customer service staff, they said that the plug-in configuration file and configuration file parsing file schema is wrong, but I don't know what is wrong.
The following is the content of my plug-in configuration file (.conf)
## redis config
wunaozai.auth.redis.server = 127.0.0.1:6379
wunaozai.auth.redis.pool = 8
wunaozai.auth.redis.database = 0
##wunaozai.auth.redis.password =
wunaozai.auth.redis.auth_cmd = HMGET mqtt_user:%u password
wunaozai.auth.redis.password_hash = plain
wunaozai.auth.redis.super_cmd = HGET mqtt_user:%u is_superuser
wunaozai.auth.redis.acl_cmd = HGETALL mqtt_acl:%u
## kafka config
wunaozai.msg.kafka.server = 127.0.0.1:9092
##wunaozai.msg.kafka.topic = test
The following is the content of my plug-in configuration file parsing file (. schema)
%% emq_auth_pgsl config mapping
{mapping, "auth.pgsql.server", "emq_auth_pgsql.server", [
{default, {"127.0.0.1", 5432}},
{datatype, [integer, ip, string]}
]}.
{mapping, "auth.pgsql.pool", "emq_auth_pgsql.server", [
{default, 8},
{datatype, integer}
]}.
{mapping, "auth.pgsql.database", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.username", "emq_auth_pgsql.server", [
{default, ""},
{datatype, string}
]}.
{mapping, "auth.pgsql.password", "emq_auth_pgsql.server", [
{default, ""},
{datatype, string}
]}.
{mapping, "auth.pgsql.encoding", "emq_auth_pgsql.server", [
{default, utf8},
{datatype, atom}
]}.
{mapping, "auth.pgsql.ssl", "emq_auth_pgsql.server", [
{default, false},
{datatype, {enum, [true, false]}}
]}.
{mapping, "auth.pgsql.ssl_opts.keyfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.ssl_opts.certfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{mapping, "auth.pgsql.ssl_opts.cacertfile", "emq_auth_pgsql.server", [
{datatype, string}
]}.
{translation, "emq_auth_pgsql.server", fun(Conf) ->
{PgHost, PgPort} =
case cuttlefish:conf_get("auth.pgsql.server", Conf) of
{Ip, Port} -> {Ip, Port};
S -> case string:tokens(S, ":") of
[Domain] -> {Domain, 5432};
[Domain, Port] -> {Domain, list_to_integer(Port)}
end
end,
Pool = cuttlefish:conf_get("auth.pgsql.pool", Conf),
Username = cuttlefish:conf_get("auth.pgsql.username", Conf),
Passwd = cuttlefish:conf_get("auth.pgsql.password", Conf, ""),
DB = cuttlefish:conf_get("auth.pgsql.database", Conf),
Encoding = cuttlefish:conf_get("auth.pgsql.encoding", Conf),
Ssl = cuttlefish:conf_get("auth.pgsql.ssl", Conf),
Filter = fun(Opts) -> [{K, V} || {K, V} <- Opts, V =/= undefined] end,
SslOpts = fun(Prefix) ->
Filter([{keyfile, cuttlefish:conf_get(Prefix ++ ".keyfile", Conf, undefined)},
{certfile, cuttlefish:conf_get(Prefix ++ ".certfile", Conf, undefined)},
{cacertfile, cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf, undefined)}])
end,
[{pool_size, Pool},
{auto_reconnect, 1},
{host, PgHost},
{port, PgPort},
{username, Username},
{password, Passwd},
{database, DB},
{encoding, Encoding},
{ssl, Ssl},
{ssl_opts, SslOpts("auth.pgsql.ssl_opts")}]
end}.
{mapping, "auth.pgsql.auth_query", "emq_auth_pgsql.auth_query", [
{datatype, string}
]}.
{mapping, "auth.pgsql.password_hash", "emq_auth_pgsql.password_hash", [
{datatype, string}
]}.
{mapping, "auth.pgsql.pbkdf2_macfun", "emq_auth_pgsql.pbkdf2_macfun", [
{datatype, atom}
]}.
{mapping, "auth.pgsql.pbkdf2_iterations", "emq_auth_pgsql.pbkdf2_iterations", [
{datatype, integer}
]}.
{mapping, "auth.pgsql.pbkdf2_dklen", "emq_auth_pgsql.pbkdf2_dklen", [
{datatype, integer}
]}.
{mapping, "auth.pgsql.super_query", "emq_auth_pgsql.super_query", [
{datatype, string}
]}.
{mapping, "auth.pgsql.acl_query", "emq_auth_pgsql.acl_query", [
{datatype, string}
]}.
{translation, "emq_auth_pgsql.password_hash", fun(Conf) ->
HashValue = cuttlefish:conf_get("auth.pgsql.password_hash", Conf),
case string:tokens(HashValue, ",") of
[Hash] -> list_to_atom(Hash);
[Prefix, Suffix] -> {list_to_atom(Prefix), list_to_atom(Suffix)};
[Hash, MacFun, Iterations, Dklen] -> {list_to_atom(Hash), list_to_atom(MacFun), list_to_integer(Iterations), list_to_integer(Dklen)};
_ -> plain
end
end}.
The full code of the plug-in: https://files.cnblogs.com/files/wunaozai/emq_plugin_wunaozai.zip
I hope the plug-in loads correctly when executing the command ".\bin\emqttd console"
There should be an entry wunaozai.auth.redis.server in your .schema file.
POST such questions at https://github.com/emqx/emqx/issues would be answered faster.

erlang lager_syslog driver failure

I'm trying to use lager_syslog in my project but it seems like a driver is missing.
This is in my rebar.conf:
{deps, [
...
{lager_syslog, {git, "https://github.com/basho/lager_syslog.git", {branch, master}}}
]}.
My test handler:
{lager_syslog_backend, ["test", local1, info]},
The error:
19:29:09.981 [error] Lager failed to install handler {lager_syslog_backend,{"test",local1}} into lager_event, retrying later : {error,
{{shutdown,
{failed_to_start_child,
syslog,
"could not load driver syslog_drv: \"cannot open shared object file: No such file or directory\""}},
{syslog_app,
start,
[normal,
[]]}}}
Any suggestion?
thanks to Kenneth Lakin who answered my question in mailing list
IIRC, rebar3 moved the port compiler out to a rebar3 plugin, rather than
packing it in with the core project. From what I've seen, rebar2
projects that relied on it will fail to load their port drivers.
Add
{overrides,
[{override, syslog, [
{plugins, [pc]},
{artifacts, ["priv/syslog_drv.so"]},
{provider_hooks, [
{post,
[
{compile, {pc, compile}},
{clean, {pc, clean}}
]
}]
}
]}
]}.
to a rebar.conf in your project, clean, and rebuild. (The syslog project
is where lager_syslog's port driver lives.)
See also: https://github.com/blt/port_compiler#use-with-existing-dependency

Database is not created while release Erlang application

I created a Erlang application, a small calendar_server. Which insert events, retrieve them and also edit and delete the events. It works correctly when run on the prompt(using erl). I inserted events(birthdays, meetings etc), then the database(Mnesia.nonode#nohost) is created on the directory. And it possible to retrieve the events. But when created the same application using rebar/rebar3, no database is created. I really like to know what the problem i have faced, or what mistake i did.
The reltool.config and calendarApp.app.src are given below..
reltool.config
{sys, [
{lib_dirs, ["../apps"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "calendarApp", "1",
[
kernel,
stdlib,
sasl,
mnesia,
calendarApp
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "calendarApp"},
{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, mnesia, [{incl_cond, include}]},
{app, calendarApp, [{incl_cond, include}]}
]}.
{target_dir, "calendarApp"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/calendarApp", "bin/calendarApp"},
{copy, "files/calendarApp.cmd", "bin/calendarApp.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"}
]}.
calendarApp.app.src
{application, calendarApp,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib,
mnesia
]},
{mod, { calendarApp_app, []}},
{env, []}
]}.
If anyone know why the database is not created, please help me to find my mistake.
For creating disc-based Mnesia you can use mnesia:create_schema/1 function (which I think you did somewhere in your code). This function requires Mnesia to be stopped.
In your reltool.config you specified mnesia application before calendarApp application which is where you probably created mnesia disc-based schema. It means that mnesia was started before creating its schema, so the schema cannot be created.
If you change the order of mnesia and calendarApp under the key of rel in your reltool.config file, everything should be correct.
{sys, [
{lib_dirs, ["../apps"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "calendarApp", "1",
[
kernel,
stdlib,
sasl,
calendarApp,
mnesia
]},
...
Yes, I started myApp (dumperl_sync) first:
{relx, [{release, { dumperl_sync, "0.1.0" },
[dumperl_sync,
sasl,
mnesia
]},
...
}.
Then, in application behaviour:
start(_Application, _Type) ->
application:set_env(mnesia, dir,"/path/to/Mnesia.node"),
mnesia:create_schema([node()])
...
end.
Then, in gen_server behaviour inside handle_info:
handle_info(_, State) ->
mnesia:start(),
mnesia:create_table(dates,
[
{disc_only_copies, [node()]},
{attributes,record_info(fields, dates)}
]
)
....
{noreply, State}.
dates is a record:
-record(dates,{}).
Everything should be correct!

rabbitmq-erlang-client, using rebar friendly pkg, works on dev env fails on rebar release

I am successfully using the rebar-friendly package of rabbitmq-erlang-client for a simple Hello World rebarized and OTP "compliant" app and things work fine on the dev environment. I am able to fire up an erl console and do my application:start(helloworld). and connect to the broker, open up a channel and communicate to queues.
However, then I proceed to do rebar generate and it builds up the release just fine, but when I try to fire up from the self contained release package then things suddenly explode.
I know rebar releases are known to be an obscure art, but I would like to know what are my options as far as deployment for an app using the rabbitmq-erlang-client.
Below you will find the output of the console on the crash:
=INFO REPORT==== 18-Dec-2012::16:41:35 ===
application: session_record
exited: {{{badmatch,
{error,
{'EXIT',
{undef,
[{amqp_connection_sup,start_link,
[{amqp_params_network,<<"guest">>,<<"guest">>,<<"/">>,
"127.0.0.1",5672,0,0,0,infinity,none,
[#Fun<amqp_auth_mechanisms.plain.3>,
#Fun<amqp_auth_mechanisms.amqplain.3>],
[],[]}],
[]},
{supervisor2,do_start_child_i,3,
[{file,"src/supervisor2.erl"},{line,391}]},
{supervisor2,handle_call,3,
[{file,"src/supervisor2.erl"},{line,413}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,588}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,227}]}]}}}},
[{amqp_connection,start,1,
[{file,"src/amqp_connection.erl"},{line,164}]},
{hello_qp,start_link,0,[{file,"src/hello_qp.erl"},{line,10}]},
{session_record_sup,init,1,
[{file,"src/session_record_sup.erl"},{line,55}]},
{supervisor_bridge,init,1,
[{file,"supervisor_bridge.erl"},{line,79}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,227}]}]},
{session_record_app,start,[normal,[]]}}
type: permanent {"Kernel pid terminated",application_controller
EDIT: As requested in the comments.
reltool.config
{sys, [
{lib_dirs, ["..", "../deps"]},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "session_record", "0.1.0",
[
kernel,
stdlib,
sasl,
session_record
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "session_record"},
{profile, embedded},
{incl_cond, derived},
{mod_cond, derived},
{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, session_record, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]},
{app, hipe, [{incl_cond, exclude}]}
]}.
{target_dir, "session_record"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/session_record", "bin/session_record"},
{copy, "files/session_record.cmd", "bin/session_record.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"}
]}.
Try changing {mod_cond, derived} to {mod_cond, all}. That means that reltool will not try to be clever about which modules to take from the included applications. I suspect that your problem is that reltool didn't consider amqp_connection_sup to be necessary; you could confirm that by checking whether it's present in lib/amqp_client-0.8/ebin.
Answer given by #legoscia worked.
Here is sample, reltool.config
%% -*- mode: erlang -*-
%% ex: ft=erlang
{sys, [
{lib_dirs, ["..","../deps"]},
{erts, [{mod_cond, all}, {app_file, strip}]},
{app_file, strip},
{rel, "chat_grabber", "1",
[
kernel,
stdlib,
sasl,
couchbeam,
chat_grabber
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "chat_grabber"},
{profile, embedded},
{incl_cond, derived},
{excl_archive_filters, [".*"]}, %% Do not archive built libs
{excl_sys_filters, ["^bin/(?!start_clean.boot)",
"^erts.*/bin/(dialyzer|typer)",
"^erts.*/(doc|info|include|lib|man|src)"]},
{excl_app_filters, ["\.gitignore"]},
{app,couchbeam,[{mod_cond,app},{incl_cond,include},{lib_dir, "../deps/"}]},
{app, chat_grabber, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
]}.
{target_dir, "chat_grabber"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"},
{copy, "chat_grabber/bin/start_clean.boot",
"\{\{erts_vsn\}\}/bin/start_clean.boot"},
{copy, "files/chat_grabber", "bin/chat_grabber"},
{copy, "files/chat_grabber.cmd", "bin/chat_grabber.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"}
]}.

Resources