processone / ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
https://www.process-one.net/en/ejabberd/
Other
6.09k stars 1.51k forks source link

mod_hello_world not running #3032

Closed shaggi7 closed 5 years ago

shaggi7 commented 5 years ago

Hi, I am making a custom module following the tutorial https://docs.ejabberd.im/developer/extending-ejabberd/modules/

I have build a new ejabberd instance from source just today . Here are the steps I did

  1. Made a file mod_hello_world.erl and copied the code from tutorial in it.
  2. Saved this file in "ejabberd-master/src" folder .
  3. sudo make install
  4. Succesfully created .beam file in the "ejabberd-master/bin" folder .
  5. Updated the ejabberd.yml file as follow:
    mod_vcard: {}
    mod_vcard_xupdate: {}
    mod_version:
    show_os: false
    mod_hello_world: {}

    now when i am running the the command "ejabberdctl live" I am getting this abrupt behaviour :

    
    $ ejabberdctl live
    --------------------------------------------------------------------

IMPORTANT: ejabberd is going to start in LIVE (interactive) mode. All log messages will be shown in the command shell. You can interact with the ejabberd node if you know how to use it. Please be extremely cautious with your actions, and exit immediately if you are not completely sure.

To exit this LIVE mode and stop ejabberd, press: q(). and press the Enter key


To bypass permanently this warning, add to ejabberdctl.cfg the line: EJABBERD_BYPASS_WARNINGS=true Press return to continue

Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

Eshell V10.4.4 (abort with ^G) (ejabberd@localhost)1> 10:51:24.339 [notice] Changed loghwm of /usr/local/var/log/ejabberd/error.log to 100 10:51:24.339 [notice] Changed loghwm of /usr/local/var/log/ejabberd/ejabberd.log to 100 10:51:24.370 [info] Loading configuration from /usr/local/etc/ejabberd/ejabberd.yml 10:51:24.450 [critical] Failed to start ejabberd application: Invalid value of option modules: unknown ejabberd module: mod_hello_world. Did you mean mod_disco_opt?


What step did i miss or overdo? Please help.
zinid commented 5 years ago

Not a bug.

shaggi7 commented 5 years ago

Hi @zinid But when everything goes right when compiling . Why just adding it to the ejabberd.yml file is creating errors.

See this stackoverflow page: https://stackoverflow.com/questions/56797931/error-when-creating-custom-module-for-ejabberd

I have done this only still it is making problems. This is important @zinid. Please help.

zinid commented 5 years ago

But when everything goes right when compiling . Why just adding it to the ejabberd.yml file is creating errors.

Because ejabberd doesn't see your BEAM file.

zinid commented 5 years ago

I also will probably never understand why everyone goes the hardest way possible. This is how you MUST develop for ejabberd (and how I do it): 1) clone ejabberd repo: git clone https://something-something/ejabberd 2) cd ejabberd 3) put mod_foo.erl into src directory 4) ./autogen.sh && ./configure --something-something && make 5) create ejabberd.yml 6) run ejabberd: erl +K true -pa ebin -pa deps/*/ebin -name ejabberd -s ejabberd