Skip to content

Instantly share code, notes, and snippets.

@roblayton
roblayton / haproxy.cfg
Last active August 29, 2015 14:22
HAProxy config file for a MySQL cluster
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxy
defaults
log global
mode http
retries 3
@roblayton
roblayton / Vagrantfile
Last active August 29, 2015 14:22
A Vagrantfile for a MongoDB cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define :configsvr1 do |configsvr1|
@roblayton
roblayton / Vagrantfile
Created June 14, 2015 16:19
A Vagrantfile for a MongoDB Replica Set
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.define :primary do |primary|
@roblayton
roblayton / Vagrantfile
Created June 27, 2015 22:46
A Vagrant multi-machine cluster using a loop
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
cluster = {
"master" => { :ip => "192.168.33.10", :cpus => 1, :mem => 1024 },
"slave" => { :ip => "192.168.33.11", :cpus => 1, :mem => 1024 }
}
@roblayton
roblayton / Vagrantfile
Last active August 29, 2015 14:23
A Vagrant multi-machine cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: "apt-get update"
@roblayton
roblayton / hashgen.py
Created June 29, 2015 21:59
Generates a hashed password
# import the hash algorithm
from passlib.hash import sha256_crypt
# generate new salt, hash a password string
hash = sha256_crypt.encrypt("password")
print(hash)
@roblayton
roblayton / user-data
Last active August 29, 2015 14:24
An example cloud-config for CoreOS
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
# WARNING: replace each time you 'vagrant destroy'
discovery: https://discovery.etcd.io/c1b9507afe3f4f7c75430a138f5886c
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
etcd2:
@roblayton
roblayton / example.service
Created July 6, 2015 23:42
An example systemd service
[Unit]
Description="My Service"
[Service]
ExecStart=/usr/bin/printf "Service trigger"
[Install]
WantedBy=multi-user.target
@roblayton
roblayton / hello-01.service
Last active September 10, 2022 13:13
An example hello world service for Systemd
[Unit]
Description="Hello Service 01"
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill busybox1
ExecStartPre=-/usr/bin/docker rm busybox1
ExecStartPre=-/usr/bin/docker pull busybox
@roblayton
roblayton / nginx.service
Last active August 29, 2015 14:24
An example NGiNX service for Systemd
[Unit]
Description=nginx
Requires=docker.service
After=docker.service
[Service]
ExecStart=/usr/bin/docker run --name mynginx -p 8080:80 nginx
[Install]
WantedBy=multi-user.target