@@ -310,6 +310,152 @@ now you can define the admin account JID using an environment variable:
310310Check the [full example](#customized-example) for other example.
311311
312312
313+ # ## ejabberd-contrib
314+
315+ This section addresses those topics related to
316+ [ejabberd-contrib](https://docs.ejabberd.im/admin/guide/modules/#ejabberd-contrib):
317+
318+ - [Download source code](#download-source-code)
319+ - [Install a module](#install-a-module)
320+ - [Install git for dependencies](#install-git-for-dependencies)
321+ - [Install your module](#install-your-module)
322+
323+ ---
324+
325+ # ### Download source code
326+
327+ The `ejabberd` container image includes the ejabberd-contrib git repository source code,
328+ but `ecs` does not, so first download it :
329+ ` ` ` bash
330+ $ docker exec ejabberd ejabberdctl modules_update_specs
331+ ` ` `
332+
333+ # ### Install a module
334+
335+ Compile and install any of the contributed modules, for example :
336+ ` ` ` bash
337+ docker exec ejabberd ejabberdctl module_install mod_statsdx
338+
339+ Module mod_statsdx has been installed and started.
340+ It's configured in the file:
341+ /opt/ejabberd/.ejabberd-modules/mod_statsdx/conf/mod_statsdx.yml
342+ Configure the module in that file, or remove it
343+ and configure in your main ejabberd.yml
344+ ` ` `
345+
346+ # ### Install git for dependencies
347+
348+ Some modules depend on erlang libraries,
349+ but the container images do not include `git` or `mix` to download them.
350+ Consequently, when you attempt to install such a module,
351+ there will be error messages like :
352+
353+ ` ` ` bash
354+ docker exec ejabberd ejabberdctl module_install ejabberd_observer_cli
355+
356+ I'll download "recon" using git because I can't use Mix to fetch from hex.pm:
357+ /bin/sh: mix: not found
358+ Fetching dependency observer_cli:
359+ /bin/sh: git: not found
360+ ...
361+ ` ` `
362+
363+ the solution is to install `git` in the container image :
364+
365+ ` ` ` bash
366+ docker exec --user root ejabberd apk add git
367+
368+ fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
369+ fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
370+ (1/3) Installing pcre2 (10.43-r0)
371+ (2/3) Installing git (2.47.2-r0)
372+ (3/3) Installing git-init-template (2.47.2-r0)
373+ Executing busybox-1.37.0-r12.trigger
374+ OK: 27 MiB in 42 packages
375+ ` ` `
376+
377+ and now you can upgrade the module :
378+
379+ ` ` ` bash
380+ docker exec ejabberd ejabberdctl module_upgrade ejabberd_observer_cli
381+
382+ I'll download "recon" using git because I can't use Mix to fetch from hex.pm:
383+ /bin/sh: mix: not found
384+ Fetching dependency observer_cli: Cloning into 'observer_cli'...
385+ Fetching dependency os_stats: Cloning into 'os_stats'...
386+ Fetching dependency recon: Cloning into 'recon'...
387+ Inlining: inline_size=24 inline_effort=150
388+ Old inliner: threshold=0 functions=[{insert,2},{merge,2}]
389+ Module ejabberd_observer_cli has been installed.
390+ Now you can configure it in your ejabberd.yml
391+ I'll download "recon" using git because I can't use Mix to fetch from hex.pm:
392+ /bin/sh: mix: not found
393+ ` ` `
394+
395+ # ### Install your module
396+
397+ If you [developed an ejabberd module](https://docs.ejabberd.im/developer/extending-ejabberd/modules/),
398+ you can install it in your container image :
399+
400+ 1. Create a local directory for `ejabberd-modules` :
401+
402+ ` ` ` sh
403+ mkdir docker-modules
404+ ` ` `
405+
406+ 2. Then create the directory structure for your custom module :
407+
408+ ` ` ` sh
409+ cd docker-modules
410+
411+ mkdir -p sources/mod_hello_world/
412+ touch sources/mod_hello_world/mod_hello_world.spec
413+
414+ mkdir sources/mod_hello_world/src/
415+ mv mod_hello_world.erl sources/mod_hello_world/src/
416+
417+ mkdir sources/mod_hello_world/conf/
418+ echo -e "modules:\n mod_hello_world: {}" > sources/mod_hello_world/conf/mod_hello_world.yml
419+
420+ cd ..
421+ ` ` `
422+
423+ 3. Grant ownership of that directory to the UID that ejabberd will use inside the Docker image :
424+
425+ ` ` ` sh
426+ sudo chown 9000 -R docker-modules/
427+ ` ` `
428+
429+ 4. Start ejabberd in the container :
430+
431+ ` ` ` sh
432+ sudo docker run \
433+ --name hellotest \
434+ -d \
435+ --volume "$(pwd)/docker-modules:/home/ejabberd/.ejabberd-modules/" \
436+ -p 5222:5222 \
437+ -p 5280:5280 \
438+ ejabberd/ecs
439+ ` ` `
440+
441+ 5. Check the module is available for installing, and then install it :
442+
443+ ` ` ` sh
444+ sudo docker exec -it hellotest ejabberdctl modules_available
445+ mod_hello_world []
446+
447+ sudo docker exec -it hellotest ejabberdctl module_install mod_hello_world
448+ ` ` `
449+
450+ 6. If the module works correctly, you will see `Hello` in the ejabberd logs when it starts :
451+
452+ ` ` ` sh
453+ sudo docker exec -it hellotest grep Hello logs/ejabberd.log
454+ 2020-10-06 13:40:13.154335+00:00 [info]
455+ <0.492.0>@mod_hello_world:start/2:15 Hello, ejabberd world!
456+ ` ` `
457+
458+
313459# ## ejabberdapi
314460
315461When the container is running (and thus ejabberd), you can exec commands inside the container
@@ -418,12 +564,12 @@ it is necessary to change the old hostname stored in Mnesia.
418564This section is equivalent to the ejabberd Documentation
419565[Change Computer Hostname](https://docs.ejabberd.im/admin/guide/managing/#change-computer-hostname),
420566but particularized to containers that use this
421- ecs container image from ejabberd 23.01 or older.
567+ ` ecs` container image from ejabberd 23.01 or older.
422568
423569# ### Setup Old Container
424570
425571Let's assume a container running ejabberd 23.01 (or older) from
426- this ecs container image, with the database directory binded
572+ this ` ecs` container image, with the database directory binded
427573and one registered account.
428574This can be produced with :
429575` ` ` bash
@@ -926,10 +1072,10 @@ Let's summarize the differences between both container images. Legend:
9261072| Generated by | [container.yml](https://github.com/processone/ejabberd/blob/master/.github/workflows/container.yml) | [tests.yml](https://github.com/processone/docker-ejabberd/blob/master/.github/workflows/tests.yml) |
9271073| Built for | stable releases <br /> `master` branch | stable releases <br /> [`master` branch zip](https://github.com/processone/docker-ejabberd/actions/workflows/tests.yml) |
9281074| Architectures | `linux/amd64` <br /> `linux/arm64` | `linux/amd64` |
929- | Software | Erlang/OTP 27.3.3 -alpine <br /> Elixir 1.18.3 | Alpine 3.19 <br /> Erlang/OTP 26.2 <br /> Elixir 1.15.7 |
1075+ | Software | Erlang/OTP 27.3.4 -alpine <br /> Elixir 1.18.4 | Alpine 3.19 <br /> Erlang/OTP 26.2 <br /> Elixir 1.15.7 |
9301076| Published in | [ghcr.io/processone/ejabberd](https://github.com/processone/ejabberd/pkgs/container/ejabberd) | [docker.io/ejabberd/ecs](https://hub.docker.com/r/ejabberd/ecs/) <br /> [ghcr.io/processone/ecs](https://github.com/processone/docker-ejabberd/pkgs/container/ecs) |
9311077| :black_square_button : **Additional content** |
932- | [ejabberd-contrib](https://docs.ejabberd.im/admin/guide/modules/ #ejabberd-contrib) | included | not included |
1078+ | [ejabberd-contrib](#ejabberd-contrib) | included | not included |
9331079| [ejabberdapi](#ejabberdapi) | included :orange_circle: | included |
9341080| :black_square_button : **Ports** |
9351081| [1880](#ports) for WebAdmin | yes :orange_circle: | yes :orange_circle: |
0 commit comments