capistrano-base_helper 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,7 +23,7 @@ _Note: The tasks will not work unless you have installed any monit services_
23
23
 
24
24
  All these tasks do monit tasks for all services setup with monit.
25
25
 
26
- ```ruby
26
+ ```
27
27
  cap monit:disable # Disable monit services for application
28
28
  cap monit:enable # Enable monit services for application
29
29
  cap monit:main_config # Setup main monit config file (/etc/monit/monitrc)
@@ -37,11 +37,31 @@ cap monit:status # Status monit (global)
37
37
  cap monit:stop # Stop monitoring the application permanent (Monit saves state)
38
38
  ```
39
39
 
40
+ #### Setup in your deploy file
41
+
42
+ You can add this to deploy.rb or env.rb in order to automatically monitor/unmonitor tasks
43
+
44
+ It is important to unmonitor tasks while deploying as they can trigger stops/restarts to the app that monit thinks are "crashes"
45
+
46
+ _Note: This is already done in monit\_base.rb, so no additional setup in deploy.rb or env.rb required_
47
+
48
+ ```ruby
49
+ before "deploy", "monit:unmonitor"
50
+ after "deploy", "monit:monitor"
51
+ ```
52
+
53
+ If you want monit to automatically start/stop runit instead of triggering seperately
54
+
55
+ ```ruby
56
+ before "monit:unmonitor", "monit:stop"
57
+ after "monit:monitor", "monit:start"
58
+ ```
59
+
40
60
  ### Runit
41
61
 
42
62
  All these tasks do runit tasks for all services setup with runit.
43
63
 
44
- ```ruby
64
+ ```
45
65
  cap runit:disable # Disable runit services for application
46
66
  cap runit:enable # Enable runit services for application
47
67
  cap runit:once # Only start services once.
@@ -51,6 +71,17 @@ cap runit:start # Start all runit services for current applicati
51
71
  cap runit:stop # Stop all runit services for current application
52
72
  ```
53
73
 
74
+ #### Setup in your deploy file
75
+
76
+ You can add this to deploy.rb or env.rb in order to automatically start/stop tasks
77
+
78
+ ```ruby
79
+ before "deploy", "runit:stop"
80
+ after "deploy", "runit:start"
81
+ ```
82
+
83
+ See each gem if you want to start/stop each service separate instead of together.
84
+
54
85
  ## Assumptions
55
86
 
56
87
  There are some assumptions when using this with capistrano.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-base_helper"
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Leif Ringstad"]
12
- s.date = "2013-07-08"
12
+ s.date = "2013-07-29"
13
13
  s.description = "Helpers for capistrano recipes using runit/monit. Currently: capistrano-puma and capistrano-delayed_job"
14
14
  s.email = "leifcr@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -42,9 +42,9 @@ Capistrano::Configuration.instance(true).load do
42
42
  after "monit:setup", "monit:enable"
43
43
  after "monit:enable", "monit:reload"
44
44
 
45
- # must trigger monitor AFTER deploy
45
+ # must trigger monitor after deploy
46
46
  after "deploy", "monit:monitor"
47
- # must trigger unmonitor BEFORE deploy
47
+ # must trigger unmonitor before deploy
48
48
  before "deploy", "monit:unmonitor"
49
49
 
50
50
  before "monit:disable", "monit:unmonitor"
@@ -81,7 +81,7 @@ Capistrano::Configuration.instance(true).load do
81
81
  # restart monit, as main config is now updated
82
82
  run "#{sudo} service monit restart"
83
83
  puts "----------------------------------------"
84
- puts "Sleeping for #{(fetch(:monit_daemon_time).to_i + fetch(:monit_start_delay).to_i + 10)} seconds to wait for monit to be ready"
84
+ puts "Sleeping for #{fetch(:monit_start_delay).to_i + 10)} seconds to wait for monit to be ready"
85
85
  puts "----------------------------------------"
86
86
  sleep (fetch(:monit_start_delay).to_i + 2)
87
87
  end
@@ -7,7 +7,7 @@
7
7
  echo "Stopping all services for <%= c.fetch(:application) %> running as <%= c.fetch(:user) %>"
8
8
 
9
9
  # Force all services to stop
10
- sv -w600 force-stop '<%= c.fetch(:runit_dir) %>/*'
10
+ sv -w600 force-stop <%= c.fetch(:runit_dir) %>/*
11
11
 
12
12
  # "Exit" all services
13
- sv exit '<%= c.fetch(:runit_dir) %>/*'
13
+ sv exit <%= c.fetch(:runit_dir) %>/*
@@ -2,5 +2,13 @@
2
2
  # <% c = Capistrano::BaseHelper::get_capistrano_instance %>
3
3
  # Run services for <%= c.fetch(:application) %> as <%= c.fetch(:user) %> in env <%= Capistrano::BaseHelper.environment %>
4
4
  #
5
- exec 2>&1
5
+
6
+ # Redirect stderr so everything ends up in the log file
7
+ exec 2>&1
8
+
9
+ # Announce startup
10
+ #
11
+ echo "Starting all services for <%= c.fetch(:application) %> running as <%= c.fetch(:user) %>"
12
+
13
+ # Start all services in folder <%= c.fetch(:runit_dir) %>
6
14
  exec chpst -u <%= c.fetch(:user) %> runsvdir "<%= c.fetch(:runit_dir) %>"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-base_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-08 00:00:00.000000000 Z
12
+ date: 2013-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: 1132387968025362262
102
+ hash: 3304826460133394089
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements: