Skip to content

Instantly share code, notes, and snippets.

View swalberg's full-sized avatar

Sean Walberg swalberg

View GitHub Profile
module MyApp
module Database
def connect(pool_size = nil, reap_time = nil)
return unless defined? ActiveRecord::Base
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = reap_time || ENV['AR_DB_REAP_FREQ'] || 10 # seconds
config['pool'] = pool_size || ENV['AR_DB_POOL'] || 5
ActiveRecord::Base.establish_connection(config)
end
@swalberg
swalberg / vmware_chef.md
Last active September 13, 2016 22:26
VMware and Chef Tools

VMware and Chef tools

Chef and VMware are a natural pairing and there are several tools available to enhance the integration.

Knife is a command-line tool that provides an interface between a local chef-repo and the Chef server and allows you to manipulate objects on the Chef server. Knife plugin allows your computer to talk to a 3rd party systems like vSphere or vRA. A plugin can create a VM in vSphere and then bootstrap it with Chef, for example, or it can expose your vRa catalog to your workstation so you don't need to use a GUI.

The following are the main interfaces with VMware and Chef our "knife" plugins.

@swalberg
swalberg / gist:1ad5de8235a204cc13bdc98601b537f3
Last active September 27, 2017 15:26 — forked from mattjbarlow/gist:242b66cdae6938d34419
Chef Shell in Test Kitchen
cd C:\Users\vagrant\AppData\local\Temp\kitchen
C:\opscode\chef\embedded\bin\gem install chef-zero
C:\opscode\chef\embedded\bin\chef-zero -d # or run this in another window with out -d
knife cookbook upload -a -c client.rb
C:\Users\vagrant\AppData\local\Temp\kitchen> knife cookbook upload -a -c client.rb -k .\client.pem -s http://localhost:8889 -o .
chef-shell -z -c client.rb -o '<YOUR RECIPE>'