Charm: oneiric/redis-master   Revision: 2   Hook: install
#!/bin/bash
# Here do anything needed to install the service
# i.e. apt-get install -y foo  or  bzr branch http://myserver/mycode /srv/webroot

############################################################################################################
# Set debugging
############################################################################################################

set -ux


############################################################################################################
# Install the redis-server package
############################################################################################################

apt-get install -y redis-server


############################################################################################################
# Set some variables
############################################################################################################

MY_HOSTNAME=`hostname -f`


############################################################################################################
# Modify the redis-server configuration file
############################################################################################################

sed -i.bak -e "s/bind 127.0.0.1/bind ${MY_HOSTNAME}/" /etc/redis/redis.conf


############################################################################################################
# Open the necessary ports
############################################################################################################

[ -x /usr/bin/open-port ] && open-port 6379/TCP