Skip to content

Instantly share code, notes, and snippets.

View ranjib's full-sized avatar
🥁
having fun

Ranjib Dey ranjib

🥁
having fun
View GitHub Profile
@ranjib
ranjib / Chef12-Feature-Votes.md
Last active December 28, 2015 07:28
Chef Summit - 3 - Chef 12 Feature Votes #opschef
a) Version everything (roles, environments, data bags)
b) Chef server also to act as omnitruck package repository
c) Ruby 2.0
d) attribute level debugging
e) API generate audit trail
f) Resources for managing containers
g) Fix json
h) GC for chef server objects
i) knife-cloud plugin refactor

j) Semver support for cookbook versions

@ranjib
ranjib / cass.yaml.erb
Created October 18, 2013 06:26
Create cassandra using jugaad
cluster_name: 'jugaad'
num_tokens: 256
hinted_handoff_enabled: true
max_hint_window_in_ms: 10800000 # 3 hours
hinted_handoff_throttle_in_kb: 1024
max_hints_delivery_threads: 2
authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer
permissions_validity_in_ms: 2000
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
template "/etc/sysconfig/iptables" do
extend Helper
source "chef_iptables_ruleset.erb"
owner = "root"
mode "0600"
variables(
:static_inbound => static_inbound_ruleset,
:dynamic_inbound => dynamic_inbound_ruleset,
:static_outbound => static_outbound_ruleset,
:dynamic_outbound => dynamic_outbound_ruleset
@ranjib
ranjib / zk_cjeck.py
Created September 11, 2013 22:55
Check Zookeeper
import sys
import telnetlib
import re
hosts = [ 'zk06.pd-internal.com', 'zk07.pd-internal.com', 'zk08.pd-internal.com',
'zk10.pd-internal.com', 'zk11.pd-internal.com' ]
leaders = {}
followers = {}
standalone = {}
@ranjib
ranjib / omnibus_creator.rb
Last active December 22, 2015 20:59
Create your omnibus installers using lxc & Chef
require 'lxc'
require 'lxc/extension'
# In this gist, we'll spawn an lxc container, use the lxc-chef/ssh extensions to install chef & omnibus
# then we'll drop our omnibus dummy definition , then build the omnibus installer
# then finally we'll copy over the resulting debian on the host box, and destroy the whole container
# you can create a rpm by spawning a centos/fedora container
LXC.use_sudo = true
vm = LXC::Container.new('omnibus-creator')
@ranjib
ranjib / chef_server_lxc.rb
Created September 11, 2013 03:57
How to kill a chef server
#
# Tested on
# fedora19 (kernel 3.10.10-200.fc19.x86_64) ,
# ruby 2 (rbenv), chef > 11.4 , lxc-0.9.0-2.fc21.x86_64) (rawhide)
# comes from lxc-ruby
require 'lxc'
# monkey patches that i introduced
# f19 specific bugfix
# [core] container.ipv4
@ranjib
ranjib / gvm_apply.rb
Last active December 22, 2015 17:09
gvm installation
package "build-essential"
package "mercurial"
package "bison"
package "curl"
package "git"
execute "install_gvm" do
user "ubuntu"
cwd "/home/ubuntu"
@ranjib
ranjib / rbenv_apply.rb
Created September 10, 2013 02:21
rbenv installation
package "build-essential"
package "curl"
package "libssl-dev"
package "git"
@ranjib
ranjib / chef_server_spec.rb
Created September 9, 2013 17:04
test chef server provisioning
require 'lxc'
require 'mixlib/shellout'
require 'lxc/extension.rb'
describe "Chef Server installation" do
let(:chef_server) do
c = LXC::Container.new('chef-server')
c.ssh_user = 'ubuntu'
@ranjib
ranjib / chef_server_apply.rb
Last active December 22, 2015 10:28
Install chef server via chef apply
remote_file '/opt/chef-server.deb' do
source 'https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.8-1.ubuntu.12.04_amd64.deb'
not_if {File.exists?('/opt/chef-server.deb')}
end
dpkg_package 'chef-server' do
source '/opt/chef-server.deb'
action :install
end