mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] redis: new package
@ 2021-12-02 15:09 Clemens Gruber
  2021-12-03 15:17 ` Roland Hieber
  0 siblings, 1 reply; 6+ messages in thread
From: Clemens Gruber @ 2021-12-02 15:09 UTC (permalink / raw)
  To: ptxdist; +Cc: Clemens Gruber

Adds a new package for redis, an open source (BSD licensed), in-memory
data structure store, used as a database, cache, and message broker.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 ...ort-systemd-and-set-a-data-directory.patch | 30 ++++++
 patches/redis-6.2.6/series                    |  4 +
 projectroot/etc/group                         |  1 +
 projectroot/etc/passwd                        |  1 +
 .../usr/lib/systemd/system/redis.service      | 23 +++++
 projectroot/usr/lib/tmpfiles.d/redis.conf     |  1 +
 rules/redis.in                                | 27 ++++++
 rules/redis.make                              | 96 +++++++++++++++++++
 8 files changed, 183 insertions(+)
 create mode 100644 patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
 create mode 100644 patches/redis-6.2.6/series
 create mode 100644 projectroot/usr/lib/systemd/system/redis.service
 create mode 100644 projectroot/usr/lib/tmpfiles.d/redis.conf
 create mode 100644 rules/redis.in
 create mode 100644 rules/redis.make

diff --git a/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
new file mode 100644
index 000000000..34d8fd283
--- /dev/null
+++ b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
@@ -0,0 +1,30 @@
+From: Clemens Gruber <clemens.gruber@pqgruber.com>
+Date: Mon, 15 Nov 2021 16:21:31 +0100
+Subject: [PATCH] Support systemd and set a data directory
+
+---
+ redis.conf | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/redis.conf b/redis.conf
+index e8eff2774981..8f76ea1c84e4 100644
+--- a/redis.conf
++++ b/redis.conf
+@@ -272,7 +272,7 @@ daemonize no
+ # The default is "no". To run under upstart/systemd, you can simply uncomment
+ # the line below:
+ #
+-# supervised auto
++supervised auto
+ 
+ # If a pid file is specified, Redis writes it where specified at startup
+ # and removes it at exit.
+@@ -451,7 +451,7 @@ rdb-del-sync-files no
+ # The Append Only File will also be created inside this directory.
+ #
+ # Note that you must specify a directory here, not a file name.
+-dir ./
++dir /var/lib/redis/
+ 
+ ################################# REPLICATION #################################
+ 
diff --git a/patches/redis-6.2.6/series b/patches/redis-6.2.6/series
new file mode 100644
index 000000000..1a299f8b7
--- /dev/null
+++ b/patches/redis-6.2.6/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Support-systemd-and-set-a-data-directory.patch
+# a122637ab2789578ffe3ff7cc6f22faf  - git-ptx-patches magic
diff --git a/projectroot/etc/group b/projectroot/etc/group
index 09df73ba0..69d650510 100644
--- a/projectroot/etc/group
+++ b/projectroot/etc/group
@@ -33,4 +33,5 @@ render:x:209:
 pulse:x:210:
 chrony:x:211:
 rauc-hawkbit:x:212:
+redis:x:213:
 nogroup:x:65534:
diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
index 529f49a77..b4669abb5 100644
--- a/projectroot/etc/passwd
+++ b/projectroot/etc/passwd
@@ -17,5 +17,6 @@ systemd-journal-upload:x:208:208:systemd-journal-upload:/dev/null:/bin/false
 pulse:x:209:210:pulse:/dev/null:/bin/false
 chrony:x:210:211:chrony:/dev/null:/bin/false
 rauc-hawkbit:x:211:212:rauc-hawkbit:/dev/null:/bin/false
+redis:x:212:213:redis:/dev/null:/bin/false
 rpcuser:x:65533:65534:RPC user:/dev/null:/bin/false
 nobody:x:65534:65534:Unprivileged Nobody:/dev/null:/bin/false
diff --git a/projectroot/usr/lib/systemd/system/redis.service b/projectroot/usr/lib/systemd/system/redis.service
new file mode 100644
index 000000000..715e64d69
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/redis.service
@@ -0,0 +1,23 @@
+[Unit]
+Description=Advanced key-value store
+After=network.target
+
+[Service]
+Type=notify
+User=redis
+Group=redis
+ExecStart=/usr/bin/redis-server /etc/redis.conf
+TimeoutStartSec=60
+TimeoutStopSec=60
+CapabilityBoundingSet=
+PrivateTmp=true
+PrivateDevices=true
+ProtectSystem=full
+ProtectHome=true
+NoNewPrivileges=true
+RuntimeDirectory=redis
+RuntimeDirectoryMode=755
+LimitNOFILE=10032
+
+[Install]
+WantedBy=multi-user.target
diff --git a/projectroot/usr/lib/tmpfiles.d/redis.conf b/projectroot/usr/lib/tmpfiles.d/redis.conf
new file mode 100644
index 000000000..d9283eab5
--- /dev/null
+++ b/projectroot/usr/lib/tmpfiles.d/redis.conf
@@ -0,0 +1 @@
+d /var/lib/redis 0700 redis redis
diff --git a/rules/redis.in b/rules/redis.in
new file mode 100644
index 000000000..3cf67ea89
--- /dev/null
+++ b/rules/redis.in
@@ -0,0 +1,27 @@
+## SECTION=system_libraries
+menuconfig REDIS
+	tristate
+	prompt "redis                         "
+	select GCCLIBS_GCC_S
+	select LIBC_DL
+	select LIBC_PTHREAD
+	select LIBC_CRYPT
+	select SYSTEMD		if REDIS_SYSTEMD
+	help
+	  Redis is an open source (BSD licensed), in-memory data
+	  structure store, used as a database, cache, and message
+	  broker.
+
+if REDIS
+
+config REDIS_SYSTEMD
+	bool
+	default INITMETHOD_SYSTEMD
+
+config REDIS_SYSTEMD_UNIT
+	bool
+	default y
+	depends on SYSTEMD
+	prompt "Unit file for systemd"
+
+endif
diff --git a/rules/redis.make b/rules/redis.make
new file mode 100644
index 000000000..bb3bb60ff
--- /dev/null
+++ b/rules/redis.make
@@ -0,0 +1,96 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Clemens Gruber <clemens.gruber@pqgruber.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_REDIS) += redis
+
+#
+# Paths and names
+#
+REDIS_VERSION	:= 6.2.6
+REDIS_MD5	:= f69ca96b39ca93001add922d558f9842
+REDIS		:= redis-$(REDIS_VERSION)
+REDIS_SUFFIX	:= tar.gz
+REDIS_URL	:= https://download.redis.io/releases/$(REDIS).$(REDIS_SUFFIX)
+REDIS_SOURCE	:= $(SRCDIR)/$(REDIS).$(REDIS_SUFFIX)
+REDIS_DIR	:= $(BUILDDIR)/$(REDIS)
+REDIS_LICENSE	:= BSD-3-Clause
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+REDIS_CONF_TOOL := NO
+
+REDIS_MAKE_ENV := \
+	$(CROSS_ENV)
+
+REDIS_MAKE_OPT := \
+	CC=$(CROSS_CC) \
+	PREFIX=/usr \
+	USE_JEMALLOC=no \
+	USE_SYSTEMD=$(call ptx/ifdef,PTXCONF_REDIS_SYSTEMD,yes,no) \
+	all
+
+REDIS_PATH := PATH=$(CROSS_PATH)
+
+REDIS_INSTALL_OPT := \
+	PREFIX=$(REDIS_PKGDIR)/usr \
+	install
+
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/redis.install:
+	@$(call targetinfo)
+	@$(call world/install, REDIS)
+	@install -v -D -m644 $(REDIS_DIR)/redis.conf \
+		$(REDIS_PKGDIR)/etc/redis.conf
+	@$(call touch)
+
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/redis.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, redis)
+	@$(call install_fixup, redis,PRIORITY,optional)
+	@$(call install_fixup, redis,SECTION,base)
+	@$(call install_fixup, redis,AUTHOR,"Clemens Gruber <clemens.gruber@pqgruber.com>")
+	@$(call install_fixup, redis,DESCRIPTION,"An in-memory database that persists on disk")
+
+	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-benchmark)
+	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-cli)
+	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-server)
+
+	@$(call install_link, redis, /usr/bin/redis-server, /usr/bin/redis-check-aof)
+	@$(call install_link, redis, /usr/bin/redis-server, /usr/bin/redis-check-rdb)
+
+	@$(call install_alternative, redis, 0, 0, 0644, /etc/redis.conf)
+
+	@$(call install_copy, redis, 0, 0, 0700, /var/lib/redis)
+
+ifdef PTXCONF_REDIS_SYSTEMD_UNIT
+	@$(call install_alternative, redis, 0, 0, 0644, /usr/lib/systemd/system/redis.service)
+	@$(call install_link, redis, ../redis.service, \
+		/usr/lib/systemd/system/multi-user.target.wants/redis.service)
+endif
+	@$(call install_alternative, redis, 0, 0, 0644, /usr/lib/tmpfiles.d/redis.conf)
+
+	@$(call install_finish, redis)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.34.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] redis: new package
  2021-12-02 15:09 [ptxdist] [PATCH] redis: new package Clemens Gruber
@ 2021-12-03 15:17 ` Roland Hieber
  2021-12-03 15:28   ` Clemens Gruber
  0 siblings, 1 reply; 6+ messages in thread
From: Roland Hieber @ 2021-12-03 15:17 UTC (permalink / raw)
  To: Clemens Gruber; +Cc: ptxdist

On Thu, Dec 02, 2021 at 04:09:55PM +0100, Clemens Gruber wrote:
> Adds a new package for redis, an open source (BSD licensed), in-memory
> data structure store, used as a database, cache, and message broker.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  ...ort-systemd-and-set-a-data-directory.patch | 30 ++++++
>  patches/redis-6.2.6/series                    |  4 +
>  projectroot/etc/group                         |  1 +
>  projectroot/etc/passwd                        |  1 +
>  .../usr/lib/systemd/system/redis.service      | 23 +++++
>  projectroot/usr/lib/tmpfiles.d/redis.conf     |  1 +
>  rules/redis.in                                | 27 ++++++
>  rules/redis.make                              | 96 +++++++++++++++++++
>  8 files changed, 183 insertions(+)
>  create mode 100644 patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
>  create mode 100644 patches/redis-6.2.6/series
>  create mode 100644 projectroot/usr/lib/systemd/system/redis.service
>  create mode 100644 projectroot/usr/lib/tmpfiles.d/redis.conf
>  create mode 100644 rules/redis.in
>  create mode 100644 rules/redis.make
> 
> diff --git a/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> new file mode 100644
> index 000000000..34d8fd283
> --- /dev/null
> +++ b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> @@ -0,0 +1,30 @@
> +From: Clemens Gruber <clemens.gruber@pqgruber.com>
> +Date: Mon, 15 Nov 2021 16:21:31 +0100
> +Subject: [PATCH] Support systemd and set a data directory
> +
> +---
> + redis.conf | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/redis.conf b/redis.conf
> +index e8eff2774981..8f76ea1c84e4 100644
> +--- a/redis.conf
> ++++ b/redis.conf
> +@@ -272,7 +272,7 @@ daemonize no
> + # The default is "no". To run under upstart/systemd, you can simply uncomment
> + # the line below:
> + #
> +-# supervised auto
> ++supervised auto
> + 
> + # If a pid file is specified, Redis writes it where specified at startup
> + # and removes it at exit.
> +@@ -451,7 +451,7 @@ rdb-del-sync-files no
> + # The Append Only File will also be created inside this directory.
> + #
> + # Note that you must specify a directory here, not a file name.
> +-dir ./
> ++dir /var/lib/redis/
> + 
> + ################################# REPLICATION #################################
> + 
> diff --git a/patches/redis-6.2.6/series b/patches/redis-6.2.6/series
> new file mode 100644
> index 000000000..1a299f8b7
> --- /dev/null
> +++ b/patches/redis-6.2.6/series
> @@ -0,0 +1,4 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-Support-systemd-and-set-a-data-directory.patch
> +# a122637ab2789578ffe3ff7cc6f22faf  - git-ptx-patches magic
> diff --git a/projectroot/etc/group b/projectroot/etc/group
> index 09df73ba0..69d650510 100644
> --- a/projectroot/etc/group
> +++ b/projectroot/etc/group
> @@ -33,4 +33,5 @@ render:x:209:
>  pulse:x:210:
>  chrony:x:211:
>  rauc-hawkbit:x:212:
> +redis:x:213:
>  nogroup:x:65534:
> diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
> index 529f49a77..b4669abb5 100644
> --- a/projectroot/etc/passwd
> +++ b/projectroot/etc/passwd
> @@ -17,5 +17,6 @@ systemd-journal-upload:x:208:208:systemd-journal-upload:/dev/null:/bin/false
>  pulse:x:209:210:pulse:/dev/null:/bin/false
>  chrony:x:210:211:chrony:/dev/null:/bin/false
>  rauc-hawkbit:x:211:212:rauc-hawkbit:/dev/null:/bin/false
> +redis:x:212:213:redis:/dev/null:/bin/false
>  rpcuser:x:65533:65534:RPC user:/dev/null:/bin/false
>  nobody:x:65534:65534:Unprivileged Nobody:/dev/null:/bin/false
> diff --git a/projectroot/usr/lib/systemd/system/redis.service b/projectroot/usr/lib/systemd/system/redis.service
> new file mode 100644
> index 000000000..715e64d69
> --- /dev/null
> +++ b/projectroot/usr/lib/systemd/system/redis.service
> @@ -0,0 +1,23 @@
> +[Unit]
> +Description=Advanced key-value store
> +After=network.target
> +
> +[Service]
> +Type=notify
> +User=redis
> +Group=redis
> +ExecStart=/usr/bin/redis-server /etc/redis.conf
> +TimeoutStartSec=60
> +TimeoutStopSec=60
> +CapabilityBoundingSet=
> +PrivateTmp=true
> +PrivateDevices=true
> +ProtectSystem=full
> +ProtectHome=true
> +NoNewPrivileges=true
> +RuntimeDirectory=redis
> +RuntimeDirectoryMode=755
> +LimitNOFILE=10032

Magic number? Or is this really the maximum number of file descriptors
that redis will ever need?

> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/projectroot/usr/lib/tmpfiles.d/redis.conf b/projectroot/usr/lib/tmpfiles.d/redis.conf
> new file mode 100644
> index 000000000..d9283eab5
> --- /dev/null
> +++ b/projectroot/usr/lib/tmpfiles.d/redis.conf
> @@ -0,0 +1 @@
> +d /var/lib/redis 0700 redis redis
> diff --git a/rules/redis.in b/rules/redis.in
> new file mode 100644
> index 000000000..3cf67ea89
> --- /dev/null
> +++ b/rules/redis.in
> @@ -0,0 +1,27 @@
> +## SECTION=system_libraries
> +menuconfig REDIS
> +	tristate
> +	prompt "redis                         "
> +	select GCCLIBS_GCC_S
> +	select LIBC_DL
> +	select LIBC_PTHREAD
> +	select LIBC_CRYPT
> +	select SYSTEMD		if REDIS_SYSTEMD
> +	help
> +	  Redis is an open source (BSD licensed), in-memory data
> +	  structure store, used as a database, cache, and message
> +	  broker.
> +
> +if REDIS
> +
> +config REDIS_SYSTEMD
> +	bool
> +	default INITMETHOD_SYSTEMD
> +
> +config REDIS_SYSTEMD_UNIT
> +	bool
> +	default y
> +	depends on SYSTEMD
> +	prompt "Unit file for systemd"
> +
> +endif
> diff --git a/rules/redis.make b/rules/redis.make
> new file mode 100644
> index 000000000..bb3bb60ff
> --- /dev/null
> +++ b/rules/redis.make
> @@ -0,0 +1,96 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2021 by Clemens Gruber <clemens.gruber@pqgruber.com>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_REDIS) += redis
> +
> +#
> +# Paths and names
> +#
> +REDIS_VERSION	:= 6.2.6
> +REDIS_MD5	:= f69ca96b39ca93001add922d558f9842
> +REDIS		:= redis-$(REDIS_VERSION)
> +REDIS_SUFFIX	:= tar.gz
> +REDIS_URL	:= https://download.redis.io/releases/$(REDIS).$(REDIS_SUFFIX)
> +REDIS_SOURCE	:= $(SRCDIR)/$(REDIS).$(REDIS_SUFFIX)
> +REDIS_DIR	:= $(BUILDDIR)/$(REDIS)
> +REDIS_LICENSE	:= BSD-3-Clause

Please add at least one license snippet to REDIS_LICENSE_FILES, see
<https://www.ptxdist.org/doc/dev_licenses.html#adding-license-files-to-ptxdist-packages>
(as far as I can see, LICENSE should be enough.)

 - Roland

> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +REDIS_CONF_TOOL := NO
> +
> +REDIS_MAKE_ENV := \
> +	$(CROSS_ENV)
> +
> +REDIS_MAKE_OPT := \
> +	CC=$(CROSS_CC) \
> +	PREFIX=/usr \
> +	USE_JEMALLOC=no \
> +	USE_SYSTEMD=$(call ptx/ifdef,PTXCONF_REDIS_SYSTEMD,yes,no) \
> +	all
> +
> +REDIS_PATH := PATH=$(CROSS_PATH)
> +
> +REDIS_INSTALL_OPT := \
> +	PREFIX=$(REDIS_PKGDIR)/usr \
> +	install
> +
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/redis.install:
> +	@$(call targetinfo)
> +	@$(call world/install, REDIS)
> +	@install -v -D -m644 $(REDIS_DIR)/redis.conf \
> +		$(REDIS_PKGDIR)/etc/redis.conf
> +	@$(call touch)
> +
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/redis.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, redis)
> +	@$(call install_fixup, redis,PRIORITY,optional)
> +	@$(call install_fixup, redis,SECTION,base)
> +	@$(call install_fixup, redis,AUTHOR,"Clemens Gruber <clemens.gruber@pqgruber.com>")
> +	@$(call install_fixup, redis,DESCRIPTION,"An in-memory database that persists on disk")
> +
> +	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-benchmark)
> +	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-cli)
> +	@$(call install_copy, redis, 0, 0, 0755, -, /usr/bin/redis-server)
> +
> +	@$(call install_link, redis, /usr/bin/redis-server, /usr/bin/redis-check-aof)
> +	@$(call install_link, redis, /usr/bin/redis-server, /usr/bin/redis-check-rdb)
> +
> +	@$(call install_alternative, redis, 0, 0, 0644, /etc/redis.conf)
> +
> +	@$(call install_copy, redis, 0, 0, 0700, /var/lib/redis)
> +
> +ifdef PTXCONF_REDIS_SYSTEMD_UNIT
> +	@$(call install_alternative, redis, 0, 0, 0644, /usr/lib/systemd/system/redis.service)
> +	@$(call install_link, redis, ../redis.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/redis.service)
> +endif
> +	@$(call install_alternative, redis, 0, 0, 0644, /usr/lib/tmpfiles.d/redis.conf)
> +
> +	@$(call install_finish, redis)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.34.1
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] redis: new package
  2021-12-03 15:17 ` Roland Hieber
@ 2021-12-03 15:28   ` Clemens Gruber
  2021-12-03 15:40     ` Alexander Dahl
  0 siblings, 1 reply; 6+ messages in thread
From: Clemens Gruber @ 2021-12-03 15:28 UTC (permalink / raw)
  To: ptxdist

On Fri, Dec 03, 2021 at 04:17:06PM +0100, Roland Hieber wrote:
> On Thu, Dec 02, 2021 at 04:09:55PM +0100, Clemens Gruber wrote:
> > Adds a new package for redis, an open source (BSD licensed), in-memory
> > data structure store, used as a database, cache, and message broker.
> > 
> > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > ---
> >  ...ort-systemd-and-set-a-data-directory.patch | 30 ++++++
> >  patches/redis-6.2.6/series                    |  4 +
> >  projectroot/etc/group                         |  1 +
> >  projectroot/etc/passwd                        |  1 +
> >  .../usr/lib/systemd/system/redis.service      | 23 +++++
> >  projectroot/usr/lib/tmpfiles.d/redis.conf     |  1 +
> >  rules/redis.in                                | 27 ++++++
> >  rules/redis.make                              | 96 +++++++++++++++++++
> >  8 files changed, 183 insertions(+)
> >  create mode 100644 patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> >  create mode 100644 patches/redis-6.2.6/series
> >  create mode 100644 projectroot/usr/lib/systemd/system/redis.service
> >  create mode 100644 projectroot/usr/lib/tmpfiles.d/redis.conf
> >  create mode 100644 rules/redis.in
> >  create mode 100644 rules/redis.make
> > 
> > diff --git a/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > new file mode 100644
> > index 000000000..34d8fd283
> > --- /dev/null
> > +++ b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > @@ -0,0 +1,30 @@
> > +From: Clemens Gruber <clemens.gruber@pqgruber.com>
> > +Date: Mon, 15 Nov 2021 16:21:31 +0100
> > +Subject: [PATCH] Support systemd and set a data directory
> > +
> > +---
> > + redis.conf | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/redis.conf b/redis.conf
> > +index e8eff2774981..8f76ea1c84e4 100644
> > +--- a/redis.conf
> > ++++ b/redis.conf
> > +@@ -272,7 +272,7 @@ daemonize no
> > + # The default is "no". To run under upstart/systemd, you can simply uncomment
> > + # the line below:
> > + #
> > +-# supervised auto
> > ++supervised auto
> > + 
> > + # If a pid file is specified, Redis writes it where specified at startup
> > + # and removes it at exit.
> > +@@ -451,7 +451,7 @@ rdb-del-sync-files no
> > + # The Append Only File will also be created inside this directory.
> > + #
> > + # Note that you must specify a directory here, not a file name.
> > +-dir ./
> > ++dir /var/lib/redis/
> > + 
> > + ################################# REPLICATION #################################
> > + 
> > diff --git a/patches/redis-6.2.6/series b/patches/redis-6.2.6/series
> > new file mode 100644
> > index 000000000..1a299f8b7
> > --- /dev/null
> > +++ b/patches/redis-6.2.6/series
> > @@ -0,0 +1,4 @@
> > +# generated by git-ptx-patches
> > +#tag:base --start-number 1
> > +0001-Support-systemd-and-set-a-data-directory.patch
> > +# a122637ab2789578ffe3ff7cc6f22faf  - git-ptx-patches magic
> > diff --git a/projectroot/etc/group b/projectroot/etc/group
> > index 09df73ba0..69d650510 100644
> > --- a/projectroot/etc/group
> > +++ b/projectroot/etc/group
> > @@ -33,4 +33,5 @@ render:x:209:
> >  pulse:x:210:
> >  chrony:x:211:
> >  rauc-hawkbit:x:212:
> > +redis:x:213:
> >  nogroup:x:65534:
> > diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
> > index 529f49a77..b4669abb5 100644
> > --- a/projectroot/etc/passwd
> > +++ b/projectroot/etc/passwd
> > @@ -17,5 +17,6 @@ systemd-journal-upload:x:208:208:systemd-journal-upload:/dev/null:/bin/false
> >  pulse:x:209:210:pulse:/dev/null:/bin/false
> >  chrony:x:210:211:chrony:/dev/null:/bin/false
> >  rauc-hawkbit:x:211:212:rauc-hawkbit:/dev/null:/bin/false
> > +redis:x:212:213:redis:/dev/null:/bin/false
> >  rpcuser:x:65533:65534:RPC user:/dev/null:/bin/false
> >  nobody:x:65534:65534:Unprivileged Nobody:/dev/null:/bin/false
> > diff --git a/projectroot/usr/lib/systemd/system/redis.service b/projectroot/usr/lib/systemd/system/redis.service
> > new file mode 100644
> > index 000000000..715e64d69
> > --- /dev/null
> > +++ b/projectroot/usr/lib/systemd/system/redis.service
> > @@ -0,0 +1,23 @@
> > +[Unit]
> > +Description=Advanced key-value store
> > +After=network.target
> > +
> > +[Service]
> > +Type=notify
> > +User=redis
> > +Group=redis
> > +ExecStart=/usr/bin/redis-server /etc/redis.conf
> > +TimeoutStartSec=60
> > +TimeoutStopSec=60
> > +CapabilityBoundingSet=
> > +PrivateTmp=true
> > +PrivateDevices=true
> > +ProtectSystem=full
> > +ProtectHome=true
> > +NoNewPrivileges=true
> > +RuntimeDirectory=redis
> > +RuntimeDirectoryMode=755
> > +LimitNOFILE=10032
> 
> Magic number? Or is this really the maximum number of file descriptors
> that redis will ever need?

By default, Redis sets its maxclients variable to 10000. Number of
required FDs is apparently maxclients + 32. That's why some distros set
the FD limit to 10032. Debian sets it to 65535 but I think 10000 client
connections should be enough for embedded Linux usecases :)
I took the whole service file from ArchLinux btw.

> 
> > +
> > +[Install]
> > +WantedBy=multi-user.target
> > diff --git a/projectroot/usr/lib/tmpfiles.d/redis.conf b/projectroot/usr/lib/tmpfiles.d/redis.conf
> > new file mode 100644
> > index 000000000..d9283eab5
> > --- /dev/null
> > +++ b/projectroot/usr/lib/tmpfiles.d/redis.conf
> > @@ -0,0 +1 @@
> > +d /var/lib/redis 0700 redis redis
> > diff --git a/rules/redis.in b/rules/redis.in
> > new file mode 100644
> > index 000000000..3cf67ea89
> > --- /dev/null
> > +++ b/rules/redis.in
> > @@ -0,0 +1,27 @@
> > +## SECTION=system_libraries
> > +menuconfig REDIS
> > +	tristate
> > +	prompt "redis                         "
> > +	select GCCLIBS_GCC_S
> > +	select LIBC_DL
> > +	select LIBC_PTHREAD
> > +	select LIBC_CRYPT
> > +	select SYSTEMD		if REDIS_SYSTEMD
> > +	help
> > +	  Redis is an open source (BSD licensed), in-memory data
> > +	  structure store, used as a database, cache, and message
> > +	  broker.
> > +
> > +if REDIS
> > +
> > +config REDIS_SYSTEMD
> > +	bool
> > +	default INITMETHOD_SYSTEMD
> > +
> > +config REDIS_SYSTEMD_UNIT
> > +	bool
> > +	default y
> > +	depends on SYSTEMD
> > +	prompt "Unit file for systemd"
> > +
> > +endif
> > diff --git a/rules/redis.make b/rules/redis.make
> > new file mode 100644
> > index 000000000..bb3bb60ff
> > --- /dev/null
> > +++ b/rules/redis.make
> > @@ -0,0 +1,96 @@
> > +# -*-makefile-*-
> > +#
> > +# Copyright (C) 2021 by Clemens Gruber <clemens.gruber@pqgruber.com>
> > +#
> > +# For further information about the PTXdist project and license conditions
> > +# see the README file.
> > +#
> > +
> > +#
> > +# We provide this package
> > +#
> > +PACKAGES-$(PTXCONF_REDIS) += redis
> > +
> > +#
> > +# Paths and names
> > +#
> > +REDIS_VERSION	:= 6.2.6
> > +REDIS_MD5	:= f69ca96b39ca93001add922d558f9842
> > +REDIS		:= redis-$(REDIS_VERSION)
> > +REDIS_SUFFIX	:= tar.gz
> > +REDIS_URL	:= https://download.redis.io/releases/$(REDIS).$(REDIS_SUFFIX)
> > +REDIS_SOURCE	:= $(SRCDIR)/$(REDIS).$(REDIS_SUFFIX)
> > +REDIS_DIR	:= $(BUILDDIR)/$(REDIS)
> > +REDIS_LICENSE	:= BSD-3-Clause
> 
> Please add at least one license snippet to REDIS_LICENSE_FILES, see
> <https://www.ptxdist.org/doc/dev_licenses.html#adding-license-files-to-ptxdist-packages>
> (as far as I can see, LICENSE should be enough.)

OK.

I will wait a bit before sending a v2, in case someone else spots
something.

Thanks,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] redis: new package
  2021-12-03 15:28   ` Clemens Gruber
@ 2021-12-03 15:40     ` Alexander Dahl
  2021-12-03 15:50       ` Clemens Gruber
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Dahl @ 2021-12-03 15:40 UTC (permalink / raw)
  To: Clemens Gruber; +Cc: ptxdist

Hello Clemens,

Am Fri, Dec 03, 2021 at 04:28:39PM +0100 schrieb Clemens Gruber:
> On Fri, Dec 03, 2021 at 04:17:06PM +0100, Roland Hieber wrote:
> > On Thu, Dec 02, 2021 at 04:09:55PM +0100, Clemens Gruber wrote:
> > > Adds a new package for redis, an open source (BSD licensed), in-memory
> > > data structure store, used as a database, cache, and message broker.
> > > 
> > > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > > ---
> > >  ...ort-systemd-and-set-a-data-directory.patch | 30 ++++++
> > >  patches/redis-6.2.6/series                    |  4 +
> > >  projectroot/etc/group                         |  1 +
> > >  projectroot/etc/passwd                        |  1 +
> > >  .../usr/lib/systemd/system/redis.service      | 23 +++++
> > >  projectroot/usr/lib/tmpfiles.d/redis.conf     |  1 +
> > >  rules/redis.in                                | 27 ++++++
> > >  rules/redis.make                              | 96 +++++++++++++++++++
> > >  8 files changed, 183 insertions(+)
> > >  create mode 100644 patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > >  create mode 100644 patches/redis-6.2.6/series
> > >  create mode 100644 projectroot/usr/lib/systemd/system/redis.service
> > >  create mode 100644 projectroot/usr/lib/tmpfiles.d/redis.conf
> > >  create mode 100644 rules/redis.in
> > >  create mode 100644 rules/redis.make
> > > 
> > > diff --git a/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > > new file mode 100644
> > > index 000000000..34d8fd283
> > > --- /dev/null
> > > +++ b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > > @@ -0,0 +1,30 @@
> > > +From: Clemens Gruber <clemens.gruber@pqgruber.com>
> > > +Date: Mon, 15 Nov 2021 16:21:31 +0100
> > > +Subject: [PATCH] Support systemd and set a data directory
> > > +
> > > +---
> > > + redis.conf | 4 ++--
> > > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > > +
> > > +diff --git a/redis.conf b/redis.conf
> > > +index e8eff2774981..8f76ea1c84e4 100644
> > > +--- a/redis.conf
> > > ++++ b/redis.conf
> > > +@@ -272,7 +272,7 @@ daemonize no
> > > + # The default is "no". To run under upstart/systemd, you can simply uncomment
> > > + # the line below:
> > > + #
> > > +-# supervised auto
> > > ++supervised auto
> > > + 
> > > + # If a pid file is specified, Redis writes it where specified at startup
> > > + # and removes it at exit.
> > > +@@ -451,7 +451,7 @@ rdb-del-sync-files no
> > > + # The Append Only File will also be created inside this directory.
> > > + #
> > > + # Note that you must specify a directory here, not a file name.
> > > +-dir ./
> > > ++dir /var/lib/redis/
> > > + 
> > > + ################################# REPLICATION #################################
> > > + 
> > > diff --git a/patches/redis-6.2.6/series b/patches/redis-6.2.6/series
> > > new file mode 100644
> > > index 000000000..1a299f8b7
> > > --- /dev/null
> > > +++ b/patches/redis-6.2.6/series
> > > @@ -0,0 +1,4 @@
> > > +# generated by git-ptx-patches
> > > +#tag:base --start-number 1
> > > +0001-Support-systemd-and-set-a-data-directory.patch
> > > +# a122637ab2789578ffe3ff7cc6f22faf  - git-ptx-patches magic
> > > diff --git a/projectroot/etc/group b/projectroot/etc/group
> > > index 09df73ba0..69d650510 100644
> > > --- a/projectroot/etc/group
> > > +++ b/projectroot/etc/group
> > > @@ -33,4 +33,5 @@ render:x:209:
> > >  pulse:x:210:
> > >  chrony:x:211:
> > >  rauc-hawkbit:x:212:
> > > +redis:x:213:
> > >  nogroup:x:65534:
> > > diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
> > > index 529f49a77..b4669abb5 100644
> > > --- a/projectroot/etc/passwd
> > > +++ b/projectroot/etc/passwd
> > > @@ -17,5 +17,6 @@ systemd-journal-upload:x:208:208:systemd-journal-upload:/dev/null:/bin/false
> > >  pulse:x:209:210:pulse:/dev/null:/bin/false
> > >  chrony:x:210:211:chrony:/dev/null:/bin/false
> > >  rauc-hawkbit:x:211:212:rauc-hawkbit:/dev/null:/bin/false
> > > +redis:x:212:213:redis:/dev/null:/bin/false
> > >  rpcuser:x:65533:65534:RPC user:/dev/null:/bin/false
> > >  nobody:x:65534:65534:Unprivileged Nobody:/dev/null:/bin/false
> > > diff --git a/projectroot/usr/lib/systemd/system/redis.service b/projectroot/usr/lib/systemd/system/redis.service
> > > new file mode 100644
> > > index 000000000..715e64d69
> > > --- /dev/null
> > > +++ b/projectroot/usr/lib/systemd/system/redis.service
> > > @@ -0,0 +1,23 @@
> > > +[Unit]
> > > +Description=Advanced key-value store
> > > +After=network.target
> > > +
> > > +[Service]
> > > +Type=notify
> > > +User=redis
> > > +Group=redis
> > > +ExecStart=/usr/bin/redis-server /etc/redis.conf
> > > +TimeoutStartSec=60
> > > +TimeoutStopSec=60
> > > +CapabilityBoundingSet=
> > > +PrivateTmp=true
> > > +PrivateDevices=true
> > > +ProtectSystem=full
> > > +ProtectHome=true
> > > +NoNewPrivileges=true
> > > +RuntimeDirectory=redis
> > > +RuntimeDirectoryMode=755
> > > +LimitNOFILE=10032
> > 
> > Magic number? Or is this really the maximum number of file descriptors
> > that redis will ever need?
> 
> By default, Redis sets its maxclients variable to 10000. Number of
> required FDs is apparently maxclients + 32. That's why some distros set
> the FD limit to 10032. Debian sets it to 65535 but I think 10000 client
> connections should be enough for embedded Linux usecases :)
> I took the whole service file from ArchLinux btw.

Would it help to put that information (where the service unit came
from) somewhere? Either commit message or comment in service unit?

Greets
Alex

> 
> > 
> > > +
> > > +[Install]
> > > +WantedBy=multi-user.target
> > > diff --git a/projectroot/usr/lib/tmpfiles.d/redis.conf b/projectroot/usr/lib/tmpfiles.d/redis.conf
> > > new file mode 100644
> > > index 000000000..d9283eab5
> > > --- /dev/null
> > > +++ b/projectroot/usr/lib/tmpfiles.d/redis.conf
> > > @@ -0,0 +1 @@
> > > +d /var/lib/redis 0700 redis redis
> > > diff --git a/rules/redis.in b/rules/redis.in
> > > new file mode 100644
> > > index 000000000..3cf67ea89
> > > --- /dev/null
> > > +++ b/rules/redis.in
> > > @@ -0,0 +1,27 @@
> > > +## SECTION=system_libraries
> > > +menuconfig REDIS
> > > +	tristate
> > > +	prompt "redis                         "
> > > +	select GCCLIBS_GCC_S
> > > +	select LIBC_DL
> > > +	select LIBC_PTHREAD
> > > +	select LIBC_CRYPT
> > > +	select SYSTEMD		if REDIS_SYSTEMD
> > > +	help
> > > +	  Redis is an open source (BSD licensed), in-memory data
> > > +	  structure store, used as a database, cache, and message
> > > +	  broker.
> > > +
> > > +if REDIS
> > > +
> > > +config REDIS_SYSTEMD
> > > +	bool
> > > +	default INITMETHOD_SYSTEMD
> > > +
> > > +config REDIS_SYSTEMD_UNIT
> > > +	bool
> > > +	default y
> > > +	depends on SYSTEMD
> > > +	prompt "Unit file for systemd"
> > > +
> > > +endif
> > > diff --git a/rules/redis.make b/rules/redis.make
> > > new file mode 100644
> > > index 000000000..bb3bb60ff
> > > --- /dev/null
> > > +++ b/rules/redis.make
> > > @@ -0,0 +1,96 @@
> > > +# -*-makefile-*-
> > > +#
> > > +# Copyright (C) 2021 by Clemens Gruber <clemens.gruber@pqgruber.com>
> > > +#
> > > +# For further information about the PTXdist project and license conditions
> > > +# see the README file.
> > > +#
> > > +
> > > +#
> > > +# We provide this package
> > > +#
> > > +PACKAGES-$(PTXCONF_REDIS) += redis
> > > +
> > > +#
> > > +# Paths and names
> > > +#
> > > +REDIS_VERSION	:= 6.2.6
> > > +REDIS_MD5	:= f69ca96b39ca93001add922d558f9842
> > > +REDIS		:= redis-$(REDIS_VERSION)
> > > +REDIS_SUFFIX	:= tar.gz
> > > +REDIS_URL	:= https://download.redis.io/releases/$(REDIS).$(REDIS_SUFFIX)
> > > +REDIS_SOURCE	:= $(SRCDIR)/$(REDIS).$(REDIS_SUFFIX)
> > > +REDIS_DIR	:= $(BUILDDIR)/$(REDIS)
> > > +REDIS_LICENSE	:= BSD-3-Clause
> > 
> > Please add at least one license snippet to REDIS_LICENSE_FILES, see
> > <https://www.ptxdist.org/doc/dev_licenses.html#adding-license-files-to-ptxdist-packages>
> > (as far as I can see, LICENSE should be enough.)
> 
> OK.
> 
> I will wait a bit before sending a v2, in case someone else spots
> something.
> 
> Thanks,
> Clemens
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ptxdist] [PATCH] redis: new package
  2021-12-03 15:40     ` Alexander Dahl
@ 2021-12-03 15:50       ` Clemens Gruber
  0 siblings, 0 replies; 6+ messages in thread
From: Clemens Gruber @ 2021-12-03 15:50 UTC (permalink / raw)
  To: ptxdist

Hello Alex,

On Fri, Dec 03, 2021 at 04:40:29PM +0100, Alexander Dahl wrote:
> Hello Clemens,
> 
> Am Fri, Dec 03, 2021 at 04:28:39PM +0100 schrieb Clemens Gruber:
> > On Fri, Dec 03, 2021 at 04:17:06PM +0100, Roland Hieber wrote:
> > > On Thu, Dec 02, 2021 at 04:09:55PM +0100, Clemens Gruber wrote:
> > > > Adds a new package for redis, an open source (BSD licensed), in-memory
> > > > data structure store, used as a database, cache, and message broker.
> > > > 
> > > > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > > > ---
> > > >  ...ort-systemd-and-set-a-data-directory.patch | 30 ++++++
> > > >  patches/redis-6.2.6/series                    |  4 +
> > > >  projectroot/etc/group                         |  1 +
> > > >  projectroot/etc/passwd                        |  1 +
> > > >  .../usr/lib/systemd/system/redis.service      | 23 +++++
> > > >  projectroot/usr/lib/tmpfiles.d/redis.conf     |  1 +
> > > >  rules/redis.in                                | 27 ++++++
> > > >  rules/redis.make                              | 96 +++++++++++++++++++
> > > >  8 files changed, 183 insertions(+)
> > > >  create mode 100644 patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > > >  create mode 100644 patches/redis-6.2.6/series
> > > >  create mode 100644 projectroot/usr/lib/systemd/system/redis.service
> > > >  create mode 100644 projectroot/usr/lib/tmpfiles.d/redis.conf
> > > >  create mode 100644 rules/redis.in
> > > >  create mode 100644 rules/redis.make
> > > > 
> > > > diff --git a/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > > > new file mode 100644
> > > > index 000000000..34d8fd283
> > > > --- /dev/null
> > > > +++ b/patches/redis-6.2.6/0001-Support-systemd-and-set-a-data-directory.patch
> > > > @@ -0,0 +1,30 @@
> > > > +From: Clemens Gruber <clemens.gruber@pqgruber.com>
> > > > +Date: Mon, 15 Nov 2021 16:21:31 +0100
> > > > +Subject: [PATCH] Support systemd and set a data directory
> > > > +
> > > > +---
> > > > + redis.conf | 4 ++--
> > > > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > > > +
> > > > +diff --git a/redis.conf b/redis.conf
> > > > +index e8eff2774981..8f76ea1c84e4 100644
> > > > +--- a/redis.conf
> > > > ++++ b/redis.conf
> > > > +@@ -272,7 +272,7 @@ daemonize no
> > > > + # The default is "no". To run under upstart/systemd, you can simply uncomment
> > > > + # the line below:
> > > > + #
> > > > +-# supervised auto
> > > > ++supervised auto
> > > > + 
> > > > + # If a pid file is specified, Redis writes it where specified at startup
> > > > + # and removes it at exit.
> > > > +@@ -451,7 +451,7 @@ rdb-del-sync-files no
> > > > + # The Append Only File will also be created inside this directory.
> > > > + #
> > > > + # Note that you must specify a directory here, not a file name.
> > > > +-dir ./
> > > > ++dir /var/lib/redis/
> > > > + 
> > > > + ################################# REPLICATION #################################
> > > > + 
> > > > diff --git a/patches/redis-6.2.6/series b/patches/redis-6.2.6/series
> > > > new file mode 100644
> > > > index 000000000..1a299f8b7
> > > > --- /dev/null
> > > > +++ b/patches/redis-6.2.6/series
> > > > @@ -0,0 +1,4 @@
> > > > +# generated by git-ptx-patches
> > > > +#tag:base --start-number 1
> > > > +0001-Support-systemd-and-set-a-data-directory.patch
> > > > +# a122637ab2789578ffe3ff7cc6f22faf  - git-ptx-patches magic
> > > > diff --git a/projectroot/etc/group b/projectroot/etc/group
> > > > index 09df73ba0..69d650510 100644
> > > > --- a/projectroot/etc/group
> > > > +++ b/projectroot/etc/group
> > > > @@ -33,4 +33,5 @@ render:x:209:
> > > >  pulse:x:210:
> > > >  chrony:x:211:
> > > >  rauc-hawkbit:x:212:
> > > > +redis:x:213:
> > > >  nogroup:x:65534:
> > > > diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
> > > > index 529f49a77..b4669abb5 100644
> > > > --- a/projectroot/etc/passwd
> > > > +++ b/projectroot/etc/passwd
> > > > @@ -17,5 +17,6 @@ systemd-journal-upload:x:208:208:systemd-journal-upload:/dev/null:/bin/false
> > > >  pulse:x:209:210:pulse:/dev/null:/bin/false
> > > >  chrony:x:210:211:chrony:/dev/null:/bin/false
> > > >  rauc-hawkbit:x:211:212:rauc-hawkbit:/dev/null:/bin/false
> > > > +redis:x:212:213:redis:/dev/null:/bin/false
> > > >  rpcuser:x:65533:65534:RPC user:/dev/null:/bin/false
> > > >  nobody:x:65534:65534:Unprivileged Nobody:/dev/null:/bin/false
> > > > diff --git a/projectroot/usr/lib/systemd/system/redis.service b/projectroot/usr/lib/systemd/system/redis.service
> > > > new file mode 100644
> > > > index 000000000..715e64d69
> > > > --- /dev/null
> > > > +++ b/projectroot/usr/lib/systemd/system/redis.service
> > > > @@ -0,0 +1,23 @@
> > > > +[Unit]
> > > > +Description=Advanced key-value store
> > > > +After=network.target
> > > > +
> > > > +[Service]
> > > > +Type=notify
> > > > +User=redis
> > > > +Group=redis
> > > > +ExecStart=/usr/bin/redis-server /etc/redis.conf
> > > > +TimeoutStartSec=60
> > > > +TimeoutStopSec=60
> > > > +CapabilityBoundingSet=
> > > > +PrivateTmp=true
> > > > +PrivateDevices=true
> > > > +ProtectSystem=full
> > > > +ProtectHome=true
> > > > +NoNewPrivileges=true
> > > > +RuntimeDirectory=redis
> > > > +RuntimeDirectoryMode=755
> > > > +LimitNOFILE=10032
> > > 
> > > Magic number? Or is this really the maximum number of file descriptors
> > > that redis will ever need?
> > 
> > By default, Redis sets its maxclients variable to 10000. Number of
> > required FDs is apparently maxclients + 32. That's why some distros set
> > the FD limit to 10032. Debian sets it to 65535 but I think 10000 client
> > connections should be enough for embedded Linux usecases :)
> > I took the whole service file from ArchLinux btw.
> 
> Would it help to put that information (where the service unit came
> from) somewhere? Either commit message or comment in service unit?
> 
> Greets
> Alex

Yes, mentioning it in the commit message is a good idea.

Thanks,
Clemens

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ptxdist] [PATCH] redis : new package
       [not found] <20140724104658.GR25193@pengutronix.de>
@ 2014-07-24 12:26 ` Stéphane Massoni
  0 siblings, 0 replies; 6+ messages in thread
From: Stéphane Massoni @ 2014-07-24 12:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Stéphane Massoni

Hi,

>Stephane,
>
>Am Do, 24 Jul 2014 schrieb ptxdist-bounces@pengutronix.de:
>> Pending posts:
>> From: stephane.massoni@nexvision.fr on Tue Jul 22 11:19:06 2014
>> Subject: [PATCH] redis : new package
>> Cause: Post by non-member to a members-only list
>
>I've accidently discarded your message instead of forwarding 
>it to the list. Sorry about that. 
>
>Please consider resending it :-)
>
>Greetings, 
>Bjørn

no problem.

The Redis-2.8.13 package.

Regards,
Stef

Signed-off-by: Stéphane Massoni <stephane.massoni@nexvision.fr>
---
 redis-2.8.13/0001-use-libc_malloc.diff           |  15 ++++
 redis-2.8.13/0002-configurable-install-path.diff |  13 +++
 redis-2.8.13/0003-only-one-instance.diff         |  11 +++
 redis-2.8.13/0004-config.diff                    |  29 +++++++
 redis-2.8.13/series                              |   4 +
 redis-bbinit.in                                  |   8 ++
 redis.in                                         |  34 ++++++++
 redis.make                                       | 106 +++++++++++++++++++++++
 8 files changed, 220 insertions(+)
 create mode 100644 redis-2.8.13/0001-use-libc_malloc.diff
 create mode 100644 redis-2.8.13/0002-configurable-install-path.diff
 create mode 100644 redis-2.8.13/0003-only-one-instance.diff
 create mode 100644 redis-2.8.13/0004-config.diff
 create mode 100644 redis-2.8.13/series
 create mode 100644 redis-bbinit.in
 create mode 100644 redis.in
 create mode 100644 redis.make

diff --git a/redis-2.8.13/0001-use-libc_malloc.diff b/redis-2.8.13/0001-use-libc_malloc.diff
new file mode 100644
index 0000000..725fbd3
--- /dev/null
+++ b/redis-2.8.13/0001-use-libc_malloc.diff
@@ -0,0 +1,15 @@
+--- a/src/Makefile	2014-06-05 11:02:23.000000000 +0200
++++ b/src/Makefile	2014-06-10 12:00:27.285831368 +0200
+@@ -27,11 +27,7 @@
+ INSTALL=install
+ 
+ # Default allocator
+-ifeq ($(uname_S),Linux)
+-	MALLOC=jemalloc
+-else
+-	MALLOC=libc
+-endif
++MALLOC=libc
+ 
+ # Backwards compatibility for selecting an allocator
+ ifeq ($(USE_TCMALLOC),yes)
diff --git a/redis-2.8.13/0002-configurable-install-path.diff b/redis-2.8.13/0002-configurable-install-path.diff
new file mode 100644
index 0000000..bf725c4
--- /dev/null
+++ b/redis-2.8.13/0002-configurable-install-path.diff
@@ -0,0 +1,13 @@
+--- a/utils/redis_init_script	2014-06-05 11:02:23.000000000 +0200
++++ b/utils/redis_init_script	2014-06-10 16:34:09.263313766 +0200
+@@ -4,8 +4,8 @@
+ # as it does use of the /proc filesystem.
+ 
+ REDISPORT=6379
+-EXEC=/usr/local/bin/redis-server
+-CLIEXEC=/usr/local/bin/redis-cli
++EXEC=XXX_INSTALL_PATH_XXX/redis-server
++CLIEXEC=XXX_INSTALL_PATH_XXX/redis-cli
+ 
+ PIDFILE=/var/run/redis_${REDISPORT}.pid
+ CONF="/etc/redis/${REDISPORT}.conf"
diff --git a/redis-2.8.13/0003-only-one-instance.diff b/redis-2.8.13/0003-only-one-instance.diff
new file mode 100644
index 0000000..a078bef
--- /dev/null
+++ b/redis-2.8.13/0003-only-one-instance.diff
@@ -0,0 +1,11 @@
+--- a/utils/redis_init_script	2014-06-10 16:39:01.975633874 +0200
++++ b/utils/redis_init_script	2014-06-10 17:03:14.457373706 +0200
+@@ -10,5 +10,6 @@
+-PIDFILE=/var/run/redis_${REDISPORT}.pid
+-CONF="/etc/redis/${REDISPORT}.conf"
++PIDFILE=/var/run/redis.pid
++CONF="/etc/redis.conf"
++REDISPORT=$(grep "^port" ${CONF} | cut -d" " -f2)
+ 
+ case "$1" in
+     start)
diff --git a/redis-2.8.13/0004-config.diff b/redis-2.8.13/0004-config.diff
new file mode 100644
index 0000000..7c4f249
--- /dev/null
+++ b/redis-2.8.13/0004-config.diff
@@ -0,0 +1,29 @@
+--- no_backup/platform-sc/build-target/redis-2.8.10/redis.conf	2014-06-05 11:02:23.000000000 +0200
++++ ../redis.conf	2014-06-10 17:30:42.108659924 +0200
+@@ -34,7 +34,7 @@
+ 
+ # By default Redis does not run as a daemon. Use 'yes' if you need it.
+ # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
+-daemonize no
++daemonize yes
+ 
+ # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
+ # default. You can specify a custom pid file location here.
+@@ -115,7 +115,7 @@
+ # Set the number of databases. The default database is DB 0, you can select
+ # a different one on a per-connection basis using SELECT <dbid> where
+ # dbid is a number between 0 and 'databases'-1
+-databases 16
++databases 2
+ 
+ ################################ SNAPSHOTTING  ################################
+ #
+@@ -184,7 +184,7 @@
+ # The Append Only File will also be created inside this directory.
+ # 
+ # Note that you must specify a directory here, not a file name.
+-dir ./
++dir /var/lib/
+ 
+ ################################# REPLICATION #################################
+ 
diff --git a/redis-2.8.13/series b/redis-2.8.13/series
new file mode 100644
index 0000000..934d5ee
--- /dev/null
+++ b/redis-2.8.13/series
@@ -0,0 +1,4 @@
+0001-use-libc_malloc.diff
+0002-configurable-install-path.diff
+0003-only-one-instance.diff
+0004-config.diff
diff --git a/redis-bbinit.in b/redis-bbinit.in
new file mode 100644
index 0000000..f4b642e
--- /dev/null
+++ b/redis-bbinit.in
@@ -0,0 +1,8 @@
+## SECTION=initmethod_bbinit
+
+config REDIS_BBINIT_LINK
+	string
+	depends on REDIS_STARTSCRIPT
+	prompt "redis-server"
+	default "S98redis-server"
+
diff --git a/redis.in b/redis.in
new file mode 100644
index 0000000..9a91300
--- /dev/null
+++ b/redis.in
@@ -0,0 +1,34 @@
+## SECTION=communication
+
+menuconfig REDIS
+	tristate
+	prompt "redis                         "
+	select ROOTFS_VAR_RUN
+	select LIBC_DL
+	select LIBC_PTHREAD
+	select ROOTFS_VAR_LIB
+	select BUSYBOX_START_STOP_DAEMON            if REDIS_STARTSCRIPT
+	select BUSYBOX_FEATURE_START_STOP_DAEMON_FANCY      if REDIS_STARTSCRIPT
+	select BUSYBOX_FEATURE_START_STOP_DAEMON_LONG_OPTIONS   if REDIS_STARTSCRIPT
+	help
+	  Redis is an open source, BSD licensed, advanced key-value store.
+	  It is often referred to as a data structure server since keys
+	  can contain strings, hashes, lists, sets and sorted sets.
+
+if REDIS
+
+config REDIS_PATH
+	string
+	prompt "install path"
+	default "/usr/bin"
+	help
+	  Install path for redis binaries
+
+config REDIS_STARTSCRIPT
+	bool
+	prompt "init script for redis-server"
+	default y
+	help
+	  Install this script to be able to run this service at system startup
+
+endif
diff --git a/redis.make b/redis.make
new file mode 100644
index 0000000..c3dfb2f
--- /dev/null
+++ b/redis.make
@@ -0,0 +1,106 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Salvatore Sanfilippo
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_REDIS) += redis
+
+#
+# Paths and names
+#
+REDIS_VERSION	:= 2.8.13
+REDIS_MD5	:= ea92053cbb6f4eb8a4347dbaac7d7dff
+REDIS		:= redis-$(REDIS_VERSION)
+REDIS_SUFFIX	:= tar.gz
+REDIS_URL		:= http://download.redis.io/releases/$(REDIS).$(REDIS_SUFFIX)
+REDIS_SOURCE	:= $(SRCDIR)/$(REDIS).$(REDIS_SUFFIX)
+REDIS_DIR		:= $(BUILDDIR)/$(REDIS)
+REDIS_LICENSE	:= BSD
+
+ifneq ($(call remove_quotes,$(PTXCONF_REDIS_PATH)),)
+	REDIS_INSTALL_PATH := $(PTXCONF_REDIS_PATH)
+else
+	REDIS_INSTALL_PATH := /usr/local/bin
+endif
+
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/redis.prepare:
+	@$(call targetinfo)
+	@$(call clean, $(REDIS_DIR)/src/release.h)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+REDIS_MAKE_ENV := $(CROSS_ENV)
+
+$(STATEDIR)/redis.compile:
+	@$(call targetinfo)
+	cd $(REDIS_DIR) && \
+		$(REDIS_MAKE_ENV) $(MAKE) $(REDIS_MAKE_OPT)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/redis.install:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/redis.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, redis)
+	@$(call install_fixup, redis,PRIORITY,optional)
+	@$(call install_fixup, redis,SECTION,communication)
+	@$(call install_fixup, redis,AUTHOR,"Stéphane Massoni <stephane.massoni@nexvision.fr>")
+	@$(call install_fixup, redis,DESCRIPTION,missing)
+
+	@$(call install_copy, redis, 0, 0, 0500, $(REDIS_DIR)/src/redis-server, $(REDIS_INSTALL_PATH)/redis-server, y)
+	@$(call install_copy, redis, 0, 0, 0500, $(REDIS_DIR)/src/redis-cli, $(REDIS_INSTALL_PATH)/redis-client, y)
+	@$(call install_copy, redis, 0, 0, 0500, $(REDIS_DIR)/redis.conf, /etc/redis.conf, n)
+
+ifdef PTXCONF_INITMETHOD_BBINIT
+ifdef PTXCONF_REDIS_STARTSCRIPT
+
+	@sed "s#XXX_INSTALL_PATH_XXX#$(REDIS_INSTALL_PATH)#g" $(REDIS_DIR)/utils/redis_init_script > $(REDIS_DIR)/utils/redis_init_script_mod
+	@$(call install_copy, redis, 0, 0, 0500, $(REDIS_DIR)/utils/redis_init_script_mod, /etc/init.d/redis-server, n)
+
+ifneq ($(call remove_quotes,$(PTXCONF_REDIS_BBINIT_LINK)),)
+	@$(call install_link, redis, ../init.d/redis-server, /etc/rc.d/$(PTXCONF_REDIS_BBINIT_LINK))
+endif
+
+endif
+endif
+
+	@$(call install_finish, redis)
+
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+# vim: syntax=make
-- 
2.0.0


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-03 15:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 15:09 [ptxdist] [PATCH] redis: new package Clemens Gruber
2021-12-03 15:17 ` Roland Hieber
2021-12-03 15:28   ` Clemens Gruber
2021-12-03 15:40     ` Alexander Dahl
2021-12-03 15:50       ` Clemens Gruber
     [not found] <20140724104658.GR25193@pengutronix.de>
2014-07-24 12:26 ` [ptxdist] [PATCH] redis : " Stéphane Massoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox