apphunkd 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 rubyphunk
1
+ Copyright (c) 2009-10 Andreas Wolff
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -1,18 +1,34 @@
1
1
  = apphunkd
2
2
 
3
- Description goes here.
3
+ A daemon that acts as proxy between the apphunk gem and apphunk.com.
4
+ It collects messages from one or more apps, takes care that they don't get lost (e.g. apphunk.com is down) and sends them to the remote host.
5
+
6
+ == Setup
7
+
8
+ Apphunkd comes as a Gem:
9
+
10
+ gem install apphunkd
11
+
12
+ == Usage
13
+
14
+ You can start it by "hand" saying:
15
+
16
+ apphunkd start
17
+
18
+ However, apphunkd has init.d and monit scripts on board (see the support directory).
19
+ After copying the init script to /etc/init.d/ you can control the daemon with:
20
+
21
+ sudo /etc/init.d/apphunkd {start|stop|restart|status}
22
+
4
23
 
5
24
  == Note on Patches/Pull Requests
6
25
 
7
26
  * Fork the project.
8
27
  * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but
13
- bump version in a commit by itself I can ignore when I pull)
28
+ * Add specs for it. This is important so I don't break it in a future version unintentionally.
29
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
14
30
  * Send me a pull request. Bonus points for topic branches.
15
31
 
16
32
  == Copyright
17
33
 
18
- Copyright (c) 2009 rubyphunk. See LICENSE for details.
34
+ Copyright (c) 2009-10 Andreas Wolff. See LICENSE for details.
data/Rakefile CHANGED
@@ -20,6 +20,7 @@ begin
20
20
  gem.authors = ["Andreas Wolff"]
21
21
  gem.add_development_dependency "rspec", ">= 1.2.9"
22
22
  gem.add_development_dependency "yard", ">= 0"
23
+ gem.add_dependency "eventmachine", ">= 0"
23
24
  gem.add_dependency "sinatra", ">= 0.9.4"
24
25
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
25
26
  end
data/TODO CHANGED
@@ -1,2 +1 @@
1
- + Jeweler support
2
1
  + Monit: RAM Begrenzung
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.12.0
data/apphunkd.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{apphunkd}
8
- s.version = "0.11.1"
8
+ s.version = "0.12.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andreas Wolff"]
12
- s.date = %q{2010-01-15}
12
+ s.date = %q{2010-04-06}
13
13
  s.default_executable = %q{apphunkd}
14
14
  s.description = %q{
15
15
  Apphunkd is a ruby based daemon that runs on your application-servers and acts as local proxy between your apps and apphunk.com.
@@ -247,15 +247,18 @@ Gem::Specification.new do |s|
247
247
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
248
248
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
249
249
  s.add_development_dependency(%q<yard>, [">= 0"])
250
+ s.add_runtime_dependency(%q<eventmachine>, [">= 0"])
250
251
  s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
251
252
  else
252
253
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
253
254
  s.add_dependency(%q<yard>, [">= 0"])
255
+ s.add_dependency(%q<eventmachine>, [">= 0"])
254
256
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
255
257
  end
256
258
  else
257
259
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
258
260
  s.add_dependency(%q<yard>, [">= 0"])
261
+ s.add_dependency(%q<eventmachine>, [">= 0"])
259
262
  s.add_dependency(%q<sinatra>, [">= 0.9.4"])
260
263
  end
261
264
  end
@@ -12,7 +12,7 @@ DaemonKit::Initializer.run do |config|
12
12
  config.daemon_name = 'apphunkd'
13
13
 
14
14
  # Force the daemon to be killed after X seconds from asking it to
15
- # config.force_kill_wait = 30
15
+ config.force_kill_wait = 10
16
16
 
17
17
  # Log backraces when a thread/daemon dies (Recommended)
18
18
  # config.backtraces = true
@@ -1,2 +0,0 @@
1
- config.pid_file = '/tmp/apphunkd.pid'
2
- config.log_path = '/tmp/apphunkd.log'
@@ -1,2 +0,0 @@
1
- config.pid_file = '/var/run/apphunkd.pid'
2
- config.log_path = '/var/log/apphunkd.log'
@@ -24,7 +24,6 @@ module Apphunkd
24
24
  @items << message
25
25
  end
26
26
 
27
- @worker.wakeup
28
27
  return true
29
28
  end
30
29
 
@@ -32,7 +31,8 @@ module Apphunkd
32
31
  Thread.new do
33
32
  begin
34
33
  loop do
35
- unless @items.empty?
34
+ unless @items.empty? && @working
35
+ @working = true
36
36
  items = get_items_from_stack
37
37
  items.each do |item|
38
38
  result = push_item_to_remote_service(item)
@@ -52,7 +52,8 @@ module Apphunkd
52
52
  end
53
53
  end
54
54
  end
55
- sleep
55
+ @working = false
56
+ sleep 5
56
57
  end
57
58
  rescue => e
58
59
  log_error "Error: #{e}"
@@ -84,9 +85,9 @@ module Apphunkd
84
85
  def generate_api_messages_url(token)
85
86
  path = "v1/#{token}/messages"
86
87
  if DaemonKit.env.to_s == 'production'
87
- "http://postbox.apphunk.com/#{path}"
88
+ "http://api.apphunk.com/#{path}"
88
89
  else
89
- "http://postbox.apphunk.local/#{path}"
90
+ "http://localhost:3000/#{path}"
90
91
  end
91
92
  end
92
93
 
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,7 @@ rescue LoadError
6
6
  require 'spec'
7
7
  end
8
8
 
9
+ ENV['DAEMON_ENV'] = 'test'
9
10
  require File.dirname(__FILE__) + '/../config/environment'
10
11
  DaemonKit::Application.running!
11
12
 
@@ -7,12 +7,12 @@
7
7
 
8
8
  def start
9
9
  puts "Starting.."
10
- `apphunkd start -e production`
10
+ `apphunkd start -e production --log /var/log/apphunkd.log --pidfile /var/run/apphunkd.pid`
11
11
  end
12
12
 
13
13
  def stop
14
14
  puts "Stopping.."
15
- `apphunkd stop -e production`
15
+ `apphunkd stop -e production --log /var/log/apphunkd.log --pidfile /var/run/apphunkd.pid`
16
16
  end
17
17
 
18
18
  def restart
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apphunkd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Wolff
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-15 00:00:00 +01:00
12
+ date: 2010-04-06 00:00:00 +02:00
13
13
  default_executable: apphunkd
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,16 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: eventmachine
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
35
45
  - !ruby/object:Gem::Dependency
36
46
  name: sinatra
37
47
  type: :runtime