batsignal 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +2 -0
  2. data/bin/batsignal +62 -0
  3. metadata +64 -0
@@ -0,0 +1,2 @@
1
+ # Batsignal
2
+ ## By Ghostworks Systems
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+ # Welcome to Batsignal
3
+ require "rainbow" #pretty colours
4
+ require "redis" #everything needs redis
5
+ require "uri" #uri for redis parsing
6
+ require "beanstalk-client" #beeeeeeeaaaaaaannnnnnnnnnn
7
+ #require "right_aws" #sqs for dollybot integration
8
+ require "json" #for postmark
9
+ require "postmark" #postmark for super simple emails
10
+ require "mail" #mail gem
11
+ require "elapi" #electriclight
12
+
13
+ $hostname = `hostname -s`.chomp
14
+ $who = `whoami`.chomp
15
+ @redis = ENV['BATSIGNAL_REDIS'] || "redis://heroku:0d2a9b376cff35b857efb5da79ea7ddb@filefish.redistogo.com:9184/"
16
+ $email = ENV['BATSIGNAL_EMAIL'] || "orlyowlizere@gmail.com"
17
+ @beans = ENV['BATSIGNAL_BEANS'] || "173.255.224.122:9902"
18
+ @pmapi = ENV['BATSIGNAL_PMAPI'] || "df47a2d4-838c-45ce-a2de-268f9cb76e0e"
19
+ @sqsak = ENV['BATSIGNAL_SQSAK'] || "AKIAJS7XN34EXRZOSKIQ"
20
+ @sqssk = ENV['BATSIGNAL_SQSSK'] || "WlF+CzMRu5yzH3Yr+l94WEPxLQzB04YE3wdQpc1t"
21
+
22
+ uri = URI.parse(@redis)
23
+ redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
24
+
25
+ beanstalks = Array.new
26
+ beanstalks[0] = @beans
27
+
28
+ beanstalk = Beanstalk::Pool.new(beanstalks)
29
+
30
+ #sqs = RightAws::SqsGen2.new(@sqsak, @sqssk, { :logger => Logger.new('/dev/null')})
31
+ #queue = RightAws::SqsGen2::Queue.create(sqs, 'electriclight', true)
32
+
33
+ Postmark.api_key = @pmapi
34
+
35
+ @message = "The batsignal has been activated on #{$hostname}, do not expect SO"
36
+
37
+ #IRC
38
+ #queue.send_message(@message)
39
+
40
+ #EMAIL
41
+ message = Mail.new do
42
+ from "x@ghostworksmail.com"
43
+ to $email
44
+ subject "Batsignal activated on #{$hostname}"
45
+ body "#{$who} has activated the batsignal on #{$hostname}\nGrab your cape!"
46
+ end
47
+
48
+ message.delivery_method Mail::Postmark, {:api_key => @pmapi}
49
+ message.deliver
50
+
51
+
52
+ #WALL
53
+ beanstalk.put(@message)
54
+
55
+ #ELECTRICLIGHT
56
+ code = Electriclight.notify("#{@hostname}", "red", "freakshowfreakshow")
57
+
58
+ #OXYGEN
59
+ #oxygen needs to back up mc, mysql, mongodb, couchdb, beanstalk binfiles, redis:9184 and redis:9185
60
+
61
+ puts "the batsignal has successfully been activated\nplease wait whilst sysadmin puts on his cape".colour(:magenta).bright
62
+
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: batsignal
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ version: "0.3"
9
+ platform: ruby
10
+ authors:
11
+ - Luke Carpenter
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2011-01-21 00:00:00 +01:00
17
+ default_executable:
18
+ dependencies: []
19
+
20
+ description: Batsignal is a command written in Ruby to be used on a server which has a large number of distributed users
21
+ email: orlyowlizere@googlemail.com
22
+ executables:
23
+ - batsignal
24
+ extensions: []
25
+
26
+ extra_rdoc_files: []
27
+
28
+ files:
29
+ - README.md
30
+ - bin/batsignal
31
+ has_rdoc: true
32
+ homepage: http://ghostworksinc.com/
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.7
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Batsignal is an effective command for use on servers which have a large number of distributed users
63
+ test_files: []
64
+