mana 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: 1d1f4d839d3344bd4793d13559e8f66c38dd2aa6
4
- data.tar.gz: eb5da8d8975006218ab0a4d79a235938870274c6
5
- !binary "U0hBNTEy":
6
- metadata.gz: 04b7f09d37b5ebcce0fab58fa700553312878a8285b6ae6b2f6c131325b1538196832afdcdad5c5a6eabc788264004758ae070f3878d6446cacfc4346721cca6
7
- data.tar.gz: be56da97fad3ae85b595ea023493770c66cc3c7cac49d3d5885210b0d2a99e0df92e48443fe871b944da62b99029cca41e0ff93b0e1f6f464724781c60ef6ba3
2
+ SHA1:
3
+ metadata.gz: f9b3aacd3cfab074c2e2df7229864cc87fde2e97
4
+ data.tar.gz: f675ab4391127d3d6ae66bbb3863279ea9b74b65
5
+ SHA512:
6
+ metadata.gz: 63eff43efe552c2474cc76619916f374bf336dfe72e406641f87a93666384fd3cebc2dc5b2cc8fc3fefce267574890a08ae2a8662502041bc3bc0be0dc7d6c42
7
+ data.tar.gz: 45fec0b69cfff97b22120a542741efc4cee5e8449228041583126997b8bb0b9969fe4b869b3da2ae76c0c68095adeb2f6aa1b7ee16c2fde395390095d66f4091
@@ -24,12 +24,13 @@ server {
24
24
  }
25
25
  }
26
26
 
27
- location ~* \.(js|css|png|jpg|gif)$ {
28
- if ($query_string ~ "^[0-9]+$") {
29
- access_log off;
30
- expires max;
31
- add_header Cache-Control public;
32
- }
27
+ location ~ ^/(assets)/ {
28
+ gzip_static on;
29
+ access_log off;
30
+ expires max;
31
+ add_header Cache-Control public;
32
+ add_header Last-Modified "";
33
+ add_header ETag "";
33
34
  }
34
35
  }
35
36
 
@@ -46,13 +47,13 @@ server {
46
47
  proxy_set_header X-FORWARDED_PROTO https;
47
48
 
48
49
  root <%= node[:current_path] %>/public;
49
-
50
+
50
51
  location / {
51
52
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
52
53
  proxy_set_header Host $http_host;
53
54
  proxy_redirect off;
54
55
  proxy_read_timeout <%= node[:railsapp][:request_timeout] %>s;
55
-
56
+
56
57
  # If you don't find the filename in the static files
57
58
  # Then request it from the unicorn server
58
59
  if (!-f $request_filename) {
@@ -0,0 +1 @@
1
+ package 'ntp'
@@ -23,18 +23,23 @@ Capistrano::Configuration.instance(:must_exist).load do
23
23
 
24
24
  set :strategy, RemoteCacheSubdir.new(self)
25
25
 
26
+ set :show_mascot, true
27
+ set :ask_confirmation, true
28
+
26
29
  # Roundsman fine-tuning
27
30
 
28
31
  set :chef_version, '~> 11.4.0'
29
32
  set :cookbooks_directory, 'config/deploy/cookbooks'
30
33
  set :stream_roundsman_output, false # todo check why is this needed
31
34
  set :ruby_install_script do
32
- if fetch(:ruby_version) == :brightbox
35
+ if fetch(:ruby_source) == :brightbox
36
+ #pg for brightbox ruby2.0 requires headers
33
37
  %Q{
34
38
  apt-get install -y python-software-properties
35
39
  apt-add-repository -y ppa:brightbox/ruby-ng
36
40
  apt-get update
37
- apt-get install -y ruby1.9.3
41
+ apt-get install -y ruby#{fetch(:ruby_version) == "2.0" ? "#{fetch(:ruby_version)} ruby2.0-dev": fetch(:ruby_version)}
42
+
38
43
  gem install bundler
39
44
  }
40
45
  else
@@ -58,7 +63,7 @@ Capistrano::Configuration.instance(:must_exist).load do
58
63
  return true
59
64
  end
60
65
 
61
- return false if fetch(:ruby_version) == :brightbox
66
+ return false if fetch(:ruby_source) == :brightbox
62
67
 
63
68
  required_version = fetch(:ruby_version).gsub("-", "")
64
69
  if installed_version.include?(required_version)
@@ -128,7 +133,7 @@ Capistrano::Configuration.instance(:must_exist).load do
128
133
 
129
134
  desc "Open SSH connection to server"
130
135
  task :ssh do
131
- host = roles[:app].servers.first # silly approach
136
+ host = find_servers.first
132
137
  exec "ssh #{ssh_login_options} #{fetch(:user)}@#{host}"
133
138
  end
134
139
 
@@ -138,14 +143,14 @@ Capistrano::Configuration.instance(:must_exist).load do
138
143
 
139
144
  desc 'Run rails console'
140
145
  task :console do
141
- host = roles[:app].servers.first # silly approach
146
+ host = find_servers.first
142
147
  cmd = "cd #{current_path} && #{sudo_runner} bundle exec rails console #{rails_env}"
143
148
  exec "ssh -t #{ssh_login_options} #{fetch(:user)}@#{host} #{cmd.shellescape}"
144
149
  end
145
150
 
146
151
  desc 'Run rake task. Example: cap mana:rake about'
147
152
  task :rake do
148
- host = roles[:app].servers.first # silly approach
153
+ host = find_servers.first # todo we could also iterate here?
149
154
  args = ARGV.drop_while { |a| a != 'mana:rake' }[1..-1].join ' '
150
155
  cmd = "cd #{current_path} && #{sudo_runner} RAILS_ENV=#{rails_env} bundle exec rake #{args}"
151
156
  exec "ssh #{fetch(:user)}@#{host} #{cmd.shellescape}"
@@ -163,6 +168,45 @@ Capistrano::Configuration.instance(:must_exist).load do
163
168
  end
164
169
  end
165
170
 
171
+ namespace :addon do
172
+ task :mascot do
173
+ file = File.join("config", "deploy", "mascot.txt")
174
+
175
+ if File.exist?(file) && show_mascot
176
+ puts File.read(file)
177
+ end
178
+
179
+ end
180
+
181
+ task :confirmation do
182
+ if ask_confirmation
183
+ set(:confirmed) do
184
+ project = "#{application.upcase} (#{stage.upcase})"
185
+ project = Array.new(((72 - project.length) / 2).ceil, "").join(" ") + project
186
+
187
+ puts <<-WARN
188
+
189
+ ========================================================================
190
+ #{project}
191
+ ========================================================================
192
+
193
+ WARNING: You're about to perform actions on application server(s)
194
+ Please confirm that all your intentions are kind and friendly
195
+
196
+ ========================================================================
197
+
198
+ WARN
199
+ answer = Capistrano::CLI.ui.ask " Are you sure you want to continue? (Y) "
200
+ if answer == 'Y' then true else false end
201
+ end
202
+
203
+ unless fetch(:confirmed)
204
+ puts "\nDeploy cancelled!"
205
+ exit
206
+ end
207
+ end
208
+ end
209
+ end
166
210
  end
167
211
 
168
212
  # More convinience
@@ -178,4 +222,7 @@ Capistrano::Configuration.instance(:must_exist).load do
178
222
  sudo "service #{fetch(:application)}-web restart"
179
223
  end
180
224
  end
225
+
226
+ before 'deploy', 'mana:addon:mascot'
227
+ before 'deploy', 'mana:addon:confirmation'
181
228
  end
@@ -1,3 +1,3 @@
1
1
  module Mana
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.10'
3
3
  end
@@ -13,7 +13,9 @@ set :default_stage, :vagrant
13
13
  # by default.
14
14
  # Change to specific version in ruby-build format
15
15
  # if exact version needed.
16
- set :ruby_version, :brightbox
16
+ #valid brightbox "1.9.3" and "2.0"
17
+ set :ruby_version, "2.0"
18
+ set :ruby_source, :brightbox
17
19
  set :care_about_ruby_version, false
18
20
 
19
21
  set :postgresql,
@@ -31,6 +33,15 @@ set :aws,
31
33
  access_key_id: '',
32
34
  secret_access_key: '' #TODO: set this to let railsapp::backup put backups in s3
33
35
 
36
+
37
+ # Show ASCII beautiful deer in console before deploy.
38
+ # True by default
39
+ #set :show_beautiful_deer, false
40
+
41
+ # Ask confirmation [Y/N] before deploy. It should be true for production stages.
42
+ # True by default
43
+ #set :ask_confirmation, false
44
+
34
45
  # For other options look into cookbooks/*/attributes/default.rb
35
46
  # and other cookbook sources.
36
47
 
@@ -41,6 +52,7 @@ set :run_list, %w(
41
52
  recipe[nginx]
42
53
  recipe[railsapp]
43
54
  recipe[railsapp::backup]
55
+ recipe[ubuntu]
44
56
  )
45
57
 
46
58
  after 'deploy:restart', 'deploy:restart_unicorn'
@@ -0,0 +1,24 @@
1
+ /| |\
2
+ `__\\ //__'
3
+ || ||
4
+ \__`\ |'__/
5
+ `_\\ //_'
6
+ _.,:---;,._
7
+ \_: :_/
8
+ |@. .@|
9
+ | |
10
+ ,\.-./ \
11
+ ;;`-' `---__________-----.-.
12
+ ;;; \_\
13
+ ';;; |
14
+ ; | ;
15
+ \ \ \ | /
16
+ \_, \ / \ |\
17
+ |';| |,,,,,,,,/ \ \ \_
18
+ | | | \ / |
19
+ \ \ | | / \ |
20
+ | || | | | | |
21
+ | || | | | | |
22
+ | || | | | | |
23
+ |_||_| |_| |_|
24
+ /_//_/ /_/ /_/
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mana
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilia Ablamonov, Cloud Castle Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-21 00:00:00.000000000 Z
11
+ date: 2014-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: roundsman
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: right_aws
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Configuration management with Chef & Capistrano
@@ -94,6 +94,7 @@ files:
94
94
  - cookbooks/railsapp/templates/default/unicorn-init.sh.erb
95
95
  - cookbooks/railsapp/templates/default/unicorn.rb.erb
96
96
  - cookbooks/railsapp/templates/default/worker.monit.conf.erb
97
+ - cookbooks/ubuntu/recipes/default.rb
97
98
  - lib/mana.rb
98
99
  - lib/mana/capistrano.rb
99
100
  - lib/mana/railtie.rb
@@ -105,6 +106,7 @@ files:
105
106
  - templates/Capfile
106
107
  - templates/Vagrantfile
107
108
  - templates/config/deploy.rb
109
+ - templates/config/deploy/mascot.txt
108
110
  - templates/config/deploy/vagrant.rb
109
111
  homepage: https://github.com/cloudcastle/mana
110
112
  licenses: []
@@ -115,17 +117,17 @@ require_paths:
115
117
  - lib
116
118
  required_ruby_version: !ruby/object:Gem::Requirement
117
119
  requirements:
118
- - - ! '>='
120
+ - - '>='
119
121
  - !ruby/object:Gem::Version
120
122
  version: '0'
121
123
  required_rubygems_version: !ruby/object:Gem::Requirement
122
124
  requirements:
123
- - - ! '>='
125
+ - - '>='
124
126
  - !ruby/object:Gem::Version
125
127
  version: '0'
126
128
  requirements: []
127
129
  rubyforge_project:
128
- rubygems_version: 2.0.0
130
+ rubygems_version: 2.0.2
129
131
  signing_key:
130
132
  specification_version: 4
131
133
  summary: Configuration management with Chef & Capistrano