emqx / emqx-elixir-plugin

An Example Plugin for EMQX in Elixir
https://emqx.io
24 stars 8 forks source link

No project builder is configured for type mix #15

Closed s4kibs4mi closed 3 years ago

s4kibs4mi commented 5 years ago

Having an issue to build plugin on emqx version 3.2.0.

===> Error building application push_kafka_bridge:
     No project builder is configured for type mix
make: *** [emqx] Error 1
s4kibs4mi commented 5 years ago

@Gilbert-Wong can you please help ?

gilbertwong96 commented 5 years ago

Hi, @s4kibs4mi, How do you configure the rebar.config in emqx-rel?

s4kibs4mi commented 5 years ago
%% NOTE: Order of the deps matters!
{elixir_deps, []}.

{deps,
  [emqx
    , emqx_retainer
    , emqx_management
    , emqx_reloader
    , emqx_bridge_mqtt
    , emqx_sn
    , emqx_coap
    , emqx_stomp
    , emqx_auth_clientid
    , emqx_auth_username
    , emqx_auth_http
    , emqx_auth_jwt
    , emqx_auth_mysql
    , emqx_web_hook
    , emqx_delayed_publish
    , emqx_recon
    , emqx_psk_file
    , emqx_rule_engine
    , emqx_plugin_template
    , {push_broker, {git, "https://github.com/xyz/push_broker", {branch, "release-3.1"}}}
    , {push_kafka_bridge, {git, "https://github.com/xyz/push_kafka_bridge", {branch, "master"}}}
  ]}.

%% Added to deps list for 'cloud' profile
{cloud_deps,
  [emqx_lwm2m
    , emqx_auth_ldap
    , emqx_auth_pgsql
    , emqx_auth_redis
    , emqx_auth_mongo
    , emqx_lua_hook
    , emqx_dashboard
    , emqx_statsd
  ]}.

{edge_deps,
  [emqx_cube]}.

{relx,
  [{include_src, false}
    , {extended_start_script, false}
    , {generate_start_script, false}
    , {sys_config, false}
    , {vm_args, false}
    , {release, {emqx, git_describe},
    [kernel
      , sasl
      , crypto
      , public_key
      , asn1
      , syntax_tools
      , ssl
      , os_mon
      , inets
      , compiler
      , runtime_tools
      , gproc
      , esockd
      , clique
      , getopt
      , cuttlefish
      , jsx
      , cowboy
      , pbkdf2
      , bcrypt
      , mysql
      , emqx
      , {mnesia, load}
      , {ekka, load}
      , {emqx_sn, load}
      , {emqx_coap, load}
      , {emqx_recon, load}
      , {emqx_stomp, load}
      , {emqx_management, load}
      , {emqx_rule_engine, load}
      , {emqx_retainer, load}
      , {emqx_reloader, load}
      , {emqx_bridge_mqtt, load}
      , {emqx_delayed_publish, load}
      , {emqx_web_hook, load}
      , {emqx_auth_clientid, load}
      , {emqx_auth_username, load}
      , {emqx_auth_http, load}
      , {emqx_auth_mysql, load}
      , {emqx_auth_jwt, load}
      , {emqx_psk_file, load}
    ]}
    , {overlay,
    [{mkdir, "etc/"}
      , {mkdir, "log/"}
      , {mkdir, "data/"}
      , {mkdir, "data/mnesia"}
      , {mkdir, "data/configs"}
      , {mkdir, "data/scripts"}
      , {template, "bin/emqx_env", "bin/emqx_env"}
      , {template, "bin/emqx", "bin/emqx"}
      , {template, "bin/emqx_ctl", "bin/emqx_ctl"}
      , {template, "bin/emqx.cmd", "bin/emqx.cmd"}
      , {template, "bin/emqx_ctl.cmd", "bin/emqx_ctl.cmd"}
      , {copy, "{{output_dir}}/../../conf/plugins", "etc/"}
      , {template, "{{output_dir}}/../../conf/emqx.conf", "etc/emqx.conf"}
      , {template, "{{output_dir}}/../../conf/ssl_dist.conf", "etc/ssl_dist.conf"}
      , {template, "{{output_dir}}/../../conf/plugins/emqx_bridge_mqtt.conf", "etc/plugins/emqx_bridge_mqtt.conf"}
      , {template, "{{output_dir}}/../../conf/plugins/emqx_coap.conf", "etc/plugins/emqx_coap.conf"}
      , {template, "{{output_dir}}/../../conf/plugins/emqx_psk_file.conf", "etc/plugins/emqx_psk_file.conf"}
      , {template, "{{output_dir}}/../../conf/plugins/emqx_auth_http.conf", "etc/plugins/emqx_auth_http.conf"}
      , {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"}
      , {copy, "{{output_dir}}/../../conf/acl.conf", "etc/acl.conf"}
      , {copy, "bin/nodetool", "bin/nodetool"}
      , {copy, "{{output_dir}}/../../conf/schema", "releases/{{rel_vsn}}/"}
      , {copy, "bin/install_upgrade_escript", "bin/install_upgrade_escript"}
      , {template, "{{output_dir}}/../../lib/emqx/etc/{{vm_args_file}}", "etc/vm.args"}
      , {copy, "{{output_dir}}/../../lib/emqx/etc/certs", "etc/"}
      , {copy, "{{output_dir}}/../../lib/cuttlefish/cuttlefish", "bin/"}
      , {copy, "{{output_dir}}/../../lib/emqx_psk_file/etc/psk.txt", "etc/psk.txt"}
    ]}
  ]}.

{elixir_relx_apps,
  [
    {push_broker, load},
    {push_kafka_bridge, load}
  ]}.

{edge_relx_apps,
  [{emqx_cube, load}]}.

{cloud_relx_apps,
  [{emqx_auth_ldap, load}
    , {emqx_auth_mongo, load}
    , {emqx_auth_pgsql, load}
    , {emqx_auth_redis, load}
    , {emqx_dashboard, load}
    , {emqx_lua_hook, load}
    , {emqx_lwm2m, load}
    , {emqx_statsd, load}
    , {observer, load}
    , luerl
    , xmerl
  ]}.

{cloud_relx_overlay,
  [{template, "{{output_dir}}/../../conf/plugins/emqx_lwm2m.conf", "etc/plugins/emqx_lwm2m.conf"}
    , {copy, "{{output_dir}}/../../lib/emqx_lwm2m/lwm2m_xml", "etc/"}
  ]}.

{edge_relx_overlay,
  []}.

{edoc_opts, [{preprocess, true}]}.
{erl_opts, [warn_unused_vars, warn_shadow_vars, warn_unused_import,
  warn_obsolete_guard, debug_info]}.

{xref_checks, [undefined_function_calls, undefined_functions, locals_not_used,
  deprecated_function_calls, warnings_as_errors,
  deprecated_functions]}.
{cover_enabled, true}.
{cover_opts, [verbose]}.
{cover_export_enabled, true}.

{plugins, [rebar3_run]}.

{post_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", compile, "./post-compile.sh"}
  , {"win32", compile, "post-compile.cmd"}]}.
s4kibs4mi commented 5 years ago

@Gilbert-Wong any update ?

kabazakra commented 5 years ago

Hi. Have the same issue. Any updates so far? EMQX 3.2.0

gilbertwong96 commented 5 years ago

I have fixed this problem on master branch of emqx-rel

kabazakra commented 5 years ago

Thanks a lot. @gilbertwong96 is it possible to build and load a plugin without rebuilding the EMQX broker? I mean, just put binaries into the folder and run a command?

gilbertwong96 commented 5 years ago

Sorry, @kabazakra, you have to build elixir runtime into emqx release, so the answer is impossible.

kabazakra commented 5 years ago

Understood, @gilbertwong96 . Are there any differences in performance (or something) while running 'make' script locally to build emqx broker versus official release bins. Should I use specific targets in 'make' for 'debug' and 'release' purposes? Any tricks behind?) Just want to clarify what is the best way how to add a plugin and keep performance characteristics the same as official bins have.

gilbertwong96 commented 5 years ago

There're no special tricks behind, just run make!

kabazakra commented 5 years ago

Hi, @gilbertwong96 . I took the latest master for emqx-elixir-plugin and emqx-rel. Issue is reproducible.

===> Compiling emqx_elixir_plugin ===> Error building application emqx_elixir_plugin: No project builder is configured for type mix

Any additional settings for rebar are required?

kabazakra commented 5 years ago

Any updates on this issue?

kabazakra commented 5 years ago

Here is my rebar config

%% NOTE: Order of the deps matters!
{elixir_deps, 
    [ {emqx_elixir_plugin, {git, "https://github.com/emqx/emqx-elixir-plugin.git", {branch, "master"}}}
    ]}.

{deps,
    [ emqx
    , emqx_retainer
    , emqx_management
    , emqx_reloader
    , emqx_bridge_mqtt
    , emqx_sn
    , emqx_coap
    , emqx_stomp
    , emqx_auth_clientid
    , emqx_auth_username
    , emqx_auth_http
    , emqx_auth_jwt
    , emqx_auth_mysql
    , emqx_web_hook
    , emqx_delayed_publish
    , emqx_recon
    , emqx_psk_file
    , emqx_rule_engine
    , emqx_plugin_template

    ]}.

%% Added to deps list for 'cloud' profile
{cloud_deps,
    [ emqx_lwm2m
    , emqx_auth_ldap
    , emqx_auth_pgsql
    , emqx_auth_redis
    , emqx_auth_mongo
    , emqx_lua_hook
    , emqx_dashboard
    , emqx_statsd
    ]}.

{edge_deps,
    [emqx_cube]}.

{relx,
    [ {include_src,false}
    , {extended_start_script,false}
    , {generate_start_script,false}
    , {sys_config,false}
    , {vm_args,false}
    , {release, {emqx, git_describe},
        [ kernel
        , sasl
        , crypto
        , public_key
        , asn1
        , syntax_tools
        , ssl
        , os_mon
        , inets
        , compiler
        , runtime_tools
        , gproc
        , esockd
        , clique
        , getopt
        , cuttlefish
        , jsx
        , cowboy
        , pbkdf2
        , bcrypt
        , mysql
        , emqx
        , {mnesia, load}
        , {ekka, load}
        , {emqx_sn, load}
        , {emqx_coap, load}
        , {emqx_recon, load}
        , {emqx_stomp, load}
        , {emqx_management, load}
        , {emqx_rule_engine, load}
        , {emqx_retainer, load}
        , {emqx_reloader, load}
        , {emqx_bridge_mqtt, load}
        , {emqx_delayed_publish, load}
        , {emqx_web_hook, load}
        , {emqx_auth_clientid, load}
        , {emqx_auth_username, load}
        , {emqx_auth_http, load}
        , {emqx_auth_mysql, load}
        , {emqx_auth_jwt, load}
        , {emqx_psk_file, load}
        ]}
    , {overlay,
        [ {mkdir,"etc/"}
        , {mkdir,"log/"}
        , {mkdir,"data/"}
        , {mkdir,"data/mnesia"}
        , {mkdir,"data/configs"}
        , {mkdir,"data/scripts"}
        , {template,"bin/emqx_env","bin/emqx_env"}
        , {template,"bin/emqx","bin/emqx"}
        , {template,"bin/emqx_ctl","bin/emqx_ctl"}
        , {template,"bin/emqx.cmd","bin/emqx.cmd"}
        , {template,"bin/emqx_ctl.cmd","bin/emqx_ctl.cmd"}
        , {copy,"{{output_dir}}/../../conf/plugins","etc/"}
        , {template,"{{output_dir}}/../../conf/emqx.conf","etc/emqx.conf"}
        , {template,"{{output_dir}}/../../conf/ssl_dist.conf","etc/ssl_dist.conf"}
        , {template,"{{output_dir}}/../../conf/plugins/emqx_bridge_mqtt.conf", "etc/plugins/emqx_bridge_mqtt.conf"}
        , {template,"{{output_dir}}/../../conf/plugins/emqx_coap.conf", "etc/plugins/emqx_coap.conf"}
        , {template,"{{output_dir}}/../../conf/plugins/emqx_psk_file.conf", "etc/plugins/emqx_psk_file.conf"}
        , {template,"{{output_dir}}/../../conf/plugins/emqx_auth_http.conf", "etc/plugins/emqx_auth_http.conf"}
        , {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"}
        , {copy,"{{output_dir}}/../../conf/acl.conf","etc/acl.conf"}
        , {copy,"bin/nodetool","bin/nodetool"}
        , {copy,"{{output_dir}}/../../conf/schema","releases/{{rel_vsn}}/"}
        , {copy,"bin/install_upgrade_escript", "bin/install_upgrade_escript"}
        , {template,"{{output_dir}}/../../lib/emqx/etc/{{vm_args_file}}","etc/vm.args"}
        , {copy, "{{output_dir}}/../../lib/emqx/etc/certs","etc/"}
        , {copy, "{{output_dir}}/../../lib/cuttlefish/cuttlefish","bin/"}
        , {copy, "{{output_dir}}/../../lib/emqx_psk_file/etc/psk.txt", "etc/psk.txt"}
        ]}
    ]}.

{elixir_relx_apps,
    [
      {emqx_elixir_plugin, load}
    ]}.

{edge_relx_apps,
    [{emqx_cube, load}]}.

{cloud_relx_apps,
    [ {emqx_auth_ldap, load}
    , {emqx_auth_mongo, load}
    , {emqx_auth_pgsql, load}
    , {emqx_auth_redis, load}
    , {emqx_dashboard, load}
    , {emqx_lua_hook, load}
    , {emqx_lwm2m, load}
    , {emqx_statsd, load}
    , {observer, load}
    , luerl
    , xmerl
    ]}.

{cloud_relx_overlay,
    [ {template,"{{output_dir}}/../../conf/plugins/emqx_lwm2m.conf", "etc/plugins/emqx_lwm2m.conf"}
    , {copy,"{{output_dir}}/../../lib/emqx_lwm2m/lwm2m_xml","etc/"}
    ]}.

{edge_relx_overlay,
    []}.

{edoc_opts, [{preprocess,true}]}.
{erl_opts, [warn_unused_vars,warn_shadow_vars,warn_unused_import,
            warn_obsolete_guard,debug_info]}.

{xref_checks, [undefined_function_calls,undefined_functions,locals_not_used,
               deprecated_function_calls,warnings_as_errors,
               deprecated_functions]}.
{cover_enabled, true}.
{cover_opts, [verbose]}.
{cover_export_enabled, true}.

{plugins, [rebar3_run]}.

{post_hooks, [ {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", compile, "./post-compile.sh"}
             , {"win32", compile, "post-compile.cmd"}]}.

Error during make execution rebar3.crashdump:


Error: badarg
[{erlang,binary_to_atom,[undefined,utf8],[]},
 {rebar_app_info,apply_overrides,2,
                 [{file,"/opt/rebar3-3.11.1/src/rebar_app_info.erl"},
                  {line,596}]},
 {rebar_prv_install_deps,handle_dep,6,
                         [{file,"/opt/rebar3-3.11.1/src/rebar_prv_install_deps.erl"},
                          {line,306}]},
 {rebar_prv_install_deps,update_unseen_dep,9,
                         [{file,"/opt/rebar3-3.11.1/src/rebar_prv_install_deps.erl"},
                          {line,298}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_prv_install_deps,handle_profile_level,7,
                         [{file,"/opt/rebar3-3.11.1/src/rebar_prv_install_deps.erl"},
                          {line,183}]},
 {rebar_prv_install_deps,do_,1,
                         [{file,"/opt/rebar3-3.11.1/src/rebar_prv_install_deps.erl"},
                          {line,82}]},
 {rebar_core,do,2,
             [{file,"/opt/rebar3-3.11.1/src/rebar_core.erl"},{line,154}]}]
6293 commented 4 years ago

Having this error too. Any updates?

auror commented 3 years ago

Same here. Any update ?