Document how to install mod_ecaptcha in GHCR container, fix minor bug

This commit is contained in:
Badlop 2023-01-25 16:33:17 +01:00
parent 232fc5e31f
commit 0db49856b8
2 changed files with 41 additions and 1 deletions

View File

@ -12,6 +12,9 @@ This small module uses the
erlang library to generate CAPTCHA images suitable for ejabberd's
[CAPTCHA](https://docs.ejabberd.im/admin/configuration/basic/#captcha) feature.
Installing this module in a containerized ejabberd requires
some additional steps, please read below.
Basic Configuration
-------------------
@ -103,3 +106,40 @@ modules:
font: "hplhs-oldstyle"
```
Install in Container
--------------------
There are some additional steps to install this module in a containerized ejabberd.
For example, if using the container image available at GitHub Container Registry:
```
docker run --name ejabberd -it -p 5222:5222 -p 5280:5280 -p 5288:5288 ghcr.io/processone/ejabberd:23.01 live
```
Install the dependencies required to compile C code:
```
docker exec --user root ejabberd apk add git make g++ freetype-dev erlang-dev
```
It's a good idea to update specs and modules source code:
```
docker exec ejabberd ejabberdctl modules_update_specs
```
Install the module so it gets the Erlang dependencies,
then compile that dependency C code, and finally recompile it:
```
docker exec ejabberd ejabberdctl module_install mod_ecaptcha
docker exec ejabberd make -C .ejabberd-modules/sources/ejabberd-contrib/mod_ecaptcha/deps/ecaptcha/c_src
docker exec ejabberd ejabberdctl module_upgrade mod_ecaptcha
```
If using the Docker Hub Container, `ejabberdctl` is in a different path,
please use those commands instead:
```
docker exec ejabberd bin/ejabberdctl modules_update_specs
docker exec ejabberd bin/ejabberdctl module_install mod_ecaptcha
docker exec ejabberd make -C .ejabberd-modules/sources/ejabberd-contrib/mod_ecaptcha/deps/ecaptcha/c_src
docker exec ejabberd bin/ejabberdctl module_upgrade mod_ecaptcha
```

View File

@ -83,7 +83,7 @@ create_image(_Key) ->
font => get_opt(font)}
),
case Response of
{Phrase, PNGImage} when is_binary(PNGImage) ->
{Phrase, PNGImage} when is_binary(Phrase) ->
PNGBin = binary:list_to_bin([PNGImage]),
{ok, <<"image/png">>, Phrase, PNGBin};
{error, Reason} ->