This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-add-repository ppa:vbernat/haproxy-1.5 | |
sudo apt-get update | |
sudo apt-get -qy install haproxy | |
sudo cp /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.orig | |
# To enable logging edit /etc/rsyslog.conf to match the following: | |
# | |
# provides UDP syslog reception | |
# $ModLoad imudp | |
# $UDPServerRun 514 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile for building a redis server | |
FROM ubuntu:15.04 | |
MAINTAINER Someone <someone@some.where> | |
# install and configure redis from source | |
RUN cd /home/root && \ | |
wget -q http://download.redis.io/redis-stable.tar.gz && \ | |
tar xvzf redis-stable.tar.gz && \ | |
cd redis-stable && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker stop $(sudo docker ps -a -q) | |
sudo docker rm $(sudo docker ps -a -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker rmi $(sudo docker images -a -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import redis | |
class RedisLogHandler(logging.Handler): | |
""" | |
Class used to emit log messages to a redis list | |
""" | |
def __init__(self, host, port, key, db=0, formatter=None, level=logging.NOTSET): | |
logging.Handler.__init__(self, level) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get rid of the version installed with ubuntu | |
sudo apt-get remove --auto-remove python-pip | |
# get the official installer | |
wget https://bootstrap.pypa.io/get-pip.py | |
# install it | |
sudo -H python get-pip.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name "*.pyc" -exec rm -rf {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Starts the elasticsearch node container, optionally setting | |
# a cluster name and host IP to expose to other nodes. Mounts | |
# the directory at /var/lib/elasticsearch to the same location | |
# on the host. | |
# | |
# exposes ports: | |
# 9200 = elasticsearch http | |
# 9300 = elasticsearch transport | |
# | |
IP="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import termios | |
import sys | |
import tty | |
def _getch(): | |
fd = sys.stdin.fileno() | |
old_settings = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
ch = sys.stdin.read(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By default the /usr/sbin/policy-rc.d script in the ubuntu:15.04 docker image is set to return 101 | |
# (action forbidden by policy) every time it is invoked. This prevents systemctl start requests for | |
# services from completing succesfully. The following command overwrites the contents of policy-rc.d | |
# to allow service starts. | |
# | |
# Note that this won't work right under bash due to expansion of the '!' character. Docker uses sh | |
# by default when executing the commands in the dockerfile, so this will work there, and you can | |
# also use sh interactively to run this. | |
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d |