Closed devedse closed 1 year ago
what's the difference between the ejabberd image on github and the ejabberd/ecs image on docker hub?
The image on docker hub was started in 2016. It's built manually after each release. As it supposedly has many users, it is maintained with the minimal changes required to keep working: existing deployments should not require any change.
The image on github ghcr was started a few months ago. It's built automatically for every commit and release. It attempts to maintain most of the features and benefits of the other image, but adding new features when suitable.
Ah ic, I was asking this for another projects that's making use of ejabberd. I tried doing an inplace upgrade (well just editing the paths) but couldn't get it to work easily.
You think it's possible to also either provide an ARM image on docker hub too? Or is there an easy upgrade guide?
I tried doing an inplace upgrade (well just editing the paths) but couldn't get it to work easily.
Ouch. I tried to get the ghcr image to be as close as possible to the dockerhub one (only the path changing hopefully), but I never actually tried a migration myself...
I'll try it the next days and document here the required steps, for you to test, and finally to publish them.
This was the project I was trying it for: https://github.com/deamos/openstreamingplatform
When I ran ejabberd with the ghcr image it showed me this error:
There are several minor differences, but I think in your case those are the two differences that are hitting your migration:
[1]
In docker hub image, when the container is first created, a random erlang node name is picked, for example ejabberd@09ab40244b96
Nowadays it seems preferable to keep it simple, and have a fixed erland node name. This can be done with the ERLANG_NODE_ARG
environment variable, for example https://github.com/processone/docker-ejabberd/tree/master/ecs#clustering-example
There's a PR to use as default a fixed node name ejabberd@localhost
: https://github.com/processone/docker-ejabberd/pull/73
However, in the Github image, the erlang node name is already fixed to ejabberd@localhost
This means that, to use the old mnesia spool files, you must force the new ejabberd to use the old erlang node name. In this example, I would add this to docker-compose.yml to ensure the same mnesia database can still be used:
environment:
- ERLANG_NODE_ARG=ejabberd@09ab40244b96
[2]
Another difference is that, in the docker hub image, the Mnesia spool files are stored in a random location that depends on the erlang node name: /home/ejabberd/database/ejabberd@09ab40244b96/
In the Github image, the Mnesia spool files are stored in a fixed place: /opt/ejabberd/database/
For testing how to migrate from one image to the other, I create a database dir:
mkdir database
sudo chown 9000:9000 database
And setup a service using the docker image. In your case you didn't setup the hostname in advance, it was picked randomly by docker, and then ejabberd used that to build the erlang node name. Check your server, find the hostname it was used, and set that in the docker-compose of the github container.
version: '3.7'
services:
docker:
image: ejabberd/ecs
container_name: docker
hostname: 42cdd6244813
environment:
- CTL_ON_CREATE=register admin localhost asd
volumes:
- ./database:/home/ejabberd/database
github:
image: ghcr.io/processone/ejabberd
container_name: github
hostname: 42cdd6244813
environment:
- ERLANG_NODE_ARG=ejabberd@42cdd6244813
- CTL_ON_START=registered_users localhost ;
status
volumes:
- ./database/ejabberd@42cdd6244813:/opt/ejabberd/database
Now I create the first container, so it fills the database path:
sudo docker-compose up docker
...
docker | 2023-01-03 12:33:48.382819+00:00 [info] ejabberd 0.0.0 is started in the node ejabberd@42cdd6244813 in 4.42s
docker | :> ejabberdctl register admin localhost asd
docker | User admin@localhost successfully registered
Stop it, and then start the second container, that reads correctly the database files and starts correctly, and ejabberdctl works correctly too:
sudo docker-compose up github
github | 2023-01-03 12:51:54.840862+00:00 [info] ejabberd 22.10.0 is started in the node ejabberd@42cdd6244813 in 1.69s
github | :> ejabberdctl registered_users localhost
github | admin
github | :> ejabberdctl status
github | The node ejabberd@42cdd6244813 is started with status: started
github | ejabberd 22.10.0 is running in that node
Hmm, that's interesting. For my case though I don't specifically need to "migrate" over the data. So a clean start would be fine too. I think I just tried with new clean paths but if my memory serves me correctly I don't think it worked either.
Any clue on what the problem could be there?
Edit: This is the dockerfile OSP uses for Ejabberd: https://github.com/deamos/openstreamingplatform/blob/master/installs/docker/Ejabberd/Dockerfile
I took another good look through all config files from OpenStreamingPlatform and now managed to get it running again using your new image. I've made a PR for OpenStreamingPlatform with the change from ECS to the new ejabberd image.
I hope it get's accepted.
My PR: https://github.com/deamos/openstreamingplatform/pull/19
When I ran ejabberd with the ghcr image it showed me this error:
I took a chance to look at this problem. First of all, I downloaded the files from https://github.com/deamos/openstreamingplatform/tree/master/installs/docker/Ejabberd and build the image with docker hub 20.04, it worked correctly, of course.
Then I changed in Dockerfile the image to GHCR, and it failed obviously, as some paths have changed. After applying the corresponding changes to paths in the OSP files, now the GHCR image builds and starts correctly. I didn't check all the features, but at least it doesn't crash.
I noticed ejabberd reports several warnings about deprecated options... that's normal, as we jumped from ejabberd 20.04 to 23.01
This is the patch to apply to the OSP directory:
This is how I built the image and started it:
docker build -t personal/osp2 .
docker run --name ejabberd -it -p 5222:5222 personal/osp2:latest live
And this is the log output:
@badlop in my last comment I made it all work too. So it's already included in the PR. Feel free to compare your changes with mine and see if I missed something.
Ah, right! Looking at your accumulated changes, they are almost the same :)
The PR description in https://github.com/deamos/openstreamingplatform/pull/19 mentioned another image, and that confused me.
There's a problem building a container image with Erlang/OTP 25 when using QEMU for arm64: it crashes. This problem appeared when attempting to upgrade Erlang to 25 and building the ejabberd container image for arm64.
It's reported for ejabberd in https://github.com/processone/ejabberd/issues/3983
The problem is either in QEMU or Erlang, and has no short solution.
In case of ejabberd's container images, the workaround for now is to build the container image using the ejabberd binary installers... This got implemented in https://github.com/processone/ejabberd/commit/d15cf994a26d744dc2f9b31980f946fa7203180b
I guess there's no need to adopt this solution, or investigate some other workaround to allow building ecs image for arm64, when there's already a working image for that usercase.
Hello, I would like to build an image based on the arm64 version of the ejabberd image. However it seems to be missing on docker hub. Only the Github container registry seems to have the arm64 image.
Could you maybe also create an arm64 image and push this to docker hub?
E.g. with the following command:
Also, what's the difference between the ejabberd image on github and the ejabberd/ecs image on docker hub?