Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DIY build radiators on Raspberry Pi

tektalks
November 17, 2013

DIY build radiators on Raspberry Pi

#DevOpsDays India 2013 : DIY build radiators on Raspberry Pi

tektalks

November 17, 2013
Tweet

More Decks by tektalks

Other Decks in Technology

Transcript

  1. Input - servers.yml - type: Snap url: https://snap-ci.com/secret/cctray.xml - type:

    Go username: user password: password url: https://example.com/cctray.xml
  2. Controller – application.rb require 'ci_status' require 'yaml’ def ci_servers @ci_servers

    ||= YAML::load(File.read('config/servers.yml')) end ci_servers.each do |ci_server| cc = CiStatus::CruiseControl.new(ci_server['url'], ci_server['username'], ci_server['password']) builds += cc.builds end
  3. Controller – application.rb require 'sinatra' require 'ci_status' require 'yaml’ def

    ci_servers @ci_servers ||= YAML::load(File.read('config/servers.yml')) end get '/' do builds = [] ci_servers.each do |ci_server| cc = CiStatus::CruiseControl.new(ci_server['url'], ci_server['username'], ci_server['password']) builds += cc.builds end @failed_builds, @success_builds = builds.partition { |build| build.failure? } erb ’builds.html'.to_sym end
  4. View – builds.html.erb <html> <head> </head> <ul class="builds"> <% @failed_builds.each

    do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> <% @success_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> </ul> <html>
  5. View – builds.html.erb <html> <head> <script> window.setTimeout(function() { window.location.reload(true); },

    10000); </script> </head> <ul class="builds"> <% @failed_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> <% @success_builds.each do |build| %> <li class="build <%= build.status.downcase %>"> <span class="name"><%= build.name %></span> </li> <% end %> </ul> <html>
  6. Deploy to your pi $ git clone your-build-radiator-repo.git $ bundle

    install $ bundle exec rackup Open your browser on the pi and navigate to localhost:9292
  7. Advantages • Get fast feedback for your builds • Save

    money • Save electricity • Its cool! 