capper 2.0.0.pre1 → 2.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rst CHANGED
@@ -82,24 +82,12 @@ The above command will upload ``config/deploy/templates/myscript.sh.erb`` to
82
82
  the specified path. Inside the template all capistrano options (current_path,
83
83
  application, etc) are available.
84
84
 
85
- Monit integration
85
+ systemd integration
86
86
  -----------------
87
87
 
88
- Capper provides DSL syntax for monit integration. Many recipes shipped with
89
- capper already contain monit configuration. These configuration snippets are
90
- not enabled unless you include the monit recipe in your ``Capfile``.
91
-
92
- Custom monit configuration snippets can be created with ``monit_config``::
93
-
94
- monit_config "myprocess", <<EOF, :roles => :app
95
- check process myprocess
96
- with pidfile ...
97
- start program = ...
98
- stop program = ...
99
- EOF
100
-
101
- The above call will create the specified monit snippet for monit instances
102
- running on servers in the ``:app`` role.
88
+ Capper provides integration with a systemd user session running for the user
89
+ that is being deployed to. Capper will upload service units and enable/start
90
+ these accordingly.
103
91
 
104
92
  Recipes
105
93
  =======
@@ -188,13 +176,6 @@ django
188
176
 
189
177
  The django recipe provides setup and migrate tasks for Django.
190
178
 
191
- monit
192
- -----
193
-
194
- The monit recipe will collect all snippets declared via ``monit_config`` and
195
- render them into the file specified via ``monitrc`` (default:
196
- ``~/.monitrc.local``, this file should be included in your ``~/.monitrc``).
197
-
198
179
  python
199
180
  ------
200
181
 
@@ -3,25 +3,12 @@ _cset(:delayed_job_workers, {})
3
3
 
4
4
  # these cannot be overriden
5
5
  set(:delayed_job_script) { File.join(bin_path, "delayed_job") }
6
+ set(:delayed_job_service) { File.join(units_path, "delayed_job.service") }
6
7
 
7
8
  after "deploy:update_code", "delayed_job:setup"
8
- after "deploy:restart", "delayed_job:restart"
9
-
10
- monit_config "delayed_job", <<EOF.dedent, :roles => :worker
11
- <% delayed_job_workers.each do |name, range| %>
12
- check process delayed_job_<%= name %>
13
- with pidfile <%= pid_path %>/delayed_job.<%= name %>.pid
14
- <% if range.nil? %>
15
- start program = "<%= delayed_job_script %> start <%= name %>"
16
- stop program = "<%= delayed_job_script %> stop <%= name %>"
17
- <% else %>
18
- start program = "<%= delayed_job_script %> start <%= name %> <%= range.begin %> <%= range.end %>"
19
- stop program = "<%= delayed_job_script %> stop <%= name %> <%= range.begin %> <%= range.end %>"
20
- <% end %>
21
- group delayed_job
22
-
23
- <% end %>
24
- EOF
9
+ after "deploy:restart", "delayed_job:upgrade"
10
+ after "deploy:start", "delayed_job:start"
11
+ after "deploy:stop", "delayed_job:stop"
25
12
 
26
13
  namespace :delayed_job do
27
14
  desc "Generate DelayedJob configuration files"
@@ -29,12 +16,33 @@ namespace :delayed_job do
29
16
  upload_template_file("delayed_job.sh",
30
17
  delayed_job_script,
31
18
  :mode => "0755")
19
+ upload_template_file("delayed_job@.service",
20
+ delayed_job_service,
21
+ :mode => "0755")
22
+ systemctl "daemon-reload"
23
+ delayed_job_worker.each do |name|
24
+ systemctl :enable, "delayed_job@#{name}"
25
+ end
26
+ end
27
+
28
+ desc "Start delayed job workers"
29
+ task :start, :roles => :app, :except => { :no_release => true } do
30
+ delayed_job_worker.each do |name|
31
+ systemctl :start, "delayed_job@#{name}"
32
+ end
33
+ end
34
+
35
+ desc "Stop delayed job workers"
36
+ task :stop, :roles => :app, :except => { :no_release => true } do
37
+ delayed_job_worker.each do |name|
38
+ systemctl :stop, "delayed_job@#{name}"
39
+ end
32
40
  end
33
41
 
34
- desc "Restart DelayedJob workers"
35
- task :restart, :roles => :worker, :except => { :no_release => true } do
36
- if fetch(:monitrc, false)
37
- run "monit -g delayed_job restart all"
42
+ desc "Restart delayed job workers"
43
+ task :restart, :roles => :app, :except => { :no_release => true } do
44
+ delayed_job_worker.each do |name|
45
+ systemctl :restart, "delayed_job@#{name}"
38
46
  end
39
47
  end
40
48
  end
data/lib/capper/rvm.rb CHANGED
@@ -9,7 +9,7 @@ require "rvm/capistrano"
9
9
  set(:rvm_type, :user)
10
10
  set(:rvm_ruby_string, File.read(".rvmrc").gsub(/^rvm( use)? --create (.*)/, '\2').strip)
11
11
 
12
- _cset(:rvm_version, "1.18.2")
12
+ _cset(:rvm_version, "1.18.18")
13
13
  set(:rvm_install_type) { rvm_version }
14
14
 
15
15
  before "deploy:setup", "rvm:install_ruby"
@@ -0,0 +1,11 @@
1
+ [Unit]
2
+ Description=Delayed Job Worker (%I)
3
+
4
+ [Service]
5
+ Type=forking
6
+ PIDFile=<%= pid_path %>/delayed_job.%I.pid
7
+ ExecStart=<%= delayed_job_script %> start %I
8
+ ExecStop=<%= delayed_job_script %> stop %I
9
+
10
+ [Install]
11
+ WantedBy=default.target
@@ -1,3 +1,3 @@
1
1
  module Capper
2
- VERSION = "2.0.0.pre1"
2
+ VERSION = "2.0.0.pre2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre1
4
+ version: 2.0.0.pre2
5
5
  prerelease: 6
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-03-07 00:00:00.000000000 Z
12
+ date: 2013-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
@@ -121,6 +121,7 @@ files:
121
121
  - lib/capper/rails.rb
122
122
  - lib/capper/ruby.rb
123
123
  - lib/capper/rvm.rb
124
+ - lib/capper/templates/delayed_job.service.erb
124
125
  - lib/capper/templates/delayed_job.sh.erb
125
126
  - lib/capper/templates/maintenance.html.erb
126
127
  - lib/capper/templates/manage.py.erb