magic_recipes_two 0.0.74 → 0.0.75

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDU4YzQxY2MxNDhiNjBjOTM1MWIzYjhjYTc3YTdlMzc3M2Q2NGE3OQ==
4
+ OTE5YTljNzFlNTM1ZjBmY2VjOGQyMmYyNmMxMmExZmE1MDdhNjBmZg==
5
5
  data.tar.gz: !binary |-
6
- NTBkN2ZkNmNlMTI5YjUxN2M5NTdhZjE5MWI0ODA5MTU2Yjk5NTE0OA==
6
+ YmFhMDM4NThhMTEyNTgwY2FmMDkyYjA5MDFlNDM0YjczYWYxZTQxZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDkxZjY3ZThmZjcyODgxOTMxNDJmMmIxZjU2NmMyMGU3NDg0OTM5ZTMyYmY4
10
- MGZmYzBjMTcwZjQwZjJiYTBlNWZlZTIzZGI4MjQ2Mjc0NjgxMjBmZmI1MWQ3
11
- ZGFlOTQ0YTM1YWM3OTRiNjY3YzRmYTVmMTEyYTgyNDI4ZjY2MjY=
9
+ OWFjMGVkOTBiZWEyYmM1NmY3MmMzNTYyYzIxOGY2NzEzOGQyZDQyYjI1NWU5
10
+ YjY1Mzk5Yjk5ODMyN2YwMzQ1ZDhiNDMzNGEzMjg2NjExZjM2M2YxZWI5ZjUz
11
+ OGJmYzg4MDEyZjU2OWYzMTljMTI5Nzk5MDgyMDViYjg0MmJkMWY=
12
12
  data.tar.gz: !binary |-
13
- NThlODY3MDRiMzZhYWFlNGEwZjE5MjhmYmE3M2QwYWExNTA0MTQyZmU4Y2Zh
14
- ZGQ4NzY0NDJhNDM5YTc1ZmJhNTA2NGI3MDY1OTA4ZTczODA5YmMzY2U3M2I1
15
- NTZkMjZlMmRhZmQwYTBiZDA4ZWIyYWQyZDFlMGNkYzhkM2ZlYjg=
13
+ ZTE3NDI1YTEyZWFjYjJlYzgxNDMyNDU5NGE0M2ZhNjQzZWEzMTkzM2E5ZTRl
14
+ MzA3OTMzNzgxZDQ2MGFiNGFmZjk1NzQ2YTViMzdiMmZjZDA3MzEzOTdjZDhk
15
+ YjYwNzYwNzczMzIzNjk4NGEwZWJkMTUzYThmM2Y0Nzc5ZWE0NDc=
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module MagicRecipes
3
- VERSION = "0.0.74"
3
+ VERSION = "0.0.75"
4
4
  end
5
5
  end
@@ -28,12 +28,12 @@ namespace :load do
28
28
  set :postgresql_roles, -> { :db }
29
29
  set :postgresql_pid, -> { "/var/run/postgresql/9.1-main.pid" }
30
30
  ## Additional stuff for thin (need secrets_key_base to be set)
31
- set :monit_thin_with_secret, -> { false }
32
31
  set :monit_thin_totalmem_mb, -> { 300 }
33
32
  ## Additional stuff for sidekiq (need secrets_key_base to be set)
34
- set :monit_sidekiq_with_secret, -> { false }
35
33
  set :monit_sidekiq_totalmem_mb, -> { 300 }
36
34
  set :monit_sidekiq_timeout_sec, -> { 90 }
35
+ ## Additional App helpers
36
+ set :monit_app_worker_command, -> { "cd #{ current_path } ; #{fetch(:rvm_path)}/bin/rvm #{fetch(:rvm_ruby_version)} do bundle exec MONIT_CMD" }
37
37
  ## WebClient
38
38
  set :monit_http_client, -> { true }
39
39
  set :monit_http_domain, -> { false }
@@ -168,6 +168,10 @@ def monit_config( name, destination = nil, role = nil )
168
168
  execute :sudo, "chmod 600 #{destination}"
169
169
  end
170
170
 
171
+ def monit_app_prefixed( cmd )
172
+ fetch(:monit_app_worker_command, "cd #{ current_path } ; bundle exec MONIT_CMD").to_s.gsub(/MONIT_CMD/, cmd)
173
+ end
174
+
171
175
 
172
176
  namespace :deploy do
173
177
  before :starting, :stop_monitoring do
@@ -27,16 +27,16 @@
27
27
  %>
28
28
  check process <%= sidekiq_service_name(idx) %>
29
29
  with pidfile "<%= pid_file %>"
30
- start program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> ;<% if fetch(:monit_sidekiq_with_secret) %> export SECRET_KEY_BASE=<%= fetch(:secrets_key_base) %>; export <%= fetch(:secrets_key_name) %>=<%= fetch(:secrets_key_base) %>;<% end %> bundle exec sidekiq <%= args.join(" ") %>'" with timeout <%= fetch(:monit_sidekiq_timeout_sec, 90) %> seconds
31
- stop program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> ; bundle exec sidekiqctl stop <%= pid_file %>' " with timeout <%= fetch(:monit_sidekiq_timeout_sec, 90) %> seconds
30
+ start program = <%= monit_app_prefixed("sidekiq #{ args.join(" ") }") %> with timeout <%= fetch(:monit_sidekiq_timeout_sec, 90) %> seconds
31
+ stop program = <%= monit_app_prefixed("sidekiqctl stop #{ pid_file }") %> with timeout <%= fetch(:monit_sidekiq_timeout_sec, 90) %> seconds
32
32
  group sidekiq-<%= fetch(:sidekiq_monit_group, fetch(:application)) %>-<%= fetch(:stage) %>
33
33
  # if does not exist then start # (default)
34
- # if does not exist for 3 cycles then alert
35
- if 3 restarts within 5 cycles then alert
36
34
  if totalmem > <%= ( fetch( :monit_sidekiq_totalmem_mb, 300 ).to_i * 0.75 ).to_i %> MB then alert
37
35
  if totalmem > <%= fetch( :monit_sidekiq_totalmem_mb, 300 ) %> MB for 2 cycles then restart
38
- if 3 restarts within 5 cycles then timeout
36
+ # if does not exist for 3 cycles then alert
39
37
  # alert <%= fetch(:monit_mail_to) %> only on { pid }
38
+ if 3 restarts within 5 cycles then alert
39
+ if 3 restarts within 5 cycles then timeout
40
40
  if 2 restarts within 3 cycles then alert
41
41
  if changed pid 2 times within 10 cycles then alert
42
42
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <% fetch(:app_instances, 1).times do |n| %>
3
3
  check process <%= fetch(:application) %>_<%= fetch(:stage) %>_thin_<%= n %> with pidfile <%= deploy_to %>/shared/pids/thin_<%= fetch(:application) %>_<%= fetch(:stage) %>.<%= n %>.pid
4
4
  group thin-<%= fetch(:application) %>-<%= fetch(:stage) %>
5
- start program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> ;<% if fetch(:monit_thin_with_secret) %> export SECRET_KEY_BASE=<%= fetch(:secrets_key_base) %>; export <%= fetch(:secrets_key_name) %>=<%= fetch(:secrets_key_base) %>;<% end %> bundle exec thin start -C config/thin_app_<%= fetch(:stage) %>.yml -o <%= n %>' "
6
- stop program = "/bin/su - <%= @role.user %> -c 'cd <%= current_path %> ; bundle exec thin stop -C config/thin_app_<%= fetch(:stage) %>.yml -o <%= n %>' "
5
+ start program = <%= monit_app_prefixed("thin start -C config/thin_app_#{ fetch(:stage) }.yml -o #{ n }") %>
6
+ stop program = <%= monit_app_prefixed("thin stop -C config/thin_app_#{ fetch(:stage) }.yml -o #{ n }") %>
7
7
  # if does not exist then start # (default)
8
8
  # if does not exist for 3 cycles then alert
9
9
  if 3 restarts within 5 cycles then alert
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_recipes_two
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.74
4
+ version: 0.0.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torsten Wetzel