matross 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -94,11 +94,11 @@ Procfile task: `web: bundle exec unicorn -c <%= unicorn_config %> -E <%= rails_e
94
94
 
95
95
  > Variables
96
96
 
97
- | Variable | Default value | Description |
98
- | --- | --- | --- |
99
- | `:unicorn_config` | `"#{shared_path}/config/unicorn.rb"` | Location of the configuration file |
100
- | `:unicorn_log` | `"#{shared_path}/log/unicorn.log"` | Location of unicorn log |
101
- | `:unicorn_workers` | `1` | Number of unicorn workers |
97
+ | Variable | Default value | Description |
98
+ | --- | --- | --- |
99
+ | `:unicorn_config` | `"#{shared_path}/config/unicorn.rb"` | Location of the configuration file |
100
+ | `:unicorn_log` | `"#{shared_path}/log/unicorn.log"` | Location of unicorn log |
101
+ | `:unicorn_workers` | Number of cores specified by /proc/cpuinfo | Number of unicorn workers |
102
102
 
103
103
  > Tasks
104
104
 
@@ -273,7 +273,21 @@ Procfile task: `faye: bundle exec rackup <%= faye_ru %> -s thin -E <%= rails_en
273
273
 
274
274
  ### Local Assets
275
275
 
276
- This recipe overwrites the default assets precompilation by compiling them locally and then uploading the result to the server.
276
+ In order to deal with memory or CPU constrained production servers, this recipe overwrites the default assets precompilation by compiling them locally and then uploading the result to the server.
277
+
278
+ Rake precompiles assets in a `production` to properly generate file names with hashes. One of the gotchas to this is that by default Rails initializes the entire applicaction when executing the `assets:precompile` task. If you use different databases in production and development and run into database connection errors with this task you can override this behavior.
279
+
280
+ > `config/application.rb`
281
+
282
+ ```ruby
283
+ module AwesomeApplication
284
+ class Application < Rails::Application
285
+ ...
286
+ config.assets.initialize_on_precompile = false if Rails.env.production?
287
+ ...
288
+ end
289
+ end
290
+ ```
277
291
 
278
292
  ## Full Example
279
293
 
@@ -17,7 +17,7 @@ namespace :foreman do
17
17
  cmd = <<-EOF.gsub(/^\s+/, '')
18
18
  rm -f #{shared_path}/Procfile-matross;
19
19
  for file in #{current_path}/Procfile #{shared_path}/Procfile.*; do \
20
- cat $file >> #{shared_path}/Procfile-matross;
20
+ [ -f $file ] && cat $file >> #{shared_path}/Procfile-matross;
21
21
  done;
22
22
  rm -f #{shared_path}/Procfile.*;
23
23
  cat <(echo \"RAILS_ENV=#{rails_env.to_s.shellescape}\") \
@@ -71,14 +71,14 @@ namespace :foreman do
71
71
 
72
72
  desc "Symlink upstart logs to application shared/log"
73
73
  task :log, except: { no_release: true } do
74
- capture("ls #{shared_path}/upstart -1").split(/\r?\n/).each { |line|
75
- log = File.basename(line.sub(/\.conf\Z/, ".log"))
76
- run <<-EOF.gsub(/^\s+/, '')
77
- #{sudo} touch /var/log/upstart/#{log} &&
78
- #{sudo} chmod o+r /var/log/upstart/#{log} &&
79
- ln -nfs /var/log/upstart/#{log} #{shared_path}/log/#{log}
80
- EOF
81
- }
74
+ run <<-EOF.gsub(/^s+/, '')
75
+ ls #{shared_path}/upstart -1 | while read line; do
76
+ logname=$(basename $line | sed "s/.conf$/.log/");
77
+ #{sudo} touch /var/log/upstart/${logname} &&
78
+ #{sudo} chmod o+r /var/log/upstart/${logname} &&
79
+ ln -nfs /var/log/upstart/${logname} #{shared_path}/log/${logname};
80
+ done
81
+ EOF
82
82
  end
83
83
  after "foreman:export", "foreman:log"
84
84
 
@@ -59,7 +59,7 @@ namespace :mysql do
59
59
  comment_open = '# Begin Matross generated task for MySQL Backup'
60
60
  comment_close = '# End Matross generated task for MySQL Backup'
61
61
 
62
- cron_command = "#{mysql_backup_script} 2>&1 >> #{shared_path}/log/mysql_backup.log"
62
+ cron_command = "#{mysql_backup_script} >> #{shared_path}/log/mysql_backup.log 2>&1"
63
63
  cron_entry = "#{mysql_backup_cron_schedule} #{cron_command}"
64
64
  cron = [comment_open, cron_entry, comment_close].compact.join("\n")
65
65
 
@@ -2,8 +2,7 @@ dep_included? 'unicorn'
2
2
 
3
3
  _cset(:unicorn_config) { "#{shared_path}/config/unicorn.rb" }
4
4
  _cset(:unicorn_log) { "#{shared_path}/log/unicorn.log" }
5
- _cset :unicorn_workers, 1
6
-
5
+ _cset(:unicorn_workers) { capture("grep -c processor /proc/cpuinfo").to_i }
7
6
  namespace :unicorn do
8
7
 
9
8
  desc "Initial Setup"
@@ -1,3 +1,3 @@
1
1
  module Matross
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matross
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-19 00:00:00.000000000 Z
13
+ date: 2013-12-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler