Skip to content

Instantly share code, notes, and snippets.

View bugcy013's full-sized avatar
🪄
Focusing

Dhanasekaran Anbalagan bugcy013

🪄
Focusing
View GitHub Profile

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

worker_processes 1;
user nobody nogroup;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log;
events {
worker_connections 64;
}
[program:gunicorn-graphite]
command=/usr/local/bin/gunicorn_django -u www-data -g www-data -b 127.0.0.1:8080 --log-file=/opt/graphite/storage/log/webapp/gunicorn.log /opt/graphite/webapp/graphite/settings.py
process_name=%(program_name)s
autostart=true
autorestart=true
stopsignal=QUIT
user=www-data
[program:carbon-cache]
command=python /opt/graphite/bin/carbon-cache.py --debug start
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
#!/bin/bash
sudo apt-get update
sudo apt-get -y install make libmysqlclient-dev x11-apps
wget http://www.rsyslog.com/files/download/rsyslog/rsyslog-4.6.1.tar.gz
tar xvf rsyslog-4.6.1.tar.gz
cd rsyslog-4.6.1
sudo mkdir /var/log/rsyslog # replace by your $WorkDirectory value, if any

What is Diamond?

https://github.com/BrightcoveOS/Diamond

From their wiki:

Diamond is a python daemon that collects system metrics and publishes them to Graphite. It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.

Deps

apt-get install build-essentials
apt-get install python-dev
output {
# <SNIP> other outputs <SNIP>
#
# Ping me if anything is about to explode, or if any important massage pass by
#
xmpp {
tags => 'warn_me'
host => "ejabberd.example.io"
message => "time='%{timestamp}', host='%{source_host}', tags='%{tags}',path='%{source_path}', type='%{type}', field='%{fields}' message='%{message}',"
#!/bin/bash
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$(lsb_release -c -s)/main/binary-amd64/Packages.bz2"
TIMEOUT=3
SAMPLES=3
# From http://derblub.com/human-readable-and-by-size-sorted-disk-usage-in-bash
function duf {
du -sk "$@" | sort -n | while read size fname; do for unit in k M G T P E Z Y; do if [ $size -lt 1024 ]; then echo -e "${size}${unit}\t${fname}"; break; fi; size=$((size/1024)); done; done
}
We couldn’t find that file to show.