Skip to content

Instantly share code, notes, and snippets.

@atl
Created March 24, 2011 12:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atl/885000 to your computer and use it in GitHub Desktop.
Save atl/885000 to your computer and use it in GitHub Desktop.
HOWTO: compile and install redis on a no.de machine as of 2011-03-24
# First, we need a little extra effort to install GCC
pfexec pkg_add gcc44
export PATH="$PATH:/opt/local/gcc44/bin"
pkgin in binutils
# make and install
mkdir ~/sw
cd ~/sw
wget http://redis.googlecode.com/files/redis-2.2.2.tar.gz
gtar xvf redis-2.2.2.tar.gz
cd redis-2.2.2
gmake CC=gcc
pfexec gmake PREFIX=/opt/local install
# local configuration and service files
mkdir -p ~/local/log/redis
mkdir -p ~/local/share/redis
cd ~/local/share/redis
wget https://gist.github.com/raw/885000/redis.svc.xml
cp ~/sw/redis-2.2.2/redis.conf .
# Edit redis.conf how you like. This patch is set up how I
# like it, and includes changes that shouldn't collide with
# Joyent's pkgsrc version of redis. Note that the directories
# used are writable by the node user.
wget https://gist.github.com/raw/885000/redis.conf.diff
patch redis.conf redis.conf.diff
# import the service
svccfg import redis.svc.xml
svcs redis
# should be online!
# thread: http://discuss.joyent.com/viewtopic.php?pid=224258
17c17
< daemonize no
---
> daemonize yes
21c21
< pidfile /var/run/redis.pid
---
> pidfile /var/run/redis-node.pid
30c30
< # bind 127.0.0.1
---
> bind 127.0.0.1
47c47
< loglevel verbose
---
> loglevel notice
52c52
< logfile stdout
---
> logfile /home/node/local/log/redis/redis.log
85,87c85,87
< save 900 1
< save 300 10
< save 60 10000
---
> save 600 1
> save 180 10
> save 60 1000
106c106
< dir ./
---
> dir /home/node/local
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='application/redis' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default'/>
</dependency>
<dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<method_context>
<method_credential group='node' user='node'/>
</method_context>
<exec_method name='start' type='method' exec='/opt/local/bin/redis-server %{config_file}' timeout_seconds='60'/>
<exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
<property_group name='application' type='application'>
<propval name='config_file' type='astring' value='/home/node/local/share/redis/redis.conf'/>
</property_group>
<property_group name='startd' type='framework'>
<propval name='duration' type='astring' value='contract'/>
<propval name='ignore_error' type='astring' value='core,signal'/>
</property_group>
<stability value='Evolving'/>
<template>
<common_name>
<loctext xml:lang='C'>Redis server</loctext>
</common_name>
</template>
</service>
</service_bundle>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment