From 638ba136d0e3a4e188d11596a3548042299fa289 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Wed, 27 Jul 2016 16:43:45 +0100 Subject: [PATCH] [Rework] Remove systemd socket activation --- CMakeLists.txt | 1 - centos/rspamd.spec | 15 ++++++--------- centos/sources/80-rspamd.preset | 1 + conf/rspamd.systemd.conf | 4 ++-- debian/rules | 9 --------- rspamd.socket | 10 ---------- 6 files changed, 9 insertions(+), 31 deletions(-) create mode 100644 centos/sources/80-rspamd.preset delete mode 100644 rspamd.socket diff --git a/CMakeLists.txt b/CMakeLists.txt index 0813677e7..7e62f5c23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1290,7 +1290,6 @@ ENDFOREACH(LUA_CONF) # systemd unit IF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND WANT_SYSTEMD_UNITS MATCHES "ON") INSTALL(FILES "rspamd.service" DESTINATION ${SYSTEMDDIR}) - INSTALL(FILES "rspamd.socket" DESTINATION ${SYSTEMDDIR}) ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND WANT_SYSTEMD_UNITS MATCHES "ON") # Manual pages diff --git a/centos/rspamd.spec b/centos/rspamd.spec index 0dc374cf2..cd4a413a6 100644 --- a/centos/rspamd.spec +++ b/centos/rspamd.spec @@ -53,6 +53,7 @@ Source2: %{name}.logrotate %endif Source0: https://rspamd.com/downloads/%{name}-%{version}.tar.xz +Source3: 80-rspamd.preset %description Rspamd is a rapid, modular and lightweight spam filter. It is designed to work @@ -99,6 +100,7 @@ lua. %install %{__make} install DESTDIR=%{buildroot} INSTALLDIRS=vendor +%{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{_presetdir}/80-rspamd.preset %if 0%{?el6} %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} @@ -120,7 +122,6 @@ rm -rf %{buildroot} %if 0%{?suse_version} %service_add_pre %{name}.service -%service_add_pre %{name}.socket %endif %post @@ -128,11 +129,11 @@ rm -rf %{buildroot} %{__chown} -R %{rspamd_user}:%{rspamd_group} %{rspamd_home} %if 0%{?suse_version} %service_add_post %{name}.service -%service_add_post %{name}.socket %endif %if 0%{?fedora} || 0%{?el7} -%systemd_post %{name}.service -%systemd_post %{name}.socket +#Macro is not used as we want to do this on upgrade +#%systemd_post %{name}.service +systemctl --no-reload preset %{name}.service >/dev/null 2>&1 || : %endif %if 0%{?el6} /sbin/chkconfig --add %{name} @@ -141,11 +142,9 @@ rm -rf %{buildroot} %preun %if 0%{?suse_version} %service_del_preun %{name}.service -%service_del_preun %{name}.socket %endif %if 0%{?fedora} || 0%{?el7} %systemd_preun %{name}.service -%systemd_preun %{name}.socket %endif %if 0%{?el6} if [ $1 = 0 ]; then @@ -157,11 +156,9 @@ fi %postun %if 0%{?suse_version} %service_del_postun %{name}.service -%service_del_postun %{name}.socket %endif %if 0%{?fedora} || 0%{?el7} %systemd_postun_with_restart %{name}.service -%systemd_postun %{name}.socket %endif %if 0%{?el6} if [ $1 -ge 1 ]; then @@ -174,7 +171,7 @@ fi %defattr(-,root,root,-) %if 0%{?suse_version} || 0%{?fedora} || 0%{?el7} %{_unitdir}/%{name}.service -%{_unitdir}/%{name}.socket +%{_presetdir}/80-rspamd.preset %endif %if 0%{?el6} %{_initrddir}/%{name} diff --git a/centos/sources/80-rspamd.preset b/centos/sources/80-rspamd.preset new file mode 100644 index 000000000..0fcf15985 --- /dev/null +++ b/centos/sources/80-rspamd.preset @@ -0,0 +1 @@ +enable rspamd.service diff --git a/conf/rspamd.systemd.conf b/conf/rspamd.systemd.conf index 8fed5108b..92e56180e 100644 --- a/conf/rspamd.systemd.conf +++ b/conf/rspamd.systemd.conf @@ -32,14 +32,14 @@ logging { } worker { - bind_socket = "systemd:0"; + bind_socket = "*:11333"; .include "$CONFDIR/worker-normal.inc" .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-normal.inc" .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-normal.inc" } worker { - bind_socket = "systemd:1"; + bind_socket = "localhost:11334"; .include "$CONFDIR/worker-controller.inc" .include(try=true; priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/worker-controller.inc" .include(try=true; priority=10) "$LOCAL_CONFDIR/override.d/worker-controller.inc" diff --git a/debian/rules b/debian/rules index 1bb93c663..d9aeb5a83 100755 --- a/debian/rules +++ b/debian/rules @@ -43,12 +43,3 @@ override_dh_auto_clean: override_dh_fixperms: dh_fixperms chmod 750 $(CURDIR)/debian/rspamd/var/lib/rspamd - -override_dh_systemd_enable: - dh_systemd_enable rspamd.socket - -override_dh_systemd_start: - dh_systemd_start --restart-after-upgrade --no-start - -override_dh_installinit: - dh_installinit -n diff --git a/rspamd.socket b/rspamd.socket deleted file mode 100644 index e28becce0..000000000 --- a/rspamd.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=rapid spam filtering system - -[Socket] -ListenStream=11333 -ListenStream=[::1]:11334 -BindIPv6Only=both - -[Install] -WantedBy=sockets.target -- 2.39.5