Skip to content

Instantly share code, notes, and snippets.

@dstrelau
Created November 9, 2012 03:42
Show Gist options
  • Save dstrelau/4043565 to your computer and use it in GitHub Desktop.
Save dstrelau/4043565 to your computer and use it in GitHub Desktop.
DIY redis-server deb packages via fpm
NAME=redis
PACKAGE_NAME=$(NAME)-server
VERSION=2.6.4
DOWNLOAD=http://redis.googlecode.com/files/redis-$(VERSION).tar.gz
TARBALL=$(NAME)-$(VERSION).tar.gz
TARDIR=$(NAME)-$(VERSION)
BUILD=$(PWD)/build
.PHONY: default
default: deb
.PHONY: clean
clean:
rm -f $(NAME)-* $(NAME)_* || true
rm -fr $(TARDIR) || true
rm -f *.deb
$(TARBALL):
wget "$(DOWNLOAD)"
$(TARDIR): $(TARBALL)
tar -zxf $(TARBALL)
cd $(TARDIR) ; make ; PREFIX=$(BUILD)/usr make install
$(BUILD)/etc/redis.conf: $(TARDIR)
mkdir -p $(BUILD)/etc/redis
cp -fp $(TARDIR)/redis.conf $(BUILD)/etc/redis
sed -i 's/daemonize no/daemonize yes/' $(BUILD)/etc/redis/redis.conf
$(BUILD)/var/lib/redis:
mkdir -p $(BUILD)/var/lib/redis
$(BUILD)/var/log/redis:
mkdir -p $(BUILD)/var/log/redis
$(BUILD): $(TARDIR) $(BUILD)/etc/redis.conf $(BUILD)/var/lib/redis $(BUILD)/var/log/redis
.PHONY: deb
deb: $(BUILD)
rm -f $(PACKAGE_NAME)*.deb
fakeroot fpm -s dir -t deb -v $(VERSION) -n $(PACKAGE_NAME) \
-p $(PACKAGE_NAME)_VERSION_ARCH-cc1.deb \
-d "libc6 (>= 2.7)" \
-a native -C $(BUILD) .
/var/log/redis/*.log {
weekly
missingok
copytruncate
rotate 12
compress
notifempty
}
# redis-server - Persistent key-value db
description "Redis server"
start on filesystem and net-device-up
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 007
expect fork
exec /usr/bin/redis-server /etc/redis/redis.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment