Donovan Bray
Ruby Developer and Gearhead
Posts
\
Mater's back from the shop.
Dear Cruisers, Thanks for an awesome cruise this year! We outdid ourselves with 20 cars this year compared to 8 last year. Please mark your calender for the second Saturday in June, 2012, and plan on joining us again. I am still going through all of the photo's we took. If you have some noteworthy shots you'd like to share please forward them so I can share them with the group. I plan on sending an album out by next weekend. A special THANK YOU goes out to the following sponsors for helping to make this event fun for all, opening up your parking lots and businesses and for filling us up on coffee and donuts: GM Sport Salvage Kassabian Motors A big HUGE THANK YOU to the car show coordinators and the Kiwanis Club of Modesto for allowing us to park our precious Trans Ams in a secure area! We all really appreciate that and your event was outstanding as usual!!!
(AKA Jose)
|
I was recently trying to do some tricky start and stop commands with Monit http://mmonit.com/monit/. Unfortunately while Monit itself can log to syslog, it doesn't output anything from attempts to start and stop the applications.
The stripped down environment that Monit spawns can be problematic and getting it to cough up whats wrong can be frustrating.
Based off of an answer to a similar question on stack overflow http://stackoverflow.com/questions/3356476/debugging-monit by billitch I think I came up with a good way to keep tabs on whats happening inside those Monit start and stop commands. A wrapper script pipes both standard output and error to syslog.
I created two shell scripts in /etc/monit, one for full debugging, and one for minimal extra output and ongoing use just in case a problem crops up, you can check your syslog and see what bad thing went down.
My original scripts also preserved the exit code of the command under test but apparently Monit doesn't give a whit about what the command exited as; so I've presented the simpler script here.
/etc/monit/modebug
#!/bin/sh
{
echo "MONIT-WRAPPER date"
date
echo "MONIT-WRAPPER env"
env
echo "MONIT-WRAPPER $@"
$@
R=$?
echo "MONIT-WRAPPER exit code $R"
} 2>&1 | logger/etc/monit/morun
#!/bin/sh
{
echo "MONIT-WRAPPER $@"
$@
R=$?
echo "MONIT-WRAPPER exit code $R"
} 2>&1 | logger This is an example Monit script, showing execution of both scripts.
/etc/monit/conf.d/dk-filter.monit
check process dk-filter with pidfile /var/run/dk-filter/dk-filter.pid
group mail
start program = "/etc/monit/modebug /etc/init.d/dk-filter start"
stop program = "/etc/monit/morun /etc/init.d/dk-filter stop"
if 5 restarts within 5 cycles then timeout
if failed unixsocket /var/run/dk-filter/dk-filter.sock then restarter.sock then restart When I purchased the Bluebird a 1973 Firebird 350, it had some after-market items in it that were no longer functioning.
The 1957 Chevy 6100 Wrecker is home. Thanks to Ray, and R. Lance and Sons Towing. http://rlanceandsons.com/
The Bay Area Firebirds (BAFGFB) group organized a cruise up to the Muscle Cars in the Park 2010 show in Elk Grove, CA.
I've recently been working on updating a set of Ruby applications and converting all of the gem dependencies to use Bundler (gembundler.com)
I've added to my optimized Capistrano Bundler tasks to include handling the prequisite rubygems version and providing a number of customization parameters.
Bundler 1.0 now includes a basic "bundle:install" Capistrano script http://github.com/carlhuda/bundler/blob/master/lib/bundler/capistrano.rb, but since mine covers a bit more ground than the default one I'm continuing to build my scripts around the following Bundler tasks.
Capistrano::Configuration.instance(:must_exist).load do
desc "Add deploy hooks to invoke bundler:install"
task :acts_as_bundled do
after "deploy:rollback:revision", "bundler:install"
after "deploy:update_code", "bundler:install"
after "deploy:setup", "bundler:setup"
end
namespace :bundler do
set :bundler_ver, '1.0.0.rc.5'
set :bundler_opts, %w(--deployment --no-color --quiet)
set(:bundler_exec) { ruby_enterprise_path + "/bin/bundle" }
set(:bundler_dir) { "#{shared_path}/bundle" }
set :bundler_rubygems_ver, '1.3.7'
set(:bundler_user) { apache_run_user }
set :bundler_file, "Gemfile"
desc "Update Rubygems to be compatible with bundler"
task :update_rubygems, :except => { :no_release => true } do
gem_ver = capture("gem --version").chomp
if gem_ver < bundler_rubygems_ver
logger.important "RubyGems needs to be udpated, has gem --version #{gem_ver}"
gem2.update_system
end
end
desc "Setup system to use bundler"
task :setup, :except => { :no_release => true } do
bundler.update_rubygems
gem2.install_only "bundler", bundler_ver
end
desc "bundle the release"
task :install, :except => { :no_release => true } do
bundler.setup
#Don't bother if there's no gemfile.
#optionally do it as a specific user to avoid permissions problems
#do as much as possible in a single 'run' for speed.
args = bundler_opts
args << "--path #{bundler_dir}" unless bundler_dir.to_s.empty? || bundler_opts.include?("--system")
args << "--gemfile=#{bundler_file}" unless bundler_file == "Gemfile"
cmd = "cd #{latest_release}; if [ -f #{bundler_file} ]; then #{bundler_exec} install #{args.join(' ')}; fi"
cmd = "sudo -u #{bundler_user} sh -c '#{cmd}'" if bundler_user and not bundler_user.empty?
run cmd
on_rollback do
if previous_release
cmd = "cd #{previous_release}; if [ -f #{bundler_file} ]; then #{bundler_exec} install #{args.join(' ')}; fi"
cmd = "sudo -u #{bundler_user} sh -c '#{cmd}'" if bundler_user and not bundler_user.empty?
run cmd
else
logger.important "no previous release to rollback to, rollback of bundler:install skipped"
end
end
end
end
end
This code uses some other dependencies that I use throughout my Capistrano scripts, namely the customized Gem2 plugin from vmbuilder_plugins. This following code necessary to monkey-patch the Gem2 plugin, which is bundled with Mike Bailey's deprec project http://github.com/mbailey/deprec/blob/master/lib/vmbuilder_plugins/gem.rb
module Gem
GEM_UNINSTALL= "gem uninstall --ignore-dependencies --executables"
def install_only(package, version=nil)
tries = 3
begin
cmd = "if ! gem list | grep --silent -e '#{package}.*#{version}'; then gem uninstall --ignore-dependencies --executables --all #{package}; #{GEM_INSTALL} #{if version then '-v '+version.to_s end} #{package}; fi"
send(run_method,cmd)
rescue Capistrano::Error
tries -= 1
retry if tries > 0
end
end
# uninstalls the gems detailed in +package+, selecting version +version+ if
# specified, otherwise all.
#
#
def uninstall(package, version=nil)
cmd = "#{GEM_UNINSTALL} #{if version then '-v '+version.to_s else '--all' end} #{package}"
wrapped_cmd = "if gem list | grep --silent -e '#{package}.*#{version}'; then #{cmd}; fi"
send(run_method,wrapped_cmd)
end
end
Unlike many examples of Capistrano deploy scripts which are kept inside the app root of the application they deploy, my deploy scripts are kept in their own repository, and they were built to contain all of the "institutional knowledge" of how to interact with all of our server farms and applications. There is a lot of shared code that would have to be duplicated if I were to try to break the deploy scripts apart, and store them with each application. There would also be a lot of tasks that don't make sense to live in only one application, some wouldn't have a home in any application. I've found a couple of patterns that make it easier to hook and unhook code into the main deploy processes, which I may touch on in other posts.
One of the techniques which is used in the bundler tasks is to separate out the callback hooks into their own top level task. This allows me to not have to remember all of bundlers individual hooks, I can easily add them to any application that needs them, and omit them from applications that don't. A second technique that I use is to control the task chains. I learned early on that you want to be able to call individual tasks for maintenance and not inadvertently trigger a long series of chained tasks.
This is an example of what you might see in one of my application deploy scripts:
on :start, :only => ["deploy","deploy:setup","deploy:migrations","deploy:cold"] do
acts_as_bundled
before "deploy:update_code", "deploy:clear_release_path","deploy:setup_dirs"
after "deploy:update_code", "deploy:authentication", "git:track", "scalr:on_boot_finish", "git:config", "scalr:on_hostup"
after "deploy:symlink", "deploy:cleanup"
end
Notice the acts_as_bundled acts as a nice declarative way to invoke bundlers callback assignments, and that they are only invoked if one of the top level tasks matches the :only clause.
So for example I can do a command like
cap deploy:symlink
Without causing "deploy:cleanup" to be executed. But when I do:
cap deploy
It will.
The raceway and Wednesday Night Drags crew would also like to remember long-time racer and friend, "Mr. Pontiac" Pete Aljian. Pete passed away on May 22, following complications after a stroke. He was 71.
We’ll all remember the great pride Pete took in his all-steel, mid-nine-second, blue 1955 Pontiac, which he built and drove, and was later driven by Bob Van Poppering and John Tobias. As a tribute to Pete, his fellow ICRA (Island Cities Racing Assoc.) club members will be racing this weekend in his honor. Please keep Pete and his family and friends in your thoughts and prayers.
A couple weeks ago I took the suburban to get it washed, and a little spot of paint that had chipped off, turned into a big chunk of paint that went MIA.
Updates
-
Less marketing douchebaggery! http://t.co/hETKtaSY
-
SIZE MATTERS - Semi Truck Drift Gymkhana Feature http://t.co/h19zXESU
-
RT @zenbullets: I now possess an iPad3, but still feeling empty and hollow inside. Am I holding it correctly? Something in settings?
-
@cypriss sometimes it takes time to filter down to me.
-
Intelligence, Obsession, and Social Ineptitude Venn Diagram: http://t.co/3IaQ1f48
-
The Derelicts a short film by eGarage http://t.co/gzVdWt5w
-
You Should Use EBS Boot Instances on Amazon EC2 http://t.co/NFFszWtu
-
Jake Archibald's talk at DIBI Conference 2011 http://t.co/ht0JhqXx, most entertaining talk about web-fonts I've ever heard.
-
RT @JamilSmith: Just in case it wasn't clear, Vast Majority of America: you're the dude holding the chair. http://t.co/ByathXYV
-
Beware technology, kids!! http://t.co/odo5V8lx (via @petershankman)
-
If you have a problem, and think 'I'll add a load-balancer.' Now you have four problems.
-
@secos This has piqued my curiosity, I tested both perhaps our tests are not equiv: https://t.co/98GZOmWW
-
@secos 'rescue was not allowed inside a block' there must be more to the story, I just did a quick test and it worked as expected.
-
@brynary twitter certainly can't find a lot of links lately; what is the real link for your Godaddy post?
-
@jf I would remove 'e' because there are so many confusing rules around it, before or after c except, blah blah blah.
-
Nobody's bothered by bad software that doesn't work. It's simply discarded. The truly frustrating is good software that you can't use.
-
I'm looking for a replacement for serverdensity, we already use and like pingdom & newrelic, and need something better than hosted nagios
-
@cypriss re: http://t.co/bUsxSJBJ whats your biggest take-away so far?
Updates
Profile
Summary
Experience
- Aug 2011 - PresentPrincipal Systems Engineer / Rearden Commerce
- 2011 - PresentSystem Operations Engineer / HomeRun (homerun.com)
- Apr 2008 - PresentSenior Developer / WorkingPointWorkingPoint, formerly NetBooks, is an online small business accounting software platform. Developed extensive Capistrano scripts that prepared and maintained virtual server instances on EC2, managed by SCALR. Configured the production environment, Nginx Load Balancers, Apache - Passenger Application Servers, Memcache servers, Mysql servers. Setup the continuous integration system. Maintained all of the local support systems. Developed and executed full stack stress tests utilizing Jmeter. Developed back-end and front-end features for WorkingPoint which utilized Ruby 1.87, Rails 2.3, Mysql, and DelayedJobs Built a test framework with Cucumber and Selenium to execute browser based tests utilizing SauceLabs hosted Selenium RC clients, with the artifacts collected for review as part of our continuous integration system. In charge of merging and handling all production deployments.
- Apr 2003 - PresentNetwork Supervisor / Edmonds School DistrictDirected 5 full time technicians Managed telecommunications, networks, and servers. Network Designer, Project Estimator, Project Management Designed and implemented network infrastructure for 40 building MAN utilizing a meshed Gigabit fiber backbone. Replaced the entire Districts 40 location LANs providing 10/100 switched Ethernet to the desktop with a Gigabit fiber backbone. Replaced 3000 node Nortel Meridian TDM phone system with a fault tolerant Cisco Unified Voice over IP phone system. Designed and installed a comprehensive secure wireless network across the District’s 40 locations utilizing Cisco Autonomous Wireless access points providing 802.1x authentication to Active Directory with WLSE management. Authored an application to sync Student Information from the SKYWARD Student Records System to create Active Directory Accounts for the Districts 20K+ students. Authored a number of parsing scripts to convert Nortel Meridian exports to be useable database entries for the Cisco Unified Voice conversion. Authored a number of scripts to extract and share data between disparate systems.
- Jan 2004 - PresentDeveloper / Coppermine Gallery Development TeamInitial focus was rewriting existing HTML themes to be XHTML Compliant. Redesigned the theme infrastructure in the core code to allow simplified theme creation and ongoing maintenance. Created documentation for theme upgrades from 1.3 to 1.4 for end users. Extend and support the plug-in system in the core code. Numerous bug fixes, security improvements, and new features.
- Jan 2000 - PresentCuesta College Supervisor of Network and PC Technicians / Cuesta CollegeDirected 8 full time technicians and 5 hourly technicians Network Designer, Project Estimator, Project Management Network Security Audits Designed network infrastructure for 5 new buildings. (3 Built, 2 In Construction, 2 on deck) Designed and implemented upgrade to redundant Layer 3 Switched Gigabit Ethernet Backbone Designed and implemented the campus 2TB FC SAN Designed and implemented Windows 2000 Server Clusters on the SAN Designed and implemented policies to address Security and Patching
- Jan 1995 - PresentCuesta College Network Administrator / Cuesta CollegeDesigned and implemented the 2 campus LAN/WAN 1 Pix Firewall 2 Cisco 7206 Routers 50+ Cisco Switches (1924 and 5500) 13 Novell Servers 8 NT Servers 2 Clusters of Windows 2000 Advanced Servers with Citrix Microsoft Exchange Server 14 computer Labs (Hardware and Software) Technical support for college faculty and staff Supervision of employees in the network department
- Jan 1990 - PresentStore Manager / Witco ComputersStore Manager, Service Manager, Sales Manager, Sales Associate, Service Technician. Managed a staff of 10 people. Managed Internal Network Responded to Network Service Calls Designed and Sold Networks and PC’s Repaired PC’s.