rails_pwnerer 0.6.49 → 0.6.50

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/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.6.50. SSL support in nginx configuration.
2
+
1
3
  v0.6.49. Re-added Ruby extension compiling support that somehow disappeared.
2
4
 
3
5
  v0.6.48. Added openssl and https support to ruby.
data/README CHANGED
@@ -147,6 +147,21 @@ underscores (_) instead. You can use dots in application names,
147
147
  though.
148
148
 
149
149
 
150
+ SSL servers with +rails_pwnerer+:
151
+
152
+ 1) Generate a server key:
153
+ openssl req -new -newkey rsa:2048 -keyout config/rails_pwnerer/instance.pem -out instance.csr -nodes
154
+
155
+ 2) Be sure to set the CN (Common Name) to your server's DNS address. Send the
156
+ CSR file to your CA: cat instance.csr
157
+
158
+ 3) Copy the certificate into the +rails_pwnerer+ configuration directory:
159
+ cat > config/rails_pwnerer/instance.cer
160
+
161
+ 4) Clean up: rm instance.csr
162
+
163
+ 5) Update the application in production: sudo rpwn update
164
+
150
165
  Hooked on +rails_pwnerer+:
151
166
 
152
167
  You're growing to complex applications which need daemons outside
@@ -74,13 +74,22 @@ class RailsPwnage::App::Config
74
74
 
75
75
  populate_defaults app_name, instance_name, app_config
76
76
  Dir.chdir app_config[:app_path] do
77
+ # Populate the default SSL configuration if the right files exist.
78
+ ssl_cert = File.expand_path "config/rails_pwnerer/#{instance_name}.cer"
79
+ ssl_key = File.expand_path "config/rails_pwnerer/#{instance_name}.pem"
80
+ if File.exists?(ssl_cert) and File.exists?(ssl_key)
81
+ app_config[:ssl_cert] = ssl_cert
82
+ app_config[:ssl_key] = ssl_key
83
+ app_config[:port] = 443
84
+ end
85
+
77
86
  ["config/rails_pwnerer/.yml", "config/rails_pwnerer/#{instance_name}.yml"].each do |fname|
78
87
  next unless File.exists? fname
79
88
  config_update = File.open(fname, 'r') { |f| YAML.load f }
80
89
  config_update.each do |key, value|
81
90
  app_config[key] = value
82
91
  end
83
- end
92
+ end
84
93
  end
85
94
 
86
95
  # TODO: if database settings changed, the database should be moved (re-created or re-keyed)
@@ -15,7 +15,8 @@ class RailsPwnage::App::NginxConfig
15
15
  dns_names = app_config[:dns_name]
16
16
  end
17
17
 
18
- app_port = app_config[:port] || 80
18
+ default_app_port = app_config[:ssl_key] ? 443 : 80
19
+ app_port = app_config[:port] || default_app_port
19
20
 
20
21
  nginx_config = File.join(RailsPwnage::Config.path_to(:nginx_configs),
21
22
  app_name + '.' + instance_name)
@@ -31,6 +32,9 @@ class RailsPwnage::App::NginxConfig
31
32
  f << <<NGINX_CONFIG
32
33
  server {
33
34
  listen #{app_port};
35
+ #{app_config[:ssl_key] ? 'ssl on;' : ''}
36
+ #{app_config[:ssl_key] ? "ssl_certificate #{app_config[:ssl_cert]};" : ''}
37
+ #{app_config[:ssl_key] ? "ssl_certificate_key #{app_config[:ssl_key]};" : ''}
34
38
  #{(dns_names.empty? ? '' : "server_name " + dns_names.join(' ') + ";")}
35
39
  root #{app_config[:app_path]}/public;
36
40
  client_max_body_size #{app_config[:max_request_mb]}M;
@@ -59,7 +59,7 @@ class RailsPwnage::App::Svn
59
59
 
60
60
  def checkout(remote_path, app_name, instance_name)
61
61
  app_path = RailsPwnage::Config[app_name, instance_name][:app_path]
62
- return :next unless remote_path =~ /svn.*\:\/\//
62
+ return :next unless remote_path =~ /svn.*\:\/\// or remote_path =~ /http.*\:\/\/.*svn/
63
63
 
64
64
  print "Doing SVN checkout, please enter your password if prompted...\n"
65
65
  system "svn co #{remote_path} #{app_path}"
@@ -3,7 +3,7 @@
3
3
  module RailsPwnage::Base
4
4
  # check if the given path is the root of a Rails application
5
5
  def check_rails_root(path = '.')
6
- ['app', 'config', 'db', 'lib', 'log', 'public',
7
- 'script', 'tmp', 'vendor', 'Rakefile'].all? { |dir| File.exists? File.join(path, dir) }
6
+ ['app', 'config', 'db', 'public', 'script', 'vendor',
7
+ 'Rakefile'].all? { |dir| File.exists? File.join(path, dir) }
8
8
  end
9
- end
9
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rails_pwnerer}
5
- s.version = "0.6.49"
5
+ s.version = "0.6.50"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Victor Costan"]
9
- s.date = %q{2009-09-25}
9
+ s.date = %q{2010-02-03}
10
10
  s.default_executable = %q{bin/rpwn}
11
11
  s.description = %q{Rails deployment tool/hack.}
12
12
  s.email = %q{victor@costan.us}
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.6.49
4
+ version: 0.6.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-25 00:00:00 -04:00
12
+ date: 2010-02-03 00:00:00 -05:00
13
13
  default_executable: bin/rpwn
14
14
  dependencies: []
15
15