rails_pwnerer 0.3 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.3.5. Implemented 'go live' and 'go panic' to take all application processes up / down.
2
+
1
3
  v0.3. Supports 'update' to update application from svn. Still no configuration outside of config/main.rb.
2
4
 
3
5
  v0.2. Supports 'install' to install application from svn. No configuration outside of config/main.rb.
data/README CHANGED
@@ -9,7 +9,13 @@ welcome to test/update for other systems, and I'll be happy to merge patches,
9
9
  or add you to the RubyForge project.
10
10
 
11
11
 
12
- Quick start with +rails_pwnerer+:
12
+ Live without +rails_pwnerer+:
13
+
14
+ Read a 20-page guide, and spend the better half of a day getting a box
15
+ ready for production. You'll be frustrated in the process, but feel
16
+ accomplished at the end. Assuming you don't do something wrong.
17
+
18
+ Live with +rails_pwnerer+:
13
19
 
14
20
  1) Install rubygems:
15
21
  sudo apt-get install rubygems
@@ -18,9 +24,13 @@ sudo apt-get install rubygems
18
24
  sudo gem install rails_pwnerer
19
25
 
20
26
  3) Get your server production-ready:
21
- sudo rpwn den00b
27
+ sudo rpwn scaffold
22
28
 
23
29
  4) Install your application:
24
- sudo rpwn install svn+ssh://your.repo/path/to/your_application
30
+ sudo rpwn install svn+ssh://your.repository.host/path/to/your_application
31
+
32
+ 5) Reboot, or start the services right away:
33
+ sudo rpwn go live
25
34
 
26
- That's it. Reboot, and you're ready.
35
+ 6) Keep your application updated
36
+ sudo rpwn update your_application
@@ -62,6 +62,15 @@ class RailsPwnage::App::ClusterConfig
62
62
  start_mongrels(app_name)
63
63
  end
64
64
 
65
+ def control_all(action)
66
+ case action
67
+ when :start
68
+ control_boot_script('mongrel_cluster', :start)
69
+ when :stop
70
+ control_boot_script('mongrel_cluster', :stop)
71
+ end
72
+ end
73
+
65
74
  def self.setup(app_name)
66
75
  self.new.setup(app_name)
67
76
  end
@@ -69,4 +78,8 @@ class RailsPwnage::App::ClusterConfig
69
78
  def self.update(app_name, &update_proc)
70
79
  self.new.update(app_name, &update_proc)
71
80
  end
81
+
82
+ def self.control_all(action = :start)
83
+ self.new.control_all(action)
84
+ end
72
85
  end
@@ -63,6 +63,15 @@ ENDSQL
63
63
  migrate_database app_name
64
64
  end
65
65
 
66
+ def control_all(action)
67
+ case action
68
+ when :start
69
+ control_boot_script('mysql', :start)
70
+ when :stop
71
+ control_boot_script('mysql', :stop)
72
+ end
73
+ end
74
+
66
75
  def self.setup(app_name)
67
76
  self.new.setup(app_name)
68
77
  end
@@ -70,4 +79,8 @@ ENDSQL
70
79
  def self.update(app_name)
71
80
  self.new.update(app_name)
72
81
  end
82
+
83
+ def self.control_all(action = :start)
84
+ self.new.control_all(action)
85
+ end
73
86
  end
@@ -1,5 +1,5 @@
1
1
  module RailsPwnage::App
2
- # installs an application given its SVN path
2
+ # install an application given its SVN path
3
3
  def self.install(svn_path)
4
4
  app_name = Svn.setup(svn_path)
5
5
  Database.setup(app_name)
@@ -7,6 +7,7 @@ module RailsPwnage::App
7
7
  NginxConfig.setup(app_name)
8
8
  end
9
9
 
10
+ # update an application (restart servers if necessary)
10
11
  def self.update(app_name)
11
12
  ClusterConfig.update(app_name) do
12
13
  Svn.update(app_name)
@@ -14,4 +15,19 @@ module RailsPwnage::App
14
15
  end
15
16
  NginxConfig.update(app_name)
16
17
  end
18
+
19
+ # start or stop all apps
20
+ def self.control_all(action = :start)
21
+ case action
22
+ when :start
23
+ control_all :stop
24
+ Database.control_all :start
25
+ ClusterConfig.control_all :start
26
+ NginxConfig.control_all :start
27
+ when :stop
28
+ NginxConfig.control_all :stop
29
+ ClusterConfig.control_all :stop
30
+ Database.control_all :stop
31
+ end
32
+ end
17
33
  end
@@ -56,6 +56,15 @@ NGINX_CONFIG
56
56
  config_nginx(app_name)
57
57
  remove_nginx_stub
58
58
  end
59
+
60
+ def control_all(action)
61
+ case action
62
+ when :start
63
+ control_boot_script('nginx', :start)
64
+ when :stop
65
+ control_boot_script('nginx', :stop)
66
+ end
67
+ end
59
68
 
60
69
  def self.setup(app_name)
61
70
  self.new.setup(app_name)
@@ -64,4 +73,8 @@ NGINX_CONFIG
64
73
  def self.update(app_name)
65
74
  # nothing to do here, unless we enable config rewriting
66
75
  end
76
+
77
+ def self.control_all(action = :start)
78
+ self.new.control_all(action)
79
+ end
67
80
  end
@@ -3,21 +3,23 @@ class RailsPwnage::Executor
3
3
 
4
4
  # standalone runner
5
5
  def run(args)
6
- case args[0]
7
- when 'dirs'
8
- Dirs.go
9
- when 'gems'
10
- Gems.go
11
- when 'packages'
12
- Packages.go
13
- when 'mongrels'
14
- HookMongrels.go
15
-
16
- when 'den00b'
17
- Packages.go
18
- Gems.go
19
- Dirs.go
20
- HookMongrels.go
6
+ case args[0]
7
+ when 'scaffold'
8
+ case args[1]
9
+ when 'dirs'
10
+ Dirs.go
11
+ when 'gems'
12
+ Gems.go
13
+ when 'packages'
14
+ Packages.go
15
+ when 'mongrels'
16
+ HookMongrels.go
17
+ else
18
+ Packages.go
19
+ Gems.go
20
+ Dirs.go
21
+ HookMongrels.go
22
+ end
21
23
 
22
24
  when 'install'
23
25
  svn_path = args[1]
@@ -26,6 +28,14 @@ class RailsPwnage::Executor
26
28
  when 'update'
27
29
  app_name = args[1]
28
30
  RailsPwnage::App.update app_name
31
+
32
+ when 'go'
33
+ case args[1]
34
+ when 'live'
35
+ RailsPwnage::App.control_all :start
36
+ when 'panic'
37
+ RailsPwnage::App.control_all :stop
38
+ end
29
39
  end
30
40
  end
31
41
 
@@ -1,10 +1,10 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.3
2
+ # Gem::Specification for Rails_pwnerer-0.3.5
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{rails_pwnerer}
7
- s.version = "0.3"
7
+ s.version = "0.3.5"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pwnerer
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan