Skip to content

Instantly share code, notes, and snippets.

View gswallow's full-sized avatar

Greg Swallow gswallow

  • Indianapolis, IN, USA
View GitHub Profile
server {
listen 443;
server_name customerold.ourplatform.net;
...
location / {
proxy_set_header Host customer.ourplatform.net;
proxy_pass http://upstream_application;
proxy_redirect http://customer.ourplatform.net https://customerold.ourplatform.net;
}
@gswallow
gswallow / fucko.rb
Last active August 29, 2015 14:09
Get the current MongoDB oplog time
#!/usr/bin/env ruby
require 'mongo'
require 'orderedhash'
include Mongo
c = MongoClient.new('localhost').db('admin')
def getReplSetStatus(c)
cmd = OrderedHash.new
@gswallow
gswallow / checkpointtime.rb
Created November 25, 2014 16:55
Get TokuMX Checkpoint times and bytes written
#!/usr/bin/env ruby
require 'mongo'
include Mongo
c = MongoClient.new('localhost')
last_lb = 0
last_nlb = 0
@gswallow
gswallow / mongodb_logrotate.rb
Last active August 29, 2015 14:10
mongodb log rotation with chef
logrotate_app node['mongodb']['instance_name'] do
frequency 'daily'
cookbook 'logrotate'
options ['compress', 'dateext', 'missingok', 'notifempty', 'copytruncate']
path node['mongodb']['config']['logpath']
sharedscripts true
postrotate %Q!kill -USR1 `cat #{['mongodb']['config']['pidfilepath']} 2> /dev/null` 2> /dev/null || true\nfind `dirname #{node['mongodb']['config']['logpath']}` -type f -regex ".*\\.\\(log.[0-9].*-[0-9].*\\)" -exec rm {} \\; 2> /dev/null || true!
rotate 30
end
# Description
# Grab a Glenn Danzig image.
#
# Dependencies:
# None
#
# Configuration:
# None
#
{ "run_list": [ "role[base]", "role[tokumx_hidden]" ],
"aws": {
"raid": {
"size": 2000,
"disk_type": "gp2",
"piops_ratio": 0,
"count": 8,
"snapshots": [ "snap-xxx1", "snap-xxx2", "snap-xxx3", "snap-xxx4", "snap-xxx5", "snap-xxx6", "snap-xxx7", "snap-xxx8" ]
}
}
"BucketPolicy": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"PolicyDocument": {
"Version": "2008-10-17",
"Id": "ReadPolicy",
"Statement": [{
"Sid": "ReadAccess",
"Action": [ "s3:GetObject" ],
"Effect": "Allow",
@gswallow
gswallow / windows_agent.rb
Last active August 29, 2015 14:13
Crude chef recipe to install logstash 1.4.2 on Windows
#
# Cookbook Name:: logstash
# Recipe:: windows_agent
#
#
include_recipe "chocolatey"
%w( javaruntime NSSM logstash ).each do |p|
chocolatey p do
global
log 127.0.0.1 local0 warning
log 127.0.0.1 local1 notice
maxconn 2000
user haproxy
group haproxy
defaults
timeout client 10s
timeout server 10s
timeout connect 10s
# TODO: figure out how to refer to the nat instance when creating
# the elastic ip
dynamic!(:nat_instance, 'indigo', :nat_instance_type => ref!(:nat_instance_type), :ssh_key_name => ref!(:ssh_key_name))
dynamic!(:elastic_ip, 'indigo_nat', :instance => ref!(:indigo_nat_instance))