Files
trove/integration/scripts/files/elements/ubuntu-redis/install.d/30-redis
Amrith Kumar 48f4fa52f9 Fix Gate: Force pip2 instead of pip
Something appears to have caused the xenial guests to install all
python libraries into python 3.5 directories and therefore the guest
won't launch. This change forces pip2 and in theory should get around
that.

Moved Redis and PostgreSQL installs after the trove-dep ones.

Change-Id: I3bbe3bafa7ea3e627272103ac16a38f6a32a8a06
Partial-Bug: #1650382
2016-12-16 06:14:10 -05:00

54 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Install controller base required packages
set -ex
export DEBIAN_FRONTEND=noninteractive
cat > "/etc/sysctl.d/10-redis-performance.conf" << _EOF_
# See 'http://redis.io/topics/admin' for best practices.
# Make sure to set the Linux kernel overcommit memory setting to 1.
vm.overcommit_memory=1
# Linux kernel will silently truncate 'tcp-backlog' to the value of
# '/proc/sys/net/core/somaxconn' so make sure to raise both the value of
# 'somaxconn' and 'tcp_max_syn_backlog' in order to get the desired effect.
net.ipv4.tcp_max_syn_backlog=1024
net.core.somaxconn=1024
_EOF_
cat > "/etc/rc.local" << _EOF_
# Make sure to disable Linux kernel feature transparent huge pages,
# it will affect greatly both memory usage and latency in a negative way.
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
_EOF_
add-apt-repository -y ppa:chris-lea/redis-server
apt-get -y update
apt-get install -y redis-server
cat > "/etc/default/redis-server" << _EOF_
# Call ulimit -n with this argument prior to invoking Redis itself.
# This may be required for high-concurrency environments. Redis itself cannot
# alter its limits as it is not being run as root.
ULIMIT=65536
_EOF_
# Install Python driver for Redis ('redis-py').
pip2 install redis
# By default, redis-py will attempt to use the HiredisParser if installed.
# Using Hiredis can provide up to a 10x speed improvement in parsing responses
# from the Redis server.
pip2 install hiredis