san_juan 0.0.4
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/README.textile +136 -0
- data/lib/san_juan.rb +100 -0
- metadata +65 -0
data/README.textile
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
h2. Description
|
2
|
+
|
3
|
+
Want "Capistrano":http://capify.org/ to talk to "God":http://god.rubyforge.org/? Find "San Juan":http://maps.google.com/maps?client=safari&ie=UTF8&oe=UTF-8&q=San+Juan+Capistrano,+CA,+USA&ll=33.495598,-117.665291&spn=0.020113,0.037851&t=h&z=15
|
4
|
+
|
5
|
+
h2. Requirements
|
6
|
+
|
7
|
+
* "God":http://god.rubyforge.org/
|
8
|
+
* "Capistrano":http://capify.org/
|
9
|
+
|
10
|
+
h2. Install
|
11
|
+
|
12
|
+
<pre>
|
13
|
+
<code>
|
14
|
+
gem install jnewland-san_juan
|
15
|
+
OR
|
16
|
+
gem install jnewland-san_juan -s http://gems.github.com
|
17
|
+
</code>
|
18
|
+
</pre>
|
19
|
+
|
20
|
+
h2. Usage
|
21
|
+
|
22
|
+
In your Capistrano deploy recipie:
|
23
|
+
|
24
|
+
<pre>
|
25
|
+
<code>
|
26
|
+
require 'san_juan'
|
27
|
+
|
28
|
+
role :app, 'foo.example.com'
|
29
|
+
role :web, 'bar.example.com'
|
30
|
+
|
31
|
+
san_juan.role :app, %w(mongrels memcached)
|
32
|
+
san_juan.role :web, %w(nginx)
|
33
|
+
</code>
|
34
|
+
</pre>
|
35
|
+
|
36
|
+
Now, check out @cap -T@:
|
37
|
+
|
38
|
+
<pre>
|
39
|
+
<code>
|
40
|
+
...
|
41
|
+
cap god:all:quit # Quit god, but not the proce...
|
42
|
+
cap god:all:reload # Reloading God Config
|
43
|
+
cap god:all:start # Start god
|
44
|
+
cap god:all:start_interactive # Start god interactively
|
45
|
+
cap god:all:status # Describe the status of the ...
|
46
|
+
cap god:all:terminate # Terminate god and all monit...
|
47
|
+
cap god:app:mongrels:log # Log mongrels
|
48
|
+
cap god:app:mongrels:remove # Remove mongrels
|
49
|
+
cap god:app:mongrels:restart # Restart mongrels
|
50
|
+
cap god:app:mongrels:start # Start mongrels
|
51
|
+
cap god:app:mongrels:stop # Stop mongrels
|
52
|
+
cap god:app:mongrels:unmonitor # Unmonitor mongrels
|
53
|
+
cap god:app:memcached:log # Log memcached
|
54
|
+
cap god:app:memcached:remove # Remove memcached
|
55
|
+
cap god:app:memcached:restart # Restart memcached
|
56
|
+
cap god:app:memcached:start # Start memcached
|
57
|
+
cap god:app:memcached:stop # Stop memcached
|
58
|
+
cap god:app:memcached:unmonitor # Unmonitor memcached
|
59
|
+
cap god:app:quit # Quit god, but not the proce...
|
60
|
+
cap god:app:reload # Reload the god config file
|
61
|
+
cap god:app:start # Start god
|
62
|
+
cap god:app:start_interactive # Start god interactively
|
63
|
+
cap god:app:terminate # Terminate god and all monit...
|
64
|
+
cap god:web:nginx:log # Log nginx
|
65
|
+
cap god:web:nginx:remove # Remove nginx
|
66
|
+
cap god:web:nginx:restart # Restart nginx
|
67
|
+
cap god:web:nginx:start # Start nginx
|
68
|
+
cap god:web:nginx:stop # Stop nginx
|
69
|
+
cap god:web:nginx:unmonitor # Unmonitor nginx
|
70
|
+
cap god:web:quit # Quit god, but not the proce...
|
71
|
+
cap god:web:reload # Reload the god config file
|
72
|
+
cap god:web:start # Start god
|
73
|
+
cap god:web:start_interactive # Start god interactively
|
74
|
+
cap god:web:terminate # Terminate god and all monit...
|
75
|
+
...
|
76
|
+
</pre>
|
77
|
+
</code>
|
78
|
+
|
79
|
+
To make capistrano start, stop, and restart your app using God, override the
|
80
|
+
@deploy:start@, @deploy:stop@, and @deploy:restart@ tasks:
|
81
|
+
|
82
|
+
<pre>
|
83
|
+
<code>
|
84
|
+
namespace :deploy do
|
85
|
+
desc "Use god to restart the app"
|
86
|
+
task :restart do
|
87
|
+
god.all.reload #ensures any changes to the god config are applied at deploy
|
88
|
+
god.app.mongrels.restart
|
89
|
+
# god.web.nginx.restart
|
90
|
+
# ...
|
91
|
+
end
|
92
|
+
|
93
|
+
desc "Use god to start the app"
|
94
|
+
task :start do
|
95
|
+
god.all.start
|
96
|
+
end
|
97
|
+
|
98
|
+
desc "Use god to stop the app"
|
99
|
+
task :stop do
|
100
|
+
god.all.terminate
|
101
|
+
end
|
102
|
+
end
|
103
|
+
</pre>
|
104
|
+
</code>
|
105
|
+
|
106
|
+
h2. Tweaks
|
107
|
+
|
108
|
+
A few of the tasks in the @god:all@ namespace require the path to your god
|
109
|
+
configuration file. This defaults to:
|
110
|
+
|
111
|
+
@"#{current_path}/config/god/#{role}.god"@
|
112
|
+
|
113
|
+
This can be changed by setting the @god_config_path@ capistrano variable:
|
114
|
+
|
115
|
+
<pre>
|
116
|
+
<code>
|
117
|
+
require 'san_juan'
|
118
|
+
|
119
|
+
set :god_config_path, "/path/to/config"
|
120
|
+
|
121
|
+
role :app, 'foo.example.com'
|
122
|
+
role :web, 'bar.example.com'
|
123
|
+
|
124
|
+
san_juan.role :app, %w(mongrels memcached)
|
125
|
+
san_juan.role :web, %w(nginx)
|
126
|
+
|
127
|
+
</code>
|
128
|
+
</pre>
|
129
|
+
|
130
|
+
h2. Author
|
131
|
+
|
132
|
+
"Jesse Newland":http://jnewland.com/
|
133
|
+
|
134
|
+
h2. License
|
135
|
+
|
136
|
+
"WTFPL":http://sam.zoy.org/wtfpl/
|
data/lib/san_juan.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
module SanJuan
|
2
|
+
@@roles = []
|
3
|
+
|
4
|
+
def roles
|
5
|
+
@@roles
|
6
|
+
end
|
7
|
+
|
8
|
+
def role(role, watches)
|
9
|
+
@@roles << role
|
10
|
+
|
11
|
+
namespace :god do
|
12
|
+
|
13
|
+
unless @meta_tasks_defined
|
14
|
+
namespace :all do
|
15
|
+
desc "Describe the status of the running tasks on each server"
|
16
|
+
task :status do
|
17
|
+
san_juan.roles.each { |role| send(role).send(:status) }
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Start god"
|
21
|
+
task :start do
|
22
|
+
san_juan.roles.each { |role| send(role).send(:start) }
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Reloading God Config"
|
26
|
+
task :reload do
|
27
|
+
san_juan.roles.each { |role| send(role).send(:reload) }
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Start god interactively"
|
31
|
+
task :start_interactive do
|
32
|
+
san_juan.roles.each { |role| send(role).send(:start_interactive) }
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Quit god, but not the processes it's monitoring"
|
36
|
+
task :quit do
|
37
|
+
san_juan.roles.each { |role| send(role).send(:quit) }
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "Terminate god and all monitored processes"
|
41
|
+
task :terminate do
|
42
|
+
san_juan.roles.each { |role| send(role).send(:terminate) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
@meta_tasks_defined = true
|
47
|
+
|
48
|
+
namespace role do
|
49
|
+
desc "Start god"
|
50
|
+
task :start, :roles => role do
|
51
|
+
sudo "god -c #{san_juan.configuration_path(current_path, role)}"
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Start god interactively"
|
55
|
+
task :start_interactive, :roles => role do
|
56
|
+
sudo "god -c #{san_juan.configuration_path(current_path, role)} -D"
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Reload the god config file"
|
60
|
+
task :reload, :roles => role do
|
61
|
+
sudo "god load #{san_juan.configuration_path(current_path, role)}"
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Quit god, but not the processes it's monitoring"
|
65
|
+
task :quit, :roles => role do
|
66
|
+
sudo 'god quit'
|
67
|
+
end
|
68
|
+
|
69
|
+
desc "Terminate god and all monitored processes"
|
70
|
+
task :terminate, :roles => role do
|
71
|
+
sudo 'god terminate'
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "Describe the status of the running tasks"
|
75
|
+
task :status, :roles => role do
|
76
|
+
sudo 'god status'
|
77
|
+
end
|
78
|
+
|
79
|
+
watches.each do |watch|
|
80
|
+
namespace watch do
|
81
|
+
%w(start restart stop unmonitor remove log).each do |command|
|
82
|
+
desc "#{command.capitalize} #{watch}"
|
83
|
+
task command, :roles => role do
|
84
|
+
sudo "god #{command} #{watch}"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end # end role namespace
|
91
|
+
|
92
|
+
end #end god namespace
|
93
|
+
end
|
94
|
+
|
95
|
+
def configuration_path(current_path, role)
|
96
|
+
fetch(:god_config_path, nil) || "#{current_path}/config/god/#{role}.god"
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
Capistrano.plugin :san_juan, SanJuan
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: san_juan
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jesse Newland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-20 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: capistrano
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Capistrano Recipies for God
|
26
|
+
email: jnewland@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.textile
|
33
|
+
files:
|
34
|
+
- lib/san_juan.rb
|
35
|
+
- README.textile
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/jnewland/san_juan
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.5
|
61
|
+
signing_key:
|
62
|
+
specification_version: 2
|
63
|
+
summary: Capistrano Recipies for God
|
64
|
+
test_files: []
|
65
|
+
|