htttee 0.5.0 → 0.6.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/.gitignore +1 -2
- data/.travis.yml +6 -0
- data/README.md +13 -1
- data/bin/htttee +2 -2
- data/bin/htttee-exec +8 -7
- data/config.ru +1 -1
- data/htttee.gemspec +4 -3
- data/lib/htttee/client.rb +4 -6
- data/lib/htttee/client/consumer.rb +38 -34
- data/lib/htttee/server.rb +45 -39
- data/lib/htttee/server/api.rb +155 -139
- data/lib/htttee/server/chunked_body.rb +13 -15
- data/lib/htttee/server/middleware/async_fixer.rb +12 -15
- data/lib/htttee/server/middleware/dechunker.rb +44 -45
- data/lib/htttee/server/middleware/rechunker.rb +15 -0
- data/lib/htttee/server/mock.rb +44 -46
- data/lib/htttee/server/pubsub_redis.rb +4 -0
- data/lib/htttee/server/sse/body.rb +71 -0
- data/lib/htttee/server/sse/middleware.rb +96 -0
- data/lib/htttee/version.rb +2 -4
- data/spec/client_spec.rb +102 -2
- data/spec/helpers/rackup.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- metadata +72 -46
- data/deploy/after_restart.rb +0 -1
- data/deploy/before_restart.rb +0 -4
- data/deploy/before_symlink.rb +0 -2
- data/deploy/cookbooks/cloudkick-plugins/recipes/default.rb +0 -8
- data/deploy/cookbooks/cloudkick-plugins/recipes/resque.rb +0 -18
- data/deploy/cookbooks/cloudkick-plugins/templates/default/resque.sh.erb +0 -4
- data/deploy/cookbooks/god/recipes/default.rb +0 -50
- data/deploy/cookbooks/god/templates/default/config.erb +0 -3
- data/deploy/cookbooks/god/templates/default/god-inittab.erb +0 -3
- data/deploy/cookbooks/main/attributes/owner_name.rb +0 -3
- data/deploy/cookbooks/main/attributes/recipes.rb +0 -1
- data/deploy/cookbooks/main/libraries/dnapi.rb +0 -7
- data/deploy/cookbooks/main/recipes/default.rb +0 -2
- data/deploy/cookbooks/nginx/files/default/chunkin-nginx-module-v0.22rc1.zip +0 -0
- data/deploy/cookbooks/nginx/files/default/nginx-1.0.0.tar.gz +0 -0
- data/deploy/cookbooks/nginx/recipes/default.rb +0 -2
- data/deploy/cookbooks/nginx/recipes/install.rb +0 -0
- data/deploy/cookbooks/nginx/templates/default/nginx.conf.erb +0 -41
- data/deploy/cookbooks/resque/recipes/default.rb +0 -47
- data/deploy/cookbooks/resque/templates/default/resque.rb.erb +0 -73
- data/deploy/cookbooks/resque/templates/default/resque.yml.erb +0 -3
- data/deploy/cookbooks/resque/templates/default/resque_scheduler.rb.erb +0 -73
- data/deploy/solo.rb +0 -7
@@ -1,50 +0,0 @@
|
|
1
|
-
execute "restart god" do
|
2
|
-
command <<-SRC
|
3
|
-
if pgrep god; then
|
4
|
-
god quit
|
5
|
-
fi
|
6
|
-
SRC
|
7
|
-
action :nothing
|
8
|
-
end
|
9
|
-
|
10
|
-
gem_package "god" do
|
11
|
-
version "0.11.0"
|
12
|
-
action :install
|
13
|
-
notifies :run, resources(:execute => "restart god")
|
14
|
-
end
|
15
|
-
|
16
|
-
directory "/etc/god" do
|
17
|
-
owner 'root'
|
18
|
-
group 'root'
|
19
|
-
mode 0755
|
20
|
-
recursive true
|
21
|
-
end
|
22
|
-
|
23
|
-
template "/etc/god/config" do
|
24
|
-
owner "root"
|
25
|
-
group "root"
|
26
|
-
mode 0644
|
27
|
-
source "config.erb"
|
28
|
-
end
|
29
|
-
|
30
|
-
execute "telinit q" do
|
31
|
-
command "telinit q"
|
32
|
-
action :nothing
|
33
|
-
end
|
34
|
-
|
35
|
-
template "/tmp/god-inittab" do
|
36
|
-
owner "root"
|
37
|
-
group "root"
|
38
|
-
mode 0644
|
39
|
-
source "god-inittab.erb"
|
40
|
-
end
|
41
|
-
|
42
|
-
execute "make init work with god" do
|
43
|
-
command "cat /tmp/god-inittab >>/etc/inittab"
|
44
|
-
not_if "grep '# god config' /etc/inittab"
|
45
|
-
notifies :run, resources(:execute => "telinit q")
|
46
|
-
end
|
47
|
-
|
48
|
-
file "/tmp/god-inittab" do
|
49
|
-
action :delete
|
50
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
recipes "main"
|
Binary file
|
Binary file
|
File without changes
|
@@ -1,41 +0,0 @@
|
|
1
|
-
user ey ey;
|
2
|
-
worker_processes 4;
|
3
|
-
pid /var/run/nginx.pid;
|
4
|
-
|
5
|
-
events {
|
6
|
-
worker_connections 8192;
|
7
|
-
use epoll;
|
8
|
-
}
|
9
|
-
|
10
|
-
http {
|
11
|
-
|
12
|
-
upstream thins {
|
13
|
-
server unix:/tmp/thin.sock;
|
14
|
-
}
|
15
|
-
|
16
|
-
access_log /var/log/foo.log;
|
17
|
-
error_log /var/bar.log debug;
|
18
|
-
|
19
|
-
server {
|
20
|
-
listen 80;
|
21
|
-
server_name *.amazonaws.com;
|
22
|
-
|
23
|
-
chunkin on;
|
24
|
-
proxy_buffering off;
|
25
|
-
chunked_transfer_encoding off;
|
26
|
-
|
27
|
-
location / {
|
28
|
-
proxy_pass http://thins;
|
29
|
-
proxy_set_header X-Real-IP $remote_addr;
|
30
|
-
proxy_buffering off;
|
31
|
-
#chunked_transfer_encoding on;
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
error_page 411 = @my_411_error;
|
36
|
-
location @my_411_error {
|
37
|
-
proxy_buffering off;
|
38
|
-
chunkin_resume;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
if node.engineyard.name == "resque" || node.engineyard.role == "solo"
|
2
|
-
require_recipe "god"
|
3
|
-
|
4
|
-
node[:applications].each do |app, data|
|
5
|
-
template "/etc/god/resque_#{app}.rb" do
|
6
|
-
owner "root"
|
7
|
-
group "root"
|
8
|
-
mode 0644
|
9
|
-
source "resque.rb.erb"
|
10
|
-
variables(
|
11
|
-
:app => app,
|
12
|
-
:app_root => "/data/#{app}/current",
|
13
|
-
:resque_workers_count => 4
|
14
|
-
)
|
15
|
-
notifies :run, resources(:execute => "restart god")
|
16
|
-
end
|
17
|
-
|
18
|
-
template "/etc/god/resque_scheduler_#{app}.rb" do
|
19
|
-
owner "root"
|
20
|
-
group "root"
|
21
|
-
mode 0644
|
22
|
-
source "resque_scheduler.rb.erb"
|
23
|
-
variables(
|
24
|
-
:app => app,
|
25
|
-
:app_root => "/data/#{app}/current",
|
26
|
-
:resque_workers_count => 1
|
27
|
-
)
|
28
|
-
notifies :run, resources(:execute => "restart god")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
if %w[solo app app_master util].include? node[:instance_role]
|
34
|
-
node[:applications].each do |app, data|
|
35
|
-
template "/data/#{app}/shared/config/resque.yml" do
|
36
|
-
owner node[:owner_name]
|
37
|
-
group node[:owner_name]
|
38
|
-
mode 0655
|
39
|
-
source "resque.yml.erb"
|
40
|
-
variables(
|
41
|
-
:framework_env => node.engineyard.environment.framework_env,
|
42
|
-
:redis_host => node.engineyard.environment.db_host,
|
43
|
-
:redis_port => 6379
|
44
|
-
)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
rack_env = "<%= @node[:environment][:framework_env] %>"
|
2
|
-
app_name = "<%= @app %>"
|
3
|
-
app_root = "<%= @app_root %>"
|
4
|
-
owner = "<%= @node[:owner_name] %>"
|
5
|
-
home = "/home/#{owner}"
|
6
|
-
instance_id = "<%= @node.engineyard.id %>"
|
7
|
-
|
8
|
-
<%= @resque_workers_count %>.times do |num|
|
9
|
-
inline = "#{home}/.ruby_inline/resque-#{app_name}-#{num}"
|
10
|
-
|
11
|
-
God.watch do |w|
|
12
|
-
w.name = "resque-#{app_name}-#{num}"
|
13
|
-
w.group = "resque-#{app_name}"
|
14
|
-
w.uid = owner
|
15
|
-
w.gid = owner
|
16
|
-
w.interval = 30.seconds
|
17
|
-
w.log = "#{app_root}/log/worker.#{num}.log"
|
18
|
-
w.dir = app_root
|
19
|
-
w.env = {
|
20
|
-
"USER" => owner,
|
21
|
-
"VERBOSE" => "true",
|
22
|
-
"INSTANCE_ID" => instance_id,
|
23
|
-
"GOD_WATCH" => w.name,
|
24
|
-
"RACK_ENV" => rack_env,
|
25
|
-
"HOME" => home,
|
26
|
-
"QUEUE" => "*",
|
27
|
-
}
|
28
|
-
|
29
|
-
w.start = "bundle exec rake --trace init resque:work"
|
30
|
-
|
31
|
-
w.behavior(:clean_pid_file)
|
32
|
-
|
33
|
-
w.start_grace = 2.minutes
|
34
|
-
w.restart_grace = 2.minutes
|
35
|
-
|
36
|
-
# retart if memory gets too high
|
37
|
-
w.transition(:up, :restart) do |on|
|
38
|
-
on.condition(:memory_usage) do |c|
|
39
|
-
c.above = 350.megabytes
|
40
|
-
c.times = 2
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# determine the state on startup
|
45
|
-
w.transition(:init, { true => :up, false => :start }) do |on|
|
46
|
-
on.condition(:process_running) do |c|
|
47
|
-
c.running = true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# determine when process has finished starting
|
52
|
-
w.transition([:start, :restart], :up) do |on|
|
53
|
-
on.condition(:process_running) do |c|
|
54
|
-
c.running = true
|
55
|
-
c.interval = 5.seconds
|
56
|
-
end
|
57
|
-
|
58
|
-
# failsafe
|
59
|
-
on.condition(:tries) do |c|
|
60
|
-
c.times = 5
|
61
|
-
c.transition = :start
|
62
|
-
c.interval = 5.seconds
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# start if process is not running
|
67
|
-
w.transition(:up, :start) do |on|
|
68
|
-
on.condition(:process_running) do |c|
|
69
|
-
c.running = false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
rack_env = "<%= @node[:environment][:framework_env] %>"
|
2
|
-
app_name = "<%= @app %>"
|
3
|
-
app_root = "<%= @app_root %>"
|
4
|
-
owner = "<%= @node[:owner_name] %>"
|
5
|
-
home = "/home/#{owner}"
|
6
|
-
instance_id = "<%= @node.engineyard.id %>"
|
7
|
-
|
8
|
-
<%= @resque_workers_count %>.times do |num|
|
9
|
-
inline = "#{home}/.ruby_inline/resque-#{app_name}-#{num}"
|
10
|
-
|
11
|
-
God.watch do |w|
|
12
|
-
w.name = "resque-scheduler-#{app_name}-#{num}"
|
13
|
-
w.group = "resque-#{app_name}"
|
14
|
-
w.uid = owner
|
15
|
-
w.gid = owner
|
16
|
-
w.interval = 30.seconds
|
17
|
-
w.log = "#{app_root}/log/worker-scheduler.#{num}.log"
|
18
|
-
w.dir = app_root
|
19
|
-
w.env = {
|
20
|
-
"USER" => owner,
|
21
|
-
"VERBOSE" => "true",
|
22
|
-
"INSTANCE_ID" => instance_id,
|
23
|
-
"GOD_WATCH" => w.name,
|
24
|
-
"RACK_ENV" => rack_env,
|
25
|
-
"HOME" => home,
|
26
|
-
"QUEUE" => "*",
|
27
|
-
}
|
28
|
-
|
29
|
-
w.start = "bundle exec rake --trace init resque:scheduler"
|
30
|
-
|
31
|
-
w.behavior(:clean_pid_file)
|
32
|
-
|
33
|
-
w.start_grace = 2.minutes
|
34
|
-
w.restart_grace = 2.minutes
|
35
|
-
|
36
|
-
# retart if memory gets too high
|
37
|
-
w.transition(:up, :restart) do |on|
|
38
|
-
on.condition(:memory_usage) do |c|
|
39
|
-
c.above = 350.megabytes
|
40
|
-
c.times = 2
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# determine the state on startup
|
45
|
-
w.transition(:init, { true => :up, false => :start }) do |on|
|
46
|
-
on.condition(:process_running) do |c|
|
47
|
-
c.running = true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# determine when process has finished starting
|
52
|
-
w.transition([:start, :restart], :up) do |on|
|
53
|
-
on.condition(:process_running) do |c|
|
54
|
-
c.running = true
|
55
|
-
c.interval = 5.seconds
|
56
|
-
end
|
57
|
-
|
58
|
-
# failsafe
|
59
|
-
on.condition(:tries) do |c|
|
60
|
-
c.times = 5
|
61
|
-
c.transition = :start
|
62
|
-
c.interval = 5.seconds
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# start if process is not running
|
67
|
-
w.transition(:up, :start) do |on|
|
68
|
-
on.condition(:process_running) do |c|
|
69
|
-
c.running = false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|