Related
When I run ./rebar get-deps compile escriptize, it fails with the following:
WARN: 'escriptize' command does not apply to directory /path/to/foo
Command 'escriptize' not understood or not applicable
What have I forgotten?
Even though you're generating an escript package, rebar still needs the foo.app file. If you didn't use ./rebar create-app appid=foo to create your "application", you'll need to create one by hand:
{application, foo,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel, stdlib
]},
{env, []}
]}.
Note that you might need to ./rebar compile again in order to generate the foo.app file before ./rebar escriptize will generate the script correctly.
I have configured ejabberd with mysql , but after installation I am not able to start ejabberd server due to a syntax error.
%% Modules enabled in all ejabberd virtual hosts.
%%
{modules,
[
%%{mod_adhoc_odbc, []},
%%{mod_announce_odbc, [{access, announce}]}, % requires mod_adhoc
%%{mod_caps_odbc, []},
%%{mod_configure_odbc,[]}, % requires mod_adhoc
%%{mod_admin_extra_odbc, []},
%%{mod_disco_odbc, []},
%%{mod_echo, [{host, "echo.localhost"}]},
%%{mod_irc_odbc, []},
%% NOTE that mod_http_fileserver must also be enabled in the
%% "request_handlers" clause of the "ejabberd_http" listener
%% configuration (see the "LISTENING PORTS" section above).
%%{mod_http_fileserver, [
%% {docroot, "/var/www"},
%% {accesslog, "/var/log/ejabberd/access.log"}
%% ]},
{mod_last_odbc, []},
%%{mod_muc_odbc, [
%%{host, "conference.#HOST#"},
{access, muc},
{access_create, muc},
{access_persistent, muc},
{access_admin, muc_admin},
{max_users, 500}
]},
{mod_muc_log_odbc,[]},
{mod_offline_odbc, [{access_max_user_messages, max_user_offline_messages}]},
{mod_privacy_odbc, []},
{mod_private_odbc, []},
{mod_offline_post_odbc, [
{auth_token, "offline_post_auth_token"},
{post_url, "http://localhost:5280/offline_post"}
]},
{mod_available_post_odbc, [
{auth_token, "mod_available_post"},
{post_url, "http://localhost:5280/available_post"}
]},
{mod_unavailable_post_odbc, [
{auth_token, "unavailable_post_auth_token"},
{post_url, "http://localhost:5280/unavailable_post"}
]},
{mod_proxy65_odbc, [
{access, local},
{shaper, c2s_shaper}
]},
{mod_pubsub_odbc, [ % requires mod_caps
{access_createnode, pubsub_createnode},
{pep_sendlast_offline, false},
{last_item_cache, false},
%%{plugins, ["default", "pep"]}
{plugins, ["flat", "hometree", "pep"]} % pep requires mod_caps
]},
{mod_register_odbc, [
%%
%% After successful registration, the user receives
%% a message with this subject and body.
%%
{welcome_message, {"Welcome!",
"Welcome to a Jabber service powered by Debian. "
"For information about Jabber visit "
"http://www.jabber.org"}},
%% Replace it with 'none' if you don't want to send such message:
%%{welcome_message, none},
%%
%% When a user registers, send a notification to
%% these Jabber accounts.
%%
%%{registration_watchers, ["admin1#example.org"]},
{access, register}
]},
{mod_roster_odbc, []},
{mod_service_log_odbc,[]},
{mod_shared_roster_odbc,[]},
{mod_stats_odbc, []},
{mod_time_odbc, []},
{mod_vcard_odbc, []},
{mod_version_odbc, []}
]}.
%%
And getting the error is,
=ERROR REPORT==== 2014-01-17 16:45:37 ===
E(<0.37.0>:ejabberd_config:187) : The following lines from your configuration file might be relevant to the error:
626:
627: {access, register}
628: ]},
629: {mod_roster_odbc, []},
630: {mod_service_log_odbc,[]},
631: {mod_shared_roster_odbc,[]},
632: {mod_stats_odbc, []},
633: {mod_time_odbc, []},
634: {mod_vcard_odbc, []},
635: {mod_version_odbc, []}
636: ]}.
637:
638: %%
639: %% Enable modules with custom options in a specific virtual host
=ERROR REPORT==== 2014-01-17 16:45:37 ===
E(<0.37.0>:ejabberd_config:106) : Problem loading ejabberd config file /etc/ejabberd/ejabberd.cfg approximately in the line 636: syntax error before: ']'
Please help me to fix this issue.Thanks in advanced.
Here is the problem:
%%{mod_muc_odbc, [
%%{host, "conference.#HOST#"},
{access, muc},
{access_create, muc},
{access_persistent, muc},
{access_admin, muc_admin},
{max_users, 500}
]},
You have commented the first line, but not the rest of the mod_muc_odbc config, causing unbalanced parentheses. Either uncomment the first line, or comment out the rest of them as well.
I'm testing rebar on
Windows 8 64Bis
Erlang 64bits R15B02
I've compiled rebar from github code and created a basic app
$ mkdir testapp; cd testapp
$ mkdir rel
$ rebar create-app appid=testapp
$ echo "{sub_dirs, ["rel"]}." > rebar.config
$ cd rel
$ rebar create-node nodeid=testnode
$ cd -
$ rebar compile
$ rebar generate
ERROR: generate failed while processing testapp/rel: {'EXIT',{{badmatch,{error,"testapp: : Missing application directory."}
...
I'm reading the reltool documentation but i cant found anything about application dir the only relevant option is incl_cond but is defined by default by rebar command
src/testapp.app.src
{application, testapp,
[
{description, ""},
{vsn, "1"},
{registered, []},
{applications, [
kernel,
stdlib
]},
{mod, { testapp_app, []}},
{env, []}
]}.
rel/reltool.config
{sys, [
{lib_dirs, []},
{erts, [{mod_cond, derived}, {app_file, strip}]},
{app_file, strip},
{rel, "testapp", "1",
[
kernel,
stdlib,
sasl,
testapp
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "testapp"},
{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, testapp, [{mod_cond, app}, {incl_cond, include}]}
]}.
{target_dir, "testapp"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
{copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
{copy, "files/testapp", "bin/testapp"},
{copy, "files/testapp.cmd", "bin/testapp.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"}
]}.
In my case I had to modify the default rel/reltool.config line
{lib_dirs, []},
to
{lib_dirs, ["../../"]},
Where the layout of my project is:
Makefile
ebin/
rebar.config
rel/
src/
This might help you. (quoted below in case the original link disappears)
Not exactly sure what's the reason for that change for versions following R15B01 though.
Thanks to Siri, reltool in R15B01 includes a really useful feature.
Many Erlang projects are using the following structure:
./src/foo.app.src
./src/foo.erl
./rel/reltool.config
When you wanted to reference the application foo in
rel/reltool.config, you previously had three options:
* project-local libs/ or apps/ directory
* unsafe {lib_dirs, "../.."} reltool.config setting
* rebar_reltool_link fake_lib_dir plugin
Starting with R15B01 all you have to do now is specify
{app, foo, [{incl_cond, include}, {lib_dir, ".."}]}
in reltool.config for applications not in lib_dirs.
Although R15B01 is still in development, this feature is complete and
can be used in the otp.git maint branch.
Refer this guideline,
https://github.com/rebar/rebar/wiki/Release-handling
If you're using R15B01 or newer change,
{app, exemplar, [{mod_cond, app}, {incl_cond, include}, {lib_dir, ".."}]}
above way of mentioning path solved the application directory not found issue for me.
Thanks to much help here, I'm well on my way toward building my first Erlang release. No real code yet, but I want to understand how it's done. I've consulted and followed several web tutorials as well Martin et. al., but still seem to be missing something.
When I try to start my release I get:
lloyd#Reliance:~/Programming/Erlang/learn$ sh rel/learn/bin/learn start
[: 129: Node 'learn#127.0.0.1' not responding to pings.: unexpected operator
Under the project directory "learn" I have:
apps rebar rebar.config rel
In rebar.config, I have:
{cover_enabled, true}.
{sub_dirs, ["rel","apps/zzz", "apps/zzz_lib"]}.
In ...learn/apps, I have:
zzz zzz_lib
zzz and zzz_lib have all the right stuff in them so far as I can tell. From lean, I can clean, compile, and create docs.
In .../rel,I have:
files learn reltool.config
See reltool.config below.
I'm missing magic sauce, but what?
Many thanks,
LRP
{sys, [
{lib_dirs, []},
{rel, "learn", "1",
[
kernel,
stdlib,
sasl
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "learn"},
{profile, embedded},
{excl_sys_filters, ["^bin/.*",
"^erts.*/bin/(dialyzer|typer)"]},
{app, sasl, [{incl_cond, include}]}
]}.
{target_dir, "learn"}.
{overlay, [
{mkdir, "log/sasl"},
{copy, "files/erl", "{{erts_vsn}}/bin/erl"},
{copy, "files/nodetool", "{{erts_vsn}}/bin/nodetool"},
{copy, "files/learn", "bin/learn"},
{copy, "files/app.config", "etc/app.config"},
{copy, "files/vm.args", "etc/vm.args"}
]}.
Looks like your retool.config file is missing some entries for the application you have written.
The first part should look something like this.
{sys, [
{lib_dirs, ["../apps"]}, <--- point to where your applications are
{rel, "learn", "1",
[
<your application here> <---- add your application(s) here
kernel,
stdlib,
sasl
]},
{rel, "start_clean", "",
[
kernel,
stdlib
]},
{boot_rel, "learn"},
{profile, embedded},
{excl_sys_filters, ["^bin/.*",
"^erts.*/bin/(dialyzer|typer)"]},
{app, <your application here>, [{incl_cond, include}]}, <-- and here
{app, sasl, [{incl_cond, include}]}
]}.
Here is a sample application from Erlang and OTP in Action that I packaged up using rebar.
https://github.com/tmcgilchrist/simple_cache
The general layout I follow is
simple_cache
|-> apps
| \-> simple_cache
| |-> src
| \-> ebin
|
|-> rebar.config
|-> rel
|-> files
|-> reltool.config
\-> simple_cache
Also rather that doing
sh rel/learn/bin/learn start
use
sh rel/learn/bin/learn console
and enter
application:which_applications().
Which should list a bunch of things plus your application.
eg
[{mysample_app,[],[]},
{sasl,"SASL CXC 138 11","2.1.10"},
{stdlib,"ERTS CXC 138 10","1.17.5"},
{kernel,"ERTS CXC 138 10","2.14.5"}]
I've got a module that I'm attempting to turn into a proper OTP application. Currently, the module has start/0 which starts a genserver which supplies configuration data read from a config file. It then calls inets:start(httpd,config:lookup(httpd_conf)). I gather that I need to move the starting of these out into the .app file's (application list) but I'm not sure how to get my config data into the inets:start function (or pass in httpd)?
Thanks,
--tim
Here's what I've figured out...
First, I needed to create the inets config file:
inets.config:
[{inets, [{services, [{httpd, [{proplist_file,
"8080.conf"}]},
].
Then, create the httpd conf file:
8080.conf
[
{modules, [
mod_alias,
mod_auth,
mod_esi,
mod_actions,
mod_cgi,
mod_dir,
mod_get,
mod_head,
mod_log,
mod_disk_log
]},
{port,8080},
{server_name,"hello_world"},
{server_root,"log"},
{document_root,"www"},
{erl_script_alias, {"/erl", [hello_world]}},
{error_log, "error.log"},
{security_log, "security.log"},
{transfer_log, "transfer.log"},
{mime_types,[
{"html","text/html"},
{"css","text/css"},
{"js","application/x-javascript"}
]}
]
Now, when booting my app, I just reference the inets.conf file with:
$ erl -boot start_sasl -pa ebin -config inets.config
This seems to work not sure if it's the "right" way or not...