rsm 0.1.rc1 → 0.1
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 -0
- data/CHANGES.md +6 -0
- data/README.md +11 -5
- data/VERSION +1 -1
- data/bin/rsm +0 -0
- data/lib/tasks/install/nginx.rb +16 -3
- data/rsm.gemspec +1 -1
- data/templates/rsm/install/nginx/nginx-unicorn.conf.erb +33 -17
- metadata +8 -9
- data/.rvmrc +0 -1
data/.gitignore
CHANGED
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -10,8 +10,8 @@ RSM created for make easier some actons on server like:
|
|
10
10
|
This version can:
|
11
11
|
|
12
12
|
* create Nginx virtual server config from template
|
13
|
-
* automaticly enable Nginx virtual server config
|
14
13
|
* clone from Git repo or download and unpack Rails application from TGZ or TBZ2 archive
|
14
|
+
* generate Unicorn config from template
|
15
15
|
* start and stop unicorn server
|
16
16
|
|
17
17
|
Homepage
|
@@ -27,22 +27,28 @@ Created by Oleksandr (asux) Ulianytskyi
|
|
27
27
|
License
|
28
28
|
-------
|
29
29
|
|
30
|
-
Source code has
|
30
|
+
Source code has BSD license
|
31
31
|
|
32
32
|
Installation
|
33
33
|
------------
|
34
34
|
|
35
35
|
Install from RubyGems:
|
36
36
|
|
37
|
-
$ gem install rsm
|
37
|
+
$ gem install rsm
|
38
|
+
|
39
|
+
Or from source code:
|
40
|
+
|
41
|
+
$ git clone git://github.com/asux/rsm
|
42
|
+
$ cd rsm
|
43
|
+
$ rake install
|
38
44
|
|
39
45
|
Ussage
|
40
46
|
-----
|
41
47
|
|
42
48
|
List avalable tasks:
|
43
|
-
|
49
|
+
|
44
50
|
$ rsm -T
|
45
|
-
|
51
|
+
|
46
52
|
Help for certain task:
|
47
53
|
|
48
54
|
$ rsm help TASK
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.1
|
data/bin/rsm
CHANGED
File without changes
|
data/lib/tasks/install/nginx.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
module Rsm
|
2
2
|
module Install
|
3
3
|
class Nginx < Rsm::Base
|
4
|
-
attr_reader :domain
|
4
|
+
attr_reader :domain, :rewrite_www, :auth_basic, :auth_basic_realm, :auth_basic_user_file
|
5
5
|
|
6
6
|
class_option :nginx_root, :default => "/etc/nginx", :aliases => "-n", :desc => "Nginx configuration root"
|
7
7
|
class_option :domain, :aliases => "-d", :desc => "Server's domain"
|
8
|
+
class_option :rewrite_www, :type => :boolean, :default => false, :desc => "Added www-subdomain rewriting"
|
9
|
+
|
10
|
+
class_option :auth_basic, :type => :boolean, :default => false, :aliases => "-a", :desc => "Use auth_basic"
|
11
|
+
class_option :auth_basic_realm, :desc => "auth_basic realm or capitalized NAME unless set"
|
12
|
+
class_option :auth_basic_user_file, :default => "htpasswd", :desc => "auth_basic user file relative path"
|
8
13
|
|
9
14
|
def set_destination_root
|
10
15
|
self.destination_root = options[:nginx_root]
|
@@ -19,12 +24,20 @@ module Rsm
|
|
19
24
|
|
20
25
|
def nginx_unicorn_config
|
21
26
|
@domain = options[:domain]
|
22
|
-
@domain =
|
27
|
+
@domain = "#{application_name}.`hostname -f`" unless @domain
|
28
|
+
|
29
|
+
@rewrite_www = options[:rewrite_www]
|
30
|
+
|
31
|
+
@auth_basic = options[:auth_basic]
|
32
|
+
@auth_basic_realm = options[:auth_basic_realm]
|
33
|
+
@auth_basic_realm = name.to_s.capitalize unless @auth_basic_realm
|
34
|
+
@auth_basic_user_file = options[:auth_basic_user_file]
|
35
|
+
|
23
36
|
template "nginx-unicorn.conf.erb", "sites-available.d/#{name}.conf"
|
24
37
|
end
|
25
38
|
|
26
39
|
def enable_nginx_site
|
27
|
-
link_file "#{destination_root}/sites-available.d/#{name}.conf", "sites-enabled.d/#{name}.conf"
|
40
|
+
link_file "#{destination_root}/sites-available.d/#{name}.conf", "sites-enabled.d/#{name}.conf" unless FileTest.symlink?("#{destination_root}/sites-enabled.d/#{name}.conf")
|
28
41
|
end
|
29
42
|
|
30
43
|
end
|
data/rsm.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'https://github.com/asux/rsm'
|
10
10
|
s.email = 'a.ulyanitsky@gmail.com'
|
11
11
|
s.author = 'Oleksandr Ulianytskyi'
|
12
|
-
s.license = '
|
12
|
+
s.license = 'BSD'
|
13
13
|
s.version = Rsm::VERSION
|
14
14
|
s.date = File.mtime(File.expand_path('VERSION', File.dirname(__FILE__)))
|
15
15
|
s.extra_rdoc_files = ['README.md', 'CHANGES.md', 'VERSION']
|
@@ -1,30 +1,46 @@
|
|
1
1
|
upstream <%= name %>_server {
|
2
|
-
|
2
|
+
server unix:<%= application_root %>/tmp/sockets/unicorn.sock fail_timeout=0; # socket path must be same with last one in #{application_root}/config/unicorn.rb
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
|
-
|
7
|
-
|
6
|
+
listen <%= domain %>:80;
|
7
|
+
server_name <%= domain %><%= if rewrite_www then "www.#{domain}" end -%>;
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
client_max_body_size 1G;
|
10
|
+
keepalive_timeout 5;
|
11
|
+
root <%= application_root %>/public;
|
12
12
|
|
13
|
-
|
13
|
+
try_files $uri/index.html $uri.html $uri @<%= name %>;
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
access_log <%= application_root %>/log/access.log;
|
16
|
+
error_log <%= application_root %>/log/error.log;
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
location @<%= name %> {
|
19
|
+
<% if auth_basic -%>
|
20
|
+
auth_basic "<%= auth_basic_realm %>";
|
21
|
+
auth_basic_user_file <%= auth_basic_user_file%>;
|
22
|
+
<% end -%>
|
23
|
+
|
24
|
+
<% if rewrite_www -%>
|
25
|
+
if ($host ~* www\.(.*)) {
|
26
|
+
set $host_without_www $1;
|
27
|
+
rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'}
|
23
28
|
}
|
29
|
+
<% end -%>
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
if (!-f $request_filename) {
|
32
|
+
proxy_pass http://<%= name %>_server;
|
33
|
+
break;
|
28
34
|
}
|
35
|
+
|
36
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
37
|
+
proxy_set_header Host $http_host;
|
38
|
+
proxy_redirect off;
|
39
|
+
}
|
40
|
+
|
41
|
+
error_page 500 502 503 504 /500.html;
|
42
|
+
location = /500.html {
|
43
|
+
root <%= application_root %>/public;
|
44
|
+
}
|
29
45
|
}
|
30
46
|
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
5
|
-
prerelease:
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Oleksandr Ulianytskyi
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &72172910 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.14.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *72172910
|
25
25
|
description: Thor tasks for rapid deployment new rails apps on server
|
26
26
|
email: a.ulyanitsky@gmail.com
|
27
27
|
executables:
|
@@ -33,7 +33,6 @@ extra_rdoc_files:
|
|
33
33
|
- VERSION
|
34
34
|
files:
|
35
35
|
- .gitignore
|
36
|
-
- .rvmrc
|
37
36
|
- CHANGES.md
|
38
37
|
- Gemfile
|
39
38
|
- README.md
|
@@ -54,7 +53,7 @@ files:
|
|
54
53
|
- templates/rsm/install/rails/unicorn.rb.erb
|
55
54
|
homepage: https://github.com/asux/rsm
|
56
55
|
licenses:
|
57
|
-
-
|
56
|
+
- BSD
|
58
57
|
post_install_message:
|
59
58
|
rdoc_options:
|
60
59
|
- --main
|
@@ -71,9 +70,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
71
|
none: false
|
73
72
|
requirements:
|
74
|
-
- - ! '
|
73
|
+
- - ! '>='
|
75
74
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
75
|
+
version: '0'
|
77
76
|
requirements:
|
78
77
|
- A coreutils installed
|
79
78
|
- A Git installed
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm 1.8.7
|