* [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3
@ 2015-07-21 13:02 Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 2/5] package/redis: Add redis system user Martin Bark
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Martin Bark @ 2015-07-21 13:02 UTC (permalink / raw)
To: buildroot
Signed-off-by: Martin Bark <martin@barkynet.com>
---
package/redis/0001-uclibc.patch | 32 +++++---------------------------
package/redis/redis.hash | 4 ++--
package/redis/redis.mk | 2 +-
3 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/package/redis/0001-uclibc.patch b/package/redis/0001-uclibc.patch
index 01657d0..a0534d5 100644
--- a/package/redis/0001-uclibc.patch
+++ b/package/redis/0001-uclibc.patch
@@ -6,40 +6,18 @@ against uclibc. Patch originates from:
Mike Steinert, mike.steinert at gmail.com
Signed-off-by: Daniel Price <daniel.price@gmail.com>
+[Martin: adapt to 3.0.3]
+Signed-off-by: Martin Bark <martin@barkynet.com>
=========================================================================
diff -ur old/src/config.h new/src/config.h
--- old/src/config.h 2012-10-26 07:20:24.000000000 -0700
+++ new/src/config.h 2012-10-31 13:41:51.206309564 -0700
-@@ -1,6 +1,10 @@
- #ifndef __CONFIG_H
- #define __CONFIG_H
-
-+#if defined(__unix) || defined(__linux__)
-+#include <features.h>
-+#endif
-+
- #ifdef __APPLE__
- #include <AvailabilityMacros.h>
- #endif
-@@ -25,7 +29,7 @@
+@@ -62,7 +62,7 @@
#endif
/* Test for backtrace() */
--#if defined(__APPLE__) || defined(__linux__)
-+#if (defined(__APPLE__) || defined(__linux__) && !defined(__UCLIBC__))
+-#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__))
++#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__))
#define HAVE_BACKTRACE 1
#endif
-
-diff -ur old/src/Makefile new/src/Makefile
---- old/src/Makefile 2012-10-26 07:20:24.000000000 -0700
-+++ new/src/Makefile 2012-10-31 13:40:39.224728830 -0700
-@@ -135,7 +135,7 @@
- echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings
- echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings
- echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings
-- -(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))
-+ -(cd ../deps && $(MAKE) CC="$(CC)" $(DEPENDENCY_TARGETS))
-
- .PHONY: persist-settings
-
diff --git a/package/redis/redis.hash b/package/redis/redis.hash
index 5f91766..9afa94f 100644
--- a/package/redis/redis.hash
+++ b/package/redis/redis.hash
@@ -1,2 +1,2 @@
-# Locally calculated
-sha256 29bb08abfc3d392b2f0c3e7f48ec46dd09ab1023f9a5575fc2a93546f4ca5145 redis-2.8.19.tar.gz
+# From https://github.com/antirez/redis-hashes/blob/master/README
+sha1 0e2d7707327986ae652df717059354b358b83358 redis-3.0.3.tar.gz
diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index 4cad061..51c1f9c 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -4,7 +4,7 @@
#
################################################################################
-REDIS_VERSION = 2.8.19
+REDIS_VERSION = 3.0.3
REDIS_SITE = http://download.redis.io/releases
REDIS_LICENSE = BSD-3c (core); MIT and BSD family licenses (Bundled components)
REDIS_LICENSE_FILES = COPYING
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/5] package/redis: Add redis system user
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
@ 2015-07-21 13:02 ` Martin Bark
2015-07-21 13:27 ` Thomas Petazzoni
2015-07-21 13:02 ` [Buildroot] [PATCH 3/5] package/redis: Install /etc/redis.conf to target Martin Bark
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Martin Bark @ 2015-07-21 13:02 UTC (permalink / raw)
To: buildroot
Add a redis system user and set the home directory to /var/lib/redis
Signed-off-by: Martin Bark <martin@barkynet.com>
---
package/redis/redis.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index 51c1f9c..633d411 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -9,6 +9,10 @@ REDIS_SITE = http://download.redis.io/releases
REDIS_LICENSE = BSD-3c (core); MIT and BSD family licenses (Bundled components)
REDIS_LICENSE_FILES = COPYING
+define REDIS_USERS
+ redis -1 redis -1 * /var/lib/redis /bin/sh - Redis Server
+endef
+
# Redis doesn't support DESTDIR (yet, see
# https://github.com/antirez/redis/pull/609). We set PREFIX
# instead.
@@ -22,6 +26,7 @@ endef
define REDIS_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(REDIS_BUILDOPTS) -C $(@D) \
LDCONFIG=true install
+ $(INSTALL) -d -m 0700 $(TARGET_DIR)/var/lib/redis
endef
$(eval $(generic-package))
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 3/5] package/redis: Install /etc/redis.conf to target
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 2/5] package/redis: Add redis system user Martin Bark
@ 2015-07-21 13:02 ` Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 4/5] package/redis: Add systemV init script Martin Bark
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Martin Bark @ 2015-07-21 13:02 UTC (permalink / raw)
To: buildroot
Copy redis.conf from the redis release package but adjust some values to
sensible defaults using 0003-redis.conf-sane-defaults.patch
The file 0003-redis.conf-sane-defaults.patch originates from the redis
package in Arch Linux.
Signed-off-by: Martin Bark <martin@barkynet.com>
---
0003-redis.conf-sane-defaults.patch is a copy of the file
redis.conf-sane-defaults.patch from the Arch Linux redis package. See
https://projects.archlinux.org/svntogit/community.git/tree/trunk/redis.conf-sane-defaults.patch?h=packages/redis&id=b4907d2344855caeadf6c69bc01c403a95f8a4f3
Signed-off-by: Martin Bark <martin@barkynet.com>
---
package/redis/0003-redis.conf-sane-defaults.patch | 37 +++++++++++++++++++++++
package/redis/redis.mk | 2 ++
2 files changed, 39 insertions(+)
create mode 100644 package/redis/0003-redis.conf-sane-defaults.patch
diff --git a/package/redis/0003-redis.conf-sane-defaults.patch b/package/redis/0003-redis.conf-sane-defaults.patch
new file mode 100644
index 0000000..6ee3f21
--- /dev/null
+++ b/package/redis/0003-redis.conf-sane-defaults.patch
@@ -0,0 +1,37 @@
+Taken from archlinux redis package
+See https://projects.archlinux.org/svntogit/community.git/tree/trunk/redis.conf-sane-defaults.patch?h=packages/redis&id=5b2491ea61b746f289acebd12bc66e337d7e5b88
+
+Signed-off-by: Martin Bark <martin@barkynet.com>
+
+=========================================================================
+diff --git a/redis.conf b/redis.conf
+index 6efb6ac..344e021 100644
+--- a/redis.conf
++++ b/redis.conf
+@@ -61,7 +61,7 @@ tcp-backlog 511
+ # Examples:
+ #
+ # bind 192.168.1.100 10.0.0.1
+-# bind 127.0.0.1
++bind 127.0.0.1
+
+ # Specify the path for the Unix socket that will be used to listen for
+ # incoming connections. There is no default, so Redis will not listen
+@@ -87,7 +87,7 @@ timeout 0
+ # On other kernels the period depends on the kernel configuration.
+ #
+ # A reasonable value for this option is 60 seconds.
+-tcp-keepalive 0
++tcp-keepalive 60
+
+ # Specify the server verbosity level.
+ # This can be one of:
+@@ -184,7 +184,7 @@ dbfilename dump.rdb
+ # 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/package/redis/redis.mk b/package/redis/redis.mk
index 633d411..aa985b6 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -27,6 +27,8 @@ define REDIS_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(REDIS_BUILDOPTS) -C $(@D) \
LDCONFIG=true install
$(INSTALL) -d -m 0700 $(TARGET_DIR)/var/lib/redis
+ $(INSTALL) -D -m 0644 $(@D)/redis.conf \
+ $(TARGET_DIR)/etc/redis.conf
endef
$(eval $(generic-package))
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 4/5] package/redis: Add systemV init script
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 2/5] package/redis: Add redis system user Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 3/5] package/redis: Install /etc/redis.conf to target Martin Bark
@ 2015-07-21 13:02 ` Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 5/5] package/redis: Add systemd service Martin Bark
2015-07-21 21:19 ` [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Thomas Petazzoni
4 siblings, 0 replies; 8+ messages in thread
From: Martin Bark @ 2015-07-21 13:02 UTC (permalink / raw)
To: buildroot
start-stop-daemon is used to start redis-server as user redis in the
background. Once redis-server is running we use redis-cli to shutdown
cleanly.
Signed-off-by: Martin Bark <martin@barkynet.com>
---
package/redis/S50redis | 38 ++++++++++++++++++++++++++++++++++++++
package/redis/redis.mk | 5 +++++
2 files changed, 43 insertions(+)
create mode 100644 package/redis/S50redis
diff --git a/package/redis/S50redis b/package/redis/S50redis
new file mode 100644
index 0000000..450b368
--- /dev/null
+++ b/package/redis/S50redis
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# start redis
+#
+
+start() {
+ echo -n "Starting redis: "
+ umask 077
+ start-stop-daemon -S -q -c redis:redis -b \
+ --exec /usr/bin/redis-server -- /etc/redis.conf
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+ echo -n "Stopping redis: "
+ su - redis -c '/usr/bin/redis-cli shutdown'
+ [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index aa985b6..fdc4bf5 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -31,4 +31,9 @@ define REDIS_INSTALL_TARGET_CMDS
$(TARGET_DIR)/etc/redis.conf
endef
+define REDIS_INSTALL_INIT_SYSV
+ $(INSTALL) -m 0755 -D package/redis/S50redis \
+ $(TARGET_DIR)/etc/init.d/S50redis
+endef
+
$(eval $(generic-package))
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 5/5] package/redis: Add systemd service
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
` (2 preceding siblings ...)
2015-07-21 13:02 ` [Buildroot] [PATCH 4/5] package/redis: Add systemV init script Martin Bark
@ 2015-07-21 13:02 ` Martin Bark
2015-07-21 21:19 ` [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Thomas Petazzoni
4 siblings, 0 replies; 8+ messages in thread
From: Martin Bark @ 2015-07-21 13:02 UTC (permalink / raw)
To: buildroot
redis.service originates from the redis package in Arch Linux.
Signed-off-by: Martin Bark <martin@barkynet.com>
---
redis.service is copied from the Arch Linux redis package. See
https://projects.archlinux.org/svntogit/community.git/tree/trunk/redis.service?h=packages/redis&id=b4907d2344855caeadf6c69bc01c403a95f8a4f3
Signed-off-by: Martin Bark <martin@barkynet.com>
---
package/redis/redis.mk | 8 ++++++++
package/redis/redis.service | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 package/redis/redis.service
diff --git a/package/redis/redis.mk b/package/redis/redis.mk
index fdc4bf5..18e9ae3 100644
--- a/package/redis/redis.mk
+++ b/package/redis/redis.mk
@@ -36,4 +36,12 @@ define REDIS_INSTALL_INIT_SYSV
$(TARGET_DIR)/etc/init.d/S50redis
endef
+define REDIS_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 0644 package/redis/redis.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/redis.service
+ mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+ ln -fs ../../../../usr/lib/systemd/system/redis.service \
+ $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/redis.service
+endef
+
$(eval $(generic-package))
diff --git a/package/redis/redis.service b/package/redis/redis.service
new file mode 100644
index 0000000..0a8162b
--- /dev/null
+++ b/package/redis/redis.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=Advanced key-value store
+After=network.target
+
+[Service]
+Type=simple
+User=redis
+Group=redis
+ExecStart=/usr/bin/redis-server /etc/redis.conf
+ExecStop=/usr/bin/redis-cli shutdown
+CapabilityBoundingSet=
+PrivateTmp=true
+PrivateDevices=true
+ProtectSystem=full
+ProtectHome=true
+NoNewPrivileges=true
+RuntimeDirectory=redis
+RuntimeDirectoryMode=755
+LimitNOFILE=10032
+
+[Install]
+WantedBy=multi-user.target
--
2.1.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/5] package/redis: Add redis system user
2015-07-21 13:02 ` [Buildroot] [PATCH 2/5] package/redis: Add redis system user Martin Bark
@ 2015-07-21 13:27 ` Thomas Petazzoni
2015-07-21 14:27 ` Martin Bark
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2015-07-21 13:27 UTC (permalink / raw)
To: buildroot
Dear Martin Bark,
On Tue, 21 Jul 2015 14:02:51 +0100, Martin Bark wrote:
> Add a redis system user and set the home directory to /var/lib/redis
>
> Signed-off-by: Martin Bark <martin@barkynet.com>
> ---
> package/redis/redis.mk | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/package/redis/redis.mk b/package/redis/redis.mk
> index 51c1f9c..633d411 100644
> --- a/package/redis/redis.mk
> +++ b/package/redis/redis.mk
> @@ -9,6 +9,10 @@ REDIS_SITE = http://download.redis.io/releases
> REDIS_LICENSE = BSD-3c (core); MIT and BSD family licenses (Bundled components)
> REDIS_LICENSE_FILES = COPYING
>
> +define REDIS_USERS
> + redis -1 redis -1 * /var/lib/redis /bin/sh - Redis Server
Does it really need to have a login shell?
> +endef
> +
> # Redis doesn't support DESTDIR (yet, see
> # https://github.com/antirez/redis/pull/609). We set PREFIX
> # instead.
> @@ -22,6 +26,7 @@ endef
> define REDIS_INSTALL_TARGET_CMDS
> $(TARGET_MAKE_ENV) $(MAKE) $(REDIS_BUILDOPTS) -C $(@D) \
> LDCONFIG=true install
> + $(INSTALL) -d -m 0700 $(TARGET_DIR)/var/lib/redis
I don't think this line is needed, unless you want to install specific
things to /var/lib/redis, since specifying /var/lib/redis for the
REDIS_USERS is sufficient to get this directory created and chown-ed to
the right user.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 2/5] package/redis: Add redis system user
2015-07-21 13:27 ` Thomas Petazzoni
@ 2015-07-21 14:27 ` Martin Bark
0 siblings, 0 replies; 8+ messages in thread
From: Martin Bark @ 2015-07-21 14:27 UTC (permalink / raw)
To: buildroot
Thomas,
On 21 July 2015 at 14:27, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Martin Bark,
>
> On Tue, 21 Jul 2015 14:02:51 +0100, Martin Bark wrote:
>> Add a redis system user and set the home directory to /var/lib/redis
>>
>> Signed-off-by: Martin Bark <martin@barkynet.com>
>> ---
>> package/redis/redis.mk | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/package/redis/redis.mk b/package/redis/redis.mk
>> index 51c1f9c..633d411 100644
>> --- a/package/redis/redis.mk
>> +++ b/package/redis/redis.mk
>> @@ -9,6 +9,10 @@ REDIS_SITE = http://download.redis.io/releases
>> REDIS_LICENSE = BSD-3c (core); MIT and BSD family licenses (Bundled components)
>> REDIS_LICENSE_FILES = COPYING
>>
>> +define REDIS_USERS
>> + redis -1 redis -1 * /var/lib/redis /bin/sh - Redis Server
>
> Does it really need to have a login shell?
>
It's because in the sysv script S50redis i shutdown redis using this command
su - redis -c '/usr/bin/redis-cli shutdown'
I copied this idea from the postgresql package. I guess i could just do
/usr/bin/redis-cli shutdown
and run the command as root. I'll investigate changing the login
shell to /bin/false
>> +endef
>> +
>> # Redis doesn't support DESTDIR (yet, see
>> # https://github.com/antirez/redis/pull/609). We set PREFIX
>> # instead.
>> @@ -22,6 +26,7 @@ endef
>> define REDIS_INSTALL_TARGET_CMDS
>> $(TARGET_MAKE_ENV) $(MAKE) $(REDIS_BUILDOPTS) -C $(@D) \
>> LDCONFIG=true install
>> + $(INSTALL) -d -m 0700 $(TARGET_DIR)/var/lib/redis
>
> I don't think this line is needed, unless you want to install specific
> things to /var/lib/redis, since specifying /var/lib/redis for the
> REDIS_USERS is sufficient to get this directory created and chown-ed to
> the right user.
Yes good point. I'll remove that line and resubmit.
Thanks
Martin
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
` (3 preceding siblings ...)
2015-07-21 13:02 ` [Buildroot] [PATCH 5/5] package/redis: Add systemd service Martin Bark
@ 2015-07-21 21:19 ` Thomas Petazzoni
4 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2015-07-21 21:19 UTC (permalink / raw)
To: buildroot
Dear Martin Bark,
On Tue, 21 Jul 2015 14:02:50 +0100, Martin Bark wrote:
> Signed-off-by: Martin Bark <martin@barkynet.com>
> ---
> package/redis/0001-uclibc.patch | 32 +++++---------------------------
> package/redis/redis.hash | 4 ++--
> package/redis/redis.mk | 2 +-
> 3 files changed, 8 insertions(+), 30 deletions(-)
Applied, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-21 21:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 13:02 [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 2/5] package/redis: Add redis system user Martin Bark
2015-07-21 13:27 ` Thomas Petazzoni
2015-07-21 14:27 ` Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 3/5] package/redis: Install /etc/redis.conf to target Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 4/5] package/redis: Add systemV init script Martin Bark
2015-07-21 13:02 ` [Buildroot] [PATCH 5/5] package/redis: Add systemd service Martin Bark
2015-07-21 21:19 ` [Buildroot] [PATCH 1/5] package/redis: Bump version to 3.0.3 Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox