Project

hadouken

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
run commands over ssh in a way that makes sense for deploying artifacts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.4
>= 0
>= 0

Runtime

 Project Readme

hadouken - soon

running

./serviceie.rb --interactive \ 
             --level debug \
             --environment production \
             --history /opt/deploys   \
             --artifact https://artifacts/latest.tgz

serviceie.rb

Hadouken::Runner.run!
  plan      = Hadouken::Plan.new
  plan.name = "serviceie"
  plan.user = "serviceie"
  plan.base = "/opt/serviceie"

  # define some groups 10x10
  #
  plan.add_group :web, :range => (1..10), :pattern => 'serviceie-web-%02d.example.com'
  plan.add_group :api, :range => (1..10), :pattern => 'serviceie-api-%02d.example.com'


  # download latest.tgz from our artifact repository
  # runs in parallel on all hosts
  #
  plan.tasks.add Hadouken::Strategy::ByHost.new(plan)
  plan.tasks.add "curl -sSfL -output /tmp/latest.tgz #{artifact}"
  plan.tasks.add "mv /tmp/latest.tgz #{plan.base}/latest.tgz"


  # runs commands depth first on the api hosts, two at a time
  # - restart service
  # - verify  service
  #
  plan.tasks.add Hadouken::Strategy::ByHost.new(plan, :max_hosts => 2, :traversal => :depth)
  plan.tasks.add "restart serviceie-api", :group => :api
  plan.tasks.add Proc.new { |opts|
    host = opts[:host]
    10.times do
      response = Typheous::Request.get("http://#{host}:8081/healthcheck")
      break if response.status_code == 200
    end
  }, :group => :api

  
  # finally restart the webs as fast as possible
  #
  plan.tasks.add Hadouken::Strategy::ByHost.new(plan)
  plan.tasks.add "restart windard-web, :group => :web
end