processone / docker-ejabberd

Set of ejabberd Docker images
94 stars 77 forks source link

CTL_ON_CREATE register admin error stopping init in 23.10 #110

Closed jmartin45-chwy closed 7 months ago

jmartin45-chwy commented 7 months ago

We are trying to upgrade to 23.10 and we have the following in our terraform:

          env {
            # This will register the admin user if it does not already exist.
            name  = "CTL_ON_CREATE"
            value = "register admin ${local.ejabberd_admin_domain} ${local.ejabberd_admin_password}"
          }

Under 23.10 we are now getting an error and the container is not starting up, because the admin account already exists.

Is there a way to turn off this feature? If not is there a way to conditionally register a user if they don't already exist using CTL_ON_CREATE functionality?

:> ejabberdctl register admin {domain} {password}
Error: conflict: User admin@{domain} already registered
:> FAILURE in command 'register admin {domain} {password}' !!! Stopping ejabberd...
[os_mon] memory supervisor port (memsup): Erlang has closed
prefiks commented 7 months ago

Indeed this is something new added in 23.10, but i see that we should also allow previous behaviour.

So to fix that in commit c0acc7aeb83406c29569de06f6708627e839e982 i added ability to ignore failing commands, and this can be triggered by adding "!" as first argument in this variable (so using "! register admin ${local.ejabberd_admin_domain} ${local.ejabberd_admin_password}" will execute that command, but will not exit if that commands fails).

prefiks commented 7 months ago

I also added this to ejabberd repository as commit processone/ejabberd@67a6776fba9e313df32fcc6cc8cc8a9a6d5a3d35.

jmartin45-chwy commented 7 months ago

Thanks!