Skip to content

Instantly share code, notes, and snippets.

@atl
Created March 24, 2011 12:49

Revisions

  1. atl revised this gist Mar 25, 2011. 1 changed file with 10 additions and 8 deletions.
    18 changes: 10 additions & 8 deletions instructions
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,9 @@ pkgin in binutils
    # make and install
    mkdir ~/sw
    cd ~/sw
    wget https://github.com/antirez/redis/tarball/2.2.2
    gtar xvf antirez-redis-2.2.2-0-g048c0f0.tar.gz
    cd antirez-redis-b96f325/
    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

    @@ -18,15 +18,17 @@ mkdir -p ~/local/share/redis
    cd ~/local/share/redis
    wget https://gist.github.com/raw/885000/redis.svc.xml

    cp ~/sw/antirez-redis-b96f325/redis.conf .
    # Edit redis.conf how you like. This patch is set up how I like it,
    # but includes changes that don't collide with Joyent's pkgsrc
    # version of redis. Note that the directories used are writable
    # by the node user.
    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
  2. atl revised this gist Mar 25, 2011. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions instructions
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,11 @@
    # First, we need a little extra effort to install GCC
    mkdir ~/sw
    cd ~/sw
    wget http://pkgsrc.joyent.com/2010Q3/All/gcc44-4.4.4nb1.tgz
    pfexec pkg_add gcc44-4.4.4nb1.tgz
    pfexec pkg_add gcc44
    export PATH="$PATH:/opt/local/gcc44/bin"
    pkgin in binutils

    # make and install
    mkdir ~/sw
    cd ~/sw
    wget https://github.com/antirez/redis/tarball/2.2.2
    gtar xvf antirez-redis-2.2.2-0-g048c0f0.tar.gz
    cd antirez-redis-b96f325/
  3. atl renamed this gist Mar 24, 2011. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. atl revised this gist Mar 24, 2011. 1 changed file with 24 additions and 2 deletions.
    26 changes: 24 additions & 2 deletions gistfile1.eclass
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,33 @@
    # First, we need a little extra effort to install GCC
    mkdir ~/sw
    cd ~/sw
    wget http://pkgsrc.joyent.com/2010Q3/All/gcc44-4.4.4nb1.tgz
    pfexec pkg_add gcc44-4.4.4nb1.tgz
    export PATH="$PATH:/opt/local/gcc44/bin"
    pkgin in binutils
    wget --no-check-certificate https://github.com/antirez/redis/tarball/2.2.2

    # make and install
    wget https://github.com/antirez/redis/tarball/2.2.2
    gtar xvf antirez-redis-2.2.2-0-g048c0f0.tar.gz
    cd antirez-redis-b96f325/
    CC=gcc gmake
    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/antirez-redis-b96f325/redis.conf .
    # Edit redis.conf how you like. This patch is set up how I like it,
    # but includes changes that don'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!
  5. atl revised this gist Mar 24, 2011. 1 changed file with 32 additions and 0 deletions.
    32 changes: 32 additions & 0 deletions redis.conf.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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
  6. atl revised this gist Mar 24, 2011. 1 changed file with 32 additions and 0 deletions.
    32 changes: 32 additions & 0 deletions redis.svc.xml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    <?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>
  7. atl created this gist Mar 24, 2011.
    11 changes: 11 additions & 0 deletions gistfile1.eclass
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    mkdir ~/sw
    cd ~/sw
    wget http://pkgsrc.joyent.com/2010Q3/All/gcc44-4.4.4nb1.tgz
    pfexec pkg_add gcc44-4.4.4nb1.tgz
    export PATH="$PATH:/opt/local/gcc44/bin"
    pkgin in binutils
    wget --no-check-certificate https://github.com/antirez/redis/tarball/2.2.2
    gtar xvf antirez-redis-2.2.2-0-g048c0f0.tar.gz
    cd antirez-redis-b96f325/
    CC=gcc gmake
    pfexec gmake PREFIX=/opt/local install