Browse Source

Add systemd unit

tags/0.7.0
Mikhail Gusarov 10 years ago
parent
commit
18c0d55ea7
8 changed files with 64 additions and 2 deletions
  1. 9
    0
      CMakeLists.txt
  2. 1
    1
      debian/control
  3. 4
    0
      debian/logging.conf
  4. 2
    0
      debian/rspamd.install
  5. 4
    1
      debian/rules
  6. 19
    0
      debian/workers.conf
  7. 14
    0
      rspamd.service
  8. 11
    0
      rspamd.socket

+ 9
- 0
CMakeLists.txt View File

@@ -91,6 +91,10 @@ IF(NOT INCLUDEDIR)
SET(INCLUDEDIR include/rspamd)
ENDIF(NOT INCLUDEDIR)

IF(NOT SYSTEMDDIR)
SET(SYSTEMDDIR ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
ENDIF(NOT SYSTEMDDIR)

############################# INCLUDE SECTION #############################################

INCLUDE(CheckIncludeFiles)
@@ -1015,6 +1019,11 @@ FOREACH(LUA_CONF ${LUA_CONFIGS})
INSTALL(FILES "conf/lua/${LUA_CONF}" DESTINATION ${CONFDIR}/lua/${_rp})
ENDFOREACH(LUA_CONF)

# systemd unit

INSTALL(FILES "rspamd.service" DESTINATION ${SYSTEMDDIR})
INSTALL(FILES "rspamd.socket" DESTINATION ${SYSTEMDDIR})

# Manual pages
INSTALL(FILES "doc/rspamd.8" DESTINATION ${MANDIR}/man8)
INSTALL(FILES "doc/rspamc.1" DESTINATION ${MANDIR}/man1)

+ 1
- 1
debian/control View File

@@ -2,7 +2,7 @@ Source: rspamd
Section: mail
Priority: optional
Maintainer: Mikhail Gusarov <dottedmag@debian.org>
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libevent-dev (>= 1.3), libglib2.0-dev (>= 2.16.0), libgmime-2.6-dev, liblua5.2-dev | liblua5.1-dev | liblua5.1-0-dev, libpcre3-dev, libssl-dev (>= 1.0), libcurl4-openssl-dev, libhiredis-dev
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libevent-dev (>= 1.3), libglib2.0-dev (>= 2.16.0), libgmime-2.6-dev, liblua5.2-dev | liblua5.1-dev | liblua5.1-0-dev, libpcre3-dev, libssl-dev (>= 1.0), libcurl4-openssl-dev, libhiredis-dev, dh-systemd
Standards-Version: 3.9.5
Homepage: https://rspamd.com
Vcs-Git: git://github.com/vstakhov/rspamd.git

+ 4
- 0
debian/logging.conf View File

@@ -0,0 +1,4 @@
logging {
type = "console";
level = "info";
}

+ 2
- 0
debian/rspamd.install View File

@@ -0,0 +1,2 @@
debian/workers.conf etc/rspamd
debian/logging.conf etc/rspamd

+ 4
- 1
debian/rules View File

@@ -1,6 +1,6 @@
#!/usr/bin/make -f
%:
dh $@
dh $@ --with systemd

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
# Until https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739834 is fixed
@@ -29,3 +29,6 @@ override_dh_auto_clean:
override_dh_fixperms:
dh_fixperms
chmod 750 $(CURDIR)/debian/rspamd/var/lib/rspamd

override_dh_systemd_start:
dh_systemd_start --restart-after-upgrade

+ 19
- 0
debian/workers.conf View File

@@ -0,0 +1,19 @@
worker {
type = "normal";
bind_socket = "systemd:0";
http = false;
allow_learn = true;
mime = true;
}
worker {
type = "controller";
bind_socket = "systemd:1";
count = 1;
}
worker {
type = "webui";
count = 1;
bind_socket = "systemd:2";
password = "q1";
secure_ip = "127.0.0.1";
}

+ 14
- 0
rspamd.service View File

@@ -0,0 +1,14 @@
[Unit]
Description=rapid spam filtering system

[Service]
Type=simple
# Replace Pre/Post with RuntimeDirectory once it is available
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -m700 -p /run/rspamd
ExecStartPre=/bin/chown _rspamd:_rspamd /run/rspamd
ExecStart=/usr/bin/rspamd -f -c /etc/rspamd/rspamd.conf
ExecReload=/bin/kill -HUP $MAINPID
ExecStopPost=/bin/rm -r /run/rspamd
WorkingDirectory=/var/lib/rspamd
User=_rspamd

+ 11
- 0
rspamd.socket View File

@@ -0,0 +1,11 @@
[Unit]
Description=rapid spam filtering system

[Socket]
ListenStream=11333
ListenStream=127.0.0.1:11334
ListenStream=127.0.0.1:11336
FreeBind=true

[Install]
WantedBy=sockets.target

Loading…
Cancel
Save