How do I set up a new ejabberd server?

152 views Asked by At

I'm trying to figure out how to properly setup an ejabberd project that allows for easy compilation of custom beam files- so far, we've been using an existing project that is cumbersome to manage, and uses erlide as the IDE.

I would like to set up the project in a way that I can use a more helpful IDE like vscode, and somehow streamline the compiling and copying of the beam files and updating the module on the server.

Writing code in Elixir is fine as well- I just want the project to be set up in a way that is dev friendly.

Apologies if the question is too broad, but I'm not exactly sure how else to best phrase it. If you feel like I'm missing something in my current flow, please let me know, as I've basically inherited this project. If there are any clarifications required, let me know as well.

Thanks.

1

There are 1 answers

4
Badlop On

easy compilation of custom beam files

somehow streamline the compiling and copying of the beam files and updating the module on the server.

If the task is about compiling and loading additional modules, a running ejabberd node can compile, load and start additional modules in runtime, see https://docs.ejabberd.im/developer/extending-ejabberd/modules/#ejabberd-contrib

Usually the modules come from https://github.com/processone/ejabberd-contrib but you can tell ejabberd to download other modules from other git repositories, or you can copy modules source code and tell ejabberd to install them. And those modules can be written in Erlang or Elixir. Full example: https://docs.ejabberd.im/developer/extending-ejabberd/elixir/#elixir-module-in-ejabberd-contrib

Basically:

  1. you write the module in your development machine, test it...
  2. when happy with the source code, copy mod_whatever.erl to the production machine, $HOME/.ejabberd-modules/sources/mod_whatever as explained in the example mentioned earlier
  3. run ejabberdctl module_install mod_whatever

In step 2, instead of copying the source code yourself, you can have a git repository just for your module, tell ejabberd the module's git URL, similarly to https://github.com/processone/ejabberd-contrib/tree/master/extra

BTW, for step 3, starting in ejabberd 22.10, there's a page in ejabberd webadmin to install and uninstall those modules (copying the files requires manual administration of course).

I would like to set up the project in a way that I can use a more helpful IDE like vscode

What a coincidence, these days I'm playing with VSCode variants (VSCode, VSCodium, Coder's code-server and Github Codespaces) and how to develop ejabberd using them. This is useful for step 1 that I mentioned earlier (write module and test it). If you are interested in ejabberd + VSCode, tell me.