2

This is a very specific and niche question- but something that'll probably help people working on existing codebases.

Current Scenario

We are running ejabberd 18.01 on prod- and we can't really change this right away. Our current setup for running custom modules is this- either modify existing modules from the source code, or make our own custom modules that are compiled using the erlang compiler that's bundled in with the installer from here. We use erlide as our IDE in Eclipse.

We compile the custom files in in erlide, into a separate directory from where our ejabberd .beam files are; and then transfer the files manually from there to the ebin folder in ejabberd. This is done so that we have VCS for our modified module files.

We aren't using rebar3, and I have zero clue as to how to implement in a heavily modified existing codebase without breaking something. Our only legitimate way of debugging is to put loggers at every step of the process, compile, transfer files, and restart the server- which drastically increases dev time.

It is a genuine nightmare to work with, and resources on ejabberd as well as erlang is scarce- we mostly have the docs to go by, and barely any SO questions relevant.

Any suggestions, resources that can help me setup something to help especially for debugging, would be highly appreciated. Maybe something in vscode would be great. Transferring files I've still managed with inotify, but debugging makes me want to tear my hair out. Please help. Thank you.

P.S.- This is all on Ubuntu 20.04, if relevant. Erlang/OTP version - 20.02, erts- 9.2. Please ask for any further clarifications if required.

Athena
  • 155
  • 7
  • 1
    Erlang has great tracing features without requiring you to change the actual code, have a look at [dbg](https://www.erlang.org/doc/man/dbg.html). Typically my tracing session would be starting a remote shell to the node, then `dbg:tracer(), dbg:p(all, c), dbg:tpl(Module, Function, x).` and monitor the standard output of the node. – José M Aug 06 '22 at 21:42
  • I remember reading about "redbug" and some other debugging tools too – Badlop Aug 08 '22 at 11:13

0 Answers0