Skip to content

Commit

Permalink
package/redis: add optional support for systemd
Browse files Browse the repository at this point in the history
- Use the unit type=notify (Redis contacts systemd when ready)
- Start redis with the supervised option, so it knows it should
  talk to systemd
- USE_SYSTEMD is not documented, but it is used in the src/Makefile

Signed-off-by: Titouan Christophe <[email protected]>
[[email protected]: add and explain USE_SYSTEMD]
Signed-off-by: Yann E. MORIN <[email protected]>
  • Loading branch information
Titouan Christophe authored and yann-morin-1998 committed Jun 5, 2020
1 parent ee3c813 commit ac3ab47
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions package/redis/redis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ endif
REDIS_BUILDOPTS = $(TARGET_CONFIGURE_OPTS) \
PREFIX=$(TARGET_DIR)/usr MALLOC=libc

ifeq ($(BR2_PACKAGE_SYSTEMD),y)
REDIS_DEPENDENCIES += systemd
REDIS_BUILDOPTS += USE_SYSTEMD=yes
else
REDIS_BUILDOPTS += USE_SYSTEMD=no
endif

ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
REDIS_DEPENDENCIES += libopenssl
REDIS_BUILDOPTS += BUILD_TLS=yes
Expand Down
10 changes: 6 additions & 4 deletions package/redis/redis.service
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[Unit]
Description=Advanced key-value store
Description=Redis data structure server
Documentation=https://redis.io/documentation
After=network.target

[Service]
Type=simple
Type=notify
User=redis
Group=redis
ExecStart=/usr/bin/redis-server /etc/redis.conf
ExecStop=/usr/bin/redis-cli shutdown
ExecStart=/usr/bin/redis-server --supervised systemd --daemonize no
TimeoutStartSec=5
TimeoutStopSec=5
CapabilityBoundingSet=
PrivateTmp=true
PrivateDevices=true
Expand Down

0 comments on commit ac3ab47

Please sign in to comment.