matross 0.4.1 → 0.4.2
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/README.md +20 -6
- data/lib/matross/foreman.rb +9 -9
- data/lib/matross/mysql.rb +1 -1
- data/lib/matross/unicorn.rb +1 -2
- data/lib/matross/version.rb +1 -1
- metadata +2 -2
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
|
98
|
-
| --- | ---
|
99
|
-
| `:unicorn_config` | `"#{shared_path}/config/unicorn.rb"`
|
100
|
-
| `:unicorn_log` | `"#{shared_path}/log/unicorn.log"`
|
101
|
-
| `: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
|
-
|
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
|
|
data/lib/matross/foreman.rb
CHANGED
@@ -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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
|
data/lib/matross/mysql.rb
CHANGED
@@ -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}
|
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
|
|
data/lib/matross/unicorn.rb
CHANGED
@@ -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
|
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"
|
data/lib/matross/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2013-12-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|