diff mbox series

[v2,4/4] package/redis: add optional support for systemd

Message ID 20200602104011.837-5-titouan.christophe@railnova.eu
State Accepted
Headers show
Series package/redis: bump to Redis 6 | expand

Commit Message

Titouan Christophe June 2, 2020, 10:40 a.m. UTC
- Use the unit type=notify (Redis contacts systemd when ready)
- Start redis with the supervised option, so it knows it should talk to systemd

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
 package/redis/redis.mk      |  4 ++++
 package/redis/redis.service | 10 ++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Yann E. MORIN June 5, 2020, 10:33 p.m. UTC | #1
Titouan, All,

On 2020-06-02 12:40 +0200, Titouan Christophe spake thusly:
> - Use the unit type=notify (Redis contacts systemd when ready)
> - Start redis with the supervised option, so it knows it should talk to systemd
> 
> Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
> ---
>  package/redis/redis.mk      |  4 ++++
>  package/redis/redis.service | 10 ++++++----
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/package/redis/redis.mk b/package/redis/redis.mk
> index c88e107c2b..1883f2fbaa 100644
> --- a/package/redis/redis.mk
> +++ b/package/redis/redis.mk
> @@ -30,6 +30,10 @@ endif
>  REDIS_BUILDOPTS = $(TARGET_CONFIGURE_OPTS) \
>  	PREFIX=$(TARGET_DIR)/usr MALLOC=libc
>  
> +ifeq ($(BR2_PACKAGE_SYSTEMD),y)
> +REDIS_DEPENDENCIES += systemd

Although this is not documented, there is a variable used to decide
whether to use systemd or not, USE_SYSTEMD. I've added use of it to
explicitly enable or disable systemd support.

Applied to master, thanks.

Regards,
Yann E. MORIN.

> +endif
> +
>  ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
>  REDIS_DEPENDENCIES += libopenssl
>  REDIS_BUILDOPTS += BUILD_TLS=yes
> diff --git a/package/redis/redis.service b/package/redis/redis.service
> index 0a8162b8ab..2cc82a1980 100644
> --- a/package/redis/redis.service
> +++ b/package/redis/redis.service
> @@ -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
> -- 
> 2.25.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index c88e107c2b..1883f2fbaa 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -30,6 +30,10 @@  endif
 REDIS_BUILDOPTS = $(TARGET_CONFIGURE_OPTS) \
 	PREFIX=$(TARGET_DIR)/usr MALLOC=libc
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+REDIS_DEPENDENCIES += systemd
+endif
+
 ifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
 REDIS_DEPENDENCIES += libopenssl
 REDIS_BUILDOPTS += BUILD_TLS=yes
diff --git a/package/redis/redis.service b/package/redis/redis.service
index 0a8162b8ab..2cc82a1980 100644
--- a/package/redis/redis.service
+++ b/package/redis/redis.service
@@ -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