rabbitmq / erlang-rpm

Latest Erlang/OTP releases packaged as a zero dependency RPM, just enough for running RabbitMQ
https://rabbitmq.com/install-rpm.html
Other
553 stars 118 forks source link

Enable systemd for EPMD #86

Closed Gsantomaggio closed 5 years ago

Gsantomaggio commented 5 years ago

group thread

This PR enables the build with the --enable-systemd

Currently SUSE and Fedora by defualt enable the systemd option In this way it is possible to run the epmd in different cgropus and interact with systemd activation socket

Docker image for centos 7 requires systemd-devel library.

michaelklishin commented 5 years ago

FYI, I've just added CentOS 8 builds to our pipeline and marked CentOS 6 as deprecated.

Gsantomaggio commented 5 years ago

Ok perfect, because I had some problem to maintain the docker centos 6/7 images in an easy way. I will drop the Docker Centos 6 build support. ( I don't think there are a lot of users that use the docker build ).

michaelklishin commented 5 years ago

FTR, here's the CentOS release support matrix.

michaelklishin commented 5 years ago

@Gsantomaggio let us know when this is ready for QA.

Gsantomaggio commented 5 years ago

sorry, @michaelklishin for the delay. I am having problems with the docker images. I am sure they worked correctly.

I don't understand what's going on here:

➜  docker git:(master) ./build-image-and-rpm.sh 7 --no-cache
sed: -e expression #1, char 1: unknown command: `.'
Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM centos:{centosfrom}
invalid reference format
cp: cannot stat '../*.patch': No such file or directory
Unable to find image 'erlang-rpm-build-7:latest' locally
docker: Error response from daemon: pull access denied for erlang-rpm-build-7, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

or better I have to find the time to understand it :)!

Gsantomaggio commented 5 years ago

So, the spec is ready. I tested the packages on centos 6 (without systemd) and centos 7/8 with systemd

The docker builds don't work, at this point we have 2 ways:

  1. Fix the docker builds with this PR
  2. Merge this PR and then fix the docker buils

Note: This PR enables only the build with systemd option To run epmd under systemd, the user has to create the epmd.service manually. It is possible to provide the files as we do in SUSE package but I'd proceed by steps.

If you don't touch anything the setup is compatible:

This is the new build without add the epmd.service support

[vagrant@centos-8 x86_64]$ sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-10-15 15:38:32 UTC; 3min 13s ago
 Main PID: 8384 (beam.smp)
   Status: "Initialized"
    Tasks: 85 (limit: 2893)
   Memory: 98.2M
   CGroup: /system.slice/rabbitmq-server.service
           ├─8384 /usr/lib64/erlang/erts-10.4.4/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512 -MHlmbcs 512 -MMmcs >
           ├─8552 /usr/lib64/erlang/erts-10.4.4/bin/epmd -daemon
           ├─8696 erl_child_setup 32768
           ├─8719 inet_gethost 4
           └─8727 inet_gethost 4

This is how it is with the epmd running under systemd (from suse package) :

vagrant@localhost:~> sudo systemctl status epmd
● epmd.service - Erlang Port Mapper Daemon
   Loaded: loaded (/usr/lib/systemd/system/epmd.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-10-15 17:30:39 CEST; 23min ago
 Main PID: 11329 (epmd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/epmd.service
           └─11329 /usr/bin/epmd -systemd

Oct 15 17:30:39 localhost systemd[1]: Started Erlang Port Mapper Daemon.
vagrant@localhost:~> sudo systemctl start rabbitmq-server
vagrant@localhost:~> sudo systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-10-15 17:54:05 CEST; 3s ago
  Process: 11764 ExecStop=/usr/sbin/rabbitmqctl stop (code=exited, status=0/SUCCESS)
 Main PID: 11933 (beam.smp)
   Status: "Initialized"
    Tasks: 84 (limit: 4915)
   CGroup: /system.slice/rabbitmq-server.service
           ├─11929 /bin/sh /usr/sbin/rabbitmq-server
           ├─11933 /usr/lib64/erlang/erts-9.3.3.6/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 128000 -K true -- -root>
           ├─12158 erl_child_setup 65535
           ├─12180 inet_gethost 4
           └─12181 inet_gethost 4

It there are doubts, please let me know.

michaelklishin commented 5 years ago

Docker builds do work for us, though. Both in CI and I definitely have done one a week or two ago. Not sure if I've used the instructions in this repo, though. Let me try this out and if it is functional, we can merge it.

Gsantomaggio commented 5 years ago

@michaelklishin I think I got the problem. The docker scripts seem to work on Mac and not on Linux.

Mac:

➜  docker git:(erlang_rpm_enable_systemd) ./build-docker-image.sh 7 --no-cache
Sending build context to Docker daemon  3.072kB
Step 1/5 : FROM centos:7
 ---> 75835a67d134
Step 2/5 : RUN yum -y update && yum clean all
 ---> Running in 3d22e02a5c75
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors

Linux:

➜  docker git:(erlang_rpm_enable_systemd) ✗ ./build-docker-image.sh 7 --no-cache
sed: -e expression #1, char 1: unknown command: `.'
Sending build context to Docker daemon  2.048kB
Step 1/5 : FROM centos:{centosfrom}
invalid reference format

some sed option.

michaelklishin commented 5 years ago

Yup, GNU sed does not support -I the same way. I'm on it.

michaelklishin commented 5 years ago

@Gsantomaggio can you please give my changes in master a try? I'm watching a Concourse build now, too.

michaelklishin commented 5 years ago

The PR fails for me on CentOS 7 and 8 with

configure: error: --enable-systemd was given, but test for systemd failed

which is an OTP configure message.

Looks like sd-notify support and a few related bits are expected by the generated ./configure script.

michaelklishin commented 5 years ago

Unfortunately the log is no longer available. I'll try to reproduce manually tomorrow.

Gsantomaggio commented 5 years ago

you need to install the systemd-devel library on your build machine This is another problem I was trying to solve with the docker image build. You have to install systemd-devel only for centos 7 and 8 and not for Centos 6.

the script ./build-docker-image.sh 7 --no-cache works now

Gsantomaggio commented 5 years ago
sudo yum update -y

and

sudo yum install -y   autoconf   gcc   m4   mercurial   openssl-devel   ncurses-devel   rpm-build   tar   wget   zlib-devel systemd-devel

The packages I used to build in Centos 7 and 8

michaelklishin commented 5 years ago

OK, so those should be added to our image.

michaelklishin commented 5 years ago

I will get it. Thanks for the clarification.

michaelklishin commented 5 years ago

Backported to erlang-21.3.x and erlang-20.3.x.