capistrano-cluster 0.0.16 → 0.0.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a4220aec1090ee79aae7f236886a33f8a4a65c9
4
- data.tar.gz: 76111c1e0d861ea0a4f9c27cb11b2f0c1cc80640
3
+ metadata.gz: 0d28ece80a04cd0257e5f97a30d46ceeddfbb109
4
+ data.tar.gz: 295470587952175f419e1ad53bbd8946eee57777
5
5
  SHA512:
6
- metadata.gz: 146ed326d4543951d918647430704633cd3227ef2e0964972f2cfbf2ea9ba5b394944185a902c9e4af547aea0efd5d6747f6af2ba25c9266d01cb716b849ddea
7
- data.tar.gz: d6df8b86fa20394cda21669afd89d3c9a9ae0a884259e691e150bbe3667ae18758c47aee2c37cb8eb7e2fcf0a0e5d7b1742ea8857ed2206ac039144f08037ebc
6
+ metadata.gz: ecf82851ea29275807ae1dadb5987c828305948cdca1b01ceb2d85db0788ed8d272583088307f0a0f8a8af3196f082f3cc02b4f97942ab5d786f1ce7ad630cc0
7
+ data.tar.gz: 3c8a45f2cd05e6aa49af4d88f936ea2b4587eea90ff83621d2ebb4cbbdcceb8fc7505b2bac39c8becbd53e8c0d187ffddc09e872282e51880f9cfa116fb197f6
@@ -2,9 +2,9 @@ local all postgres trust
2
2
  local all all md5
3
3
  host all all 127.0.0.1/32 md5
4
4
  host all all ::1/128 md5
5
- #local replication postgres peer
6
- #host replication postgres 127.0.0.1/32 md5
7
- #host replication postgres ::1/128 md5
5
+ local replication postgres md5
6
+ host replication postgres 127.0.0.1/32 md5
7
+ host replication postgres ::1/128 md5
8
8
  <% allowed_hosts.each do |host| %>
9
9
  host all all <%= host%>/32 md5
10
10
  <%end %>
@@ -1,10 +1,10 @@
1
1
 
2
- require 'capistrano/setup'
3
- require 'capistrano/deploy'
4
- require 'capistrano/bundler'
5
- require 'capistrano/rails/assets'
6
- require 'capistrano/rails/migrations'
7
- require 'capistrano/rails'
2
+ require "capistrano/setup"
3
+ require "capistrano/deploy"
4
+ require "capistrano/bundler"
5
+ require "capistrano/rails/assets"
6
+ require "capistrano/rails/migrations"
7
+ require "capistrano/rails"
8
8
 
9
9
  require "capistrano/cluster/version"
10
10
  require "capistrano/cluster/core_ext/object"
@@ -14,14 +14,14 @@ require "capistrano/cluster/files"
14
14
  require "capistrano/cluster/paths"
15
15
  require "capistrano/cluster/service"
16
16
 
17
- set :default_templates_path, File.expand_path('../../../files',__FILE__)
17
+ set :default_templates_path, File.expand_path("../../../files", __FILE__)
18
18
 
19
19
  module Capistrano
20
20
  module Cluster
21
21
  end
22
22
  end
23
23
 
24
- tasks_path = Pathname(File.expand_path('../../../tasks/',__FILE__))
24
+ tasks_path = Pathname(File.expand_path("../../../tasks/", __FILE__))
25
25
 
26
26
  import tasks_path.join("setup.rake")
27
27
  import tasks_path.join("setup/firewall.rake")
@@ -32,4 +32,3 @@ end
32
32
 
33
33
  import tasks_path.join("deploy.rake")
34
34
  import tasks_path.join("deploy/application.rake")
35
-
@@ -59,4 +59,4 @@ end
59
59
 
60
60
  include Capistrano::Cluster::Packages::DSL
61
61
 
62
- set :files_path, fetch(:files_path, Pathname(fetch(:deploy_config_path)).dirname.join("files"))
62
+ set :files_path, fetch(:files_path, Pathname(fetch(:deploy_config_path, "./deploy")).dirname.join("files"))
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Cluster
3
- VERSION = "0.0.16"
3
+ VERSION = "0.0.17"
4
4
  end
5
5
  end
@@ -1,9 +1,6 @@
1
1
  namespace :deploy do
2
-
3
2
  namespace :check do
4
-
5
3
  task :application do
6
-
7
4
  on roles(:app) do
8
5
  sudo :mkdir, "-p", deploy_to, shared_path.join("config")
9
6
  sudo :chown, "-R", fetch(:user), deploy_to, shared_path.join("config")
@@ -15,22 +12,19 @@ namespace :deploy do
15
12
  invoke "deploy:application:db"
16
13
  invoke "deploy:application:proxy"
17
14
  end
18
-
19
15
  end
20
16
 
21
17
  namespace :application do
22
-
23
18
  task :secrets do
24
-
25
19
  on roles(:app) do
26
20
  env = StringIO.new
27
21
  gc_settings = {
28
- "RUBY_HEAP_MIN_SLOTS" => 800000,
29
- "RUBY_FREE_MIN" => 100000,
30
- "RUBY_GC_MALLOC_LIMIT" => 59000000
22
+ "RUBY_HEAP_MIN_SLOTS" => 800_000,
23
+ "RUBY_FREE_MIN" => 100_000,
24
+ "RUBY_GC_MALLOC_LIMIT" => 59_000_000
31
25
  }
32
26
 
33
- fetch(:secrets, {}).merge(gc_settings).each_pair do |key,value|
27
+ fetch(:secrets, {}).merge(gc_settings).each_pair do |key, value|
34
28
  env.puts "export #{"#{key}".upcase}='#{Shellwords.shellescape(value)}'"
35
29
  end
36
30
  env.rewind
@@ -39,16 +33,10 @@ namespace :deploy do
39
33
  yaml = StringIO.new({ "#{fetch(:framework_env)}" => fetch(:secrets, {}) }.to_yaml)
40
34
 
41
35
  upload! yaml, shared_path.join("config/secrets.yml")
42
-
43
36
  end
44
-
45
37
  end
46
-
47
-
48
38
  end
49
-
50
39
  end
51
40
 
52
41
  before "deploy:symlink:linked_files", "check:application"
53
42
  before "deploy:check:directories", "check:application"
54
-
data/tasks/roles/db.rake CHANGED
@@ -1,42 +1,36 @@
1
- #TODO (vvlad): tune using pgtune
1
+ # TODO: (vvlad): tune using pgtune
2
2
  namespace :setup do
3
-
4
3
  task :db do
5
-
6
4
  on roles(:db) do
7
-
8
5
  install "postgresql-9.3", "postgresql-9.3-postgis-2.1"
9
6
  allowed_hosts = roles(:app).map(&:to_s)
10
- upload_as :postgres, file("pg_hba.conf", allowed_hosts: allowed_hosts), "/etc/postgresql/9.3/main/pg_hba.conf"
11
- upload_as :postgres, file("postgresql.conf", allowed_hosts: allowed_hosts), "/etc/postgresql/9.3/main/postgresql.conf"
7
+ upload_as :postgres, file("pg_hba.conf", allowed_hosts: allowed_hosts),
8
+ "/etc/postgresql/9.3/main/pg_hba.conf"
9
+ upload_as :postgres, file("postgresql.conf", allowed_hosts: allowed_hosts),
10
+ "/etc/postgresql/9.3/main/postgresql.conf"
12
11
 
13
12
  if test "[ ! -f /var/lib/postgresql/.first-time ]"
14
13
  sudo :service, "postgresql", :restart
15
- sudo :touch, '/var/lib/postgresql/.first-time'
14
+ sudo :touch, "/var/lib/postgresql/.first-time"
16
15
  else
17
16
  sudo :service, "postgresql", :reload
18
17
  end
19
18
  end
20
-
21
19
  end
22
-
23
20
  end
24
21
 
25
22
  after "setup:system", "setup:db"
26
23
 
27
24
  namespace :deploy do
28
25
  namespace :application do
29
-
30
26
  task :db do
31
-
32
- unless fetch(:database,{}).empty?
27
+ unless fetch(:database, {}).empty?
33
28
  db_user = fetch(:database)[:username]
34
29
  db_pass = fetch(:database)[:password]
35
30
  db_name = fetch(:database).fetch(:name, fetch(:application))
36
31
  enconding = fetch(:database)[:enconding] || "utf-8"
37
32
 
38
33
  on roles(:db) do
39
-
40
34
  if capture(:psql, "-U", "postgres", "template1", "-t", "-c", "SELECT 1 FROM pg_catalog.pg_user WHERE usename = '#{db_user}'".shellescape).empty?
41
35
  execute :psql, "-U", "postgres", "-c", "CREATE ROLE #{db_user} LOGIN PASSWORD '#{db_pass}';".shellescape
42
36
  end
@@ -45,7 +39,6 @@ namespace :deploy do
45
39
  execute :psql, "-U", "postgres", "-c", "CREATE DATABASE #{db_name} ENCODING '#{enconding}' OWNER #{db_user};".shellescape
46
40
  execute :psql, "-U", "postgres", "#{db_name}", "-c", "CREATE EXTENSION postgis;".shellescape
47
41
  end
48
-
49
42
  end
50
43
 
51
44
  on roles(:app) do
@@ -55,14 +48,12 @@ namespace :deploy do
55
48
  name: db_name,
56
49
  adapter: 'postgresql',
57
50
  encoding: 'utf-8',
58
- options:{}
51
+ options: {}
59
52
  }
60
53
  settings = defaults.merge(fetch(:database))
61
54
  upload! file("database.yml", settings), "#{shared_path}/config/database.yml"
62
55
  end
63
56
  end
64
-
65
57
  end
66
-
67
58
  end
68
59
  end
@@ -2,26 +2,20 @@ solr_version = fetch(:solr_version, "4.9.0")
2
2
 
3
3
  set :solr_version, solr_version
4
4
  set :solr_url, fetch(:solr_url, "http://www.eu.apache.org/dist/lucene/solr/#{solr_version}/solr-#{solr_version}.tgz")
5
- set :solr_checksum, 'ae47a89f35b5e2a6a4e55732cccc64fb10ed9779'
5
+ set :solr_checksum, "ae47a89f35b5e2a6a4e55732cccc64fb10ed9779"
6
6
  set :solr_data, "/var/lib/solr"
7
7
  set :solr_dist, "/opt/solr"
8
8
  set :solr_user, "solr"
9
9
 
10
-
11
10
  namespace :setup do
12
-
13
11
  desc "Boostraps solr nodes"
14
12
  task :indexer do
15
-
16
13
  on roles(:indexer) do
17
-
18
14
  solr_dist = fetch(:solr_dist)
19
15
  solr_data = fetch(:solr_data)
20
16
 
21
-
22
17
  if test "[ ! -e '/etc/init.d/solr' ]"
23
18
 
24
-
25
19
  install "openjdk-7-jre-headless"
26
20
 
27
21
  sudo :mkdir, "-p", solr_dist
@@ -46,21 +40,15 @@ namespace :setup do
46
40
  end
47
41
 
48
42
  sudo "nohup /etc/init.d/solr restart"
49
-
50
43
  end
51
-
52
-
53
44
  end
54
-
55
45
  end
56
46
 
57
47
  after "setup:system", "setup:indexer"
58
48
 
59
49
  namespace :deploy do
60
50
  namespace :application do
61
-
62
51
  task :indexer do
63
-
64
52
  config = { application: fetch(:application), name: fetch(:solr_core) }
65
53
 
66
54
  on roles(:indexer) do
@@ -74,16 +62,12 @@ namespace :deploy do
74
62
  end
75
63
  execute :touch, "#{solr_data}/#{config[:name]}/core.properties"
76
64
  end
77
-
78
65
  end if config[:name]
79
-
80
66
  end
81
-
82
67
  end
83
68
  end
84
69
 
85
-
86
- set :solr_core_files , %w[
70
+ set :solr_core_files, %w[
87
71
  conf/mapping-FoldToASCII.txt
88
72
  conf/schema.xml
89
73
  conf/solrconfig.xml
@@ -127,6 +111,3 @@ set :solr_core_files , %w[
127
111
  conf/lang/stopwords_tr.txt
128
112
  conf/lang/userdict_ja.txt
129
113
  ]
130
-
131
-
132
-
@@ -1,29 +1,23 @@
1
1
  namespace :setup do
2
2
  namespace :mongodb do
3
-
4
3
  task :sources do
5
-
6
4
  on roles(:mongodb) do
7
5
  unless test "[ -f /etc/apt/sources.list.d/mongodb-org-3.0.list ]"
8
- sudo %q[apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10]
9
- execute %q[echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list]
6
+ sudo "apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10"
7
+ repo = 'echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse'
8
+ execute "#{repo} | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list"
10
9
  end
11
10
  end
12
-
13
11
  end
14
-
15
12
  end
16
13
 
17
14
  task :mongodb do
18
-
19
15
  on roles(:mongodb) do
20
16
  install "mongodb-org"
21
17
  upload_as :root, file("etc/mongod.conf"), "/etc/mongod.conf"
22
18
  sudo "restart mongod || start mongod"
23
19
  end
24
-
25
20
  end
26
-
27
21
  end
28
22
 
29
23
  namespace :deploy do
@@ -33,16 +27,15 @@ end
33
27
 
34
28
  namespace :firewall do
35
29
  task :mongodb do
36
- on roles(:mongodb) do |server|
37
- sudo :ufw, :allow, :in, 27017
38
- sudo :ufw, :allow, :in, 27018
39
- sudo :ufw, :allow, :in, 27019
40
- sudo :ufw, :allow, :in, 28017
30
+ on roles(:mongodb) do |_|
31
+ sudo :ufw, :allow, :in, "27017"
32
+ sudo :ufw, :allow, :in, "27018"
33
+ sudo :ufw, :allow, :in, "27019"
34
+ sudo :ufw, :allow, :in, "28017"
41
35
  end
42
36
  end
43
37
  end
44
38
 
45
-
46
39
  before "deploy:publishing", "deploy:mongodb"
47
40
  after "setup:firewall", "firewall:mongodb"
48
41
  after "setup:system", "setup:mongodb"
@@ -1,47 +1,37 @@
1
1
  set :proxy_files, fetch(:proxy_files,{})
2
2
  namespace :setup do
3
-
4
3
  task :proxy do
4
+ on roles(:proxy) do
5
+ install "nginx"
5
6
 
6
- on roles(:proxy) do
7
-
8
- install "nginx"
9
-
10
- upload_as :root, file("lb-sysctl.conf"), "/etc/sysctl.d/20-web.conf"
11
- sudo :sysctl, "-p", "/etc/sysctl.d/20-web.conf"
12
- sudo :mkdir, "-p", "/etc/nginx/servers"
13
- upload_as :root, file("nginx/lb-nginx.conf", user: fetch(:user)), "/etc/nginx/nginx.conf", mode: 644
14
-
15
- sudo :rm, "-f", *%w[fastcgi_params proxy_params scgi_params uwsgi_params].map { |file| file.prepend("/etc/nginx/") }
16
- sudo :rm, "-rf", *%w[sites-available sites-enabled conf.d].map { |file| file.prepend("/etc/nginx/") }
17
-
18
- sudo "bash -c 'nginx -s reload || service nginx restart'"
7
+ upload_as :root, file("lb-sysctl.conf"), "/etc/sysctl.d/20-web.conf"
8
+ sudo :sysctl, "-p", "/etc/sysctl.d/20-web.conf"
9
+ sudo :mkdir, "-p", "/etc/nginx/servers"
10
+ upload_as :root, file("nginx/lb-nginx.conf", user: fetch(:user)), "/etc/nginx/nginx.conf", mode: 644
19
11
 
12
+ sudo :rm, "-f", *%w[fastcgi_params proxy_params scgi_params uwsgi_params].map do |file|
13
+ file.prepend("/etc/nginx/")
20
14
  end
15
+ sudo :rm, "-rf", *%w[sites-available sites-enabled conf.d].map { |file| file.prepend("/etc/nginx/") }
21
16
 
17
+ sudo "bash -c 'nginx -s reload || service nginx restart'"
18
+ end
22
19
  end
23
-
24
20
  end
25
21
 
26
22
  after "setup:system", "setup:proxy"
27
23
 
28
24
  namespace :deploy do
29
-
30
25
  namespace :application do
31
-
32
26
  task :proxy do
33
-
34
27
  on roles(:proxy) do
35
-
36
28
  shared_path = Pathname.new("/etc/nginx/servers/#{fetch(:application)}-#{fetch(:framework_env)}")
37
29
 
38
- sudo :mkdir, '-p', shared_path
30
+ sudo :mkdir, "-p", shared_path
39
31
  sudo :chown, "-R", fetch(:user), shared_path
40
32
 
41
- if ssl_certificate = fetch(:ssl_certificate)
42
- upload_as :root, StringIO.new(ssl_certificate), shared_path.join("ssl.pem")
43
- end
44
-
33
+ ssl_certificate = fetch(:ssl_certificate)
34
+ upload_as :root, StringIO.new(ssl_certificate), shared_path.join("ssl.pem") if ssl_certificate
45
35
  fetch(:proxy_files).each_pair do |file, remote_file|
46
36
  upload_as :root, file(file), shared_path.join(remote_file)
47
37
  end
@@ -49,11 +39,7 @@ namespace :deploy do
49
39
  upload_as :root, file("nginx/lb-application.conf", ssl: ssl_certificate), shared_path.join("nginx.conf")
50
40
 
51
41
  sudo "bash -c 'nginx -s reload || service nginx restart'"
52
-
53
42
  end
54
-
55
43
  end
56
-
57
44
  end
58
-
59
45
  end
@@ -1,36 +1,29 @@
1
1
 
2
2
  namespace :setup do
3
-
4
3
  before :package_sources, :"rabbitmq:sources"
5
-
6
-
7
4
  namespace :rabbitmq do
8
5
  task :sources do
9
-
10
6
  on roles(:rabbitmq) do
11
7
  unless test "[ -f /etc/apt/sources.list.d/rabbitmq.list ]"
12
- execute %q[wget --quiet -O - http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -]
13
- upload_as :root, StringIO.new("deb http://www.rabbitmq.com/debian/ testing main"), "/etc/apt/sources.list.d/rabbitmq.list"
8
+ execute "wget --quiet -O - http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | sudo apt-key add -"
9
+ upload_as :root,
10
+ StringIO.new("deb http://www.rabbitmq.com/debian/ testing main"),
11
+ "/etc/apt/sources.list.d/rabbitmq.list"
14
12
  end
15
13
  end
16
-
17
14
  end
18
15
  end
19
16
 
20
17
  task :rabbitmq do
21
-
22
18
  on roles(:rabbitmq) do
23
19
  install "rabbitmq-server"
24
20
  upload_as :rabbitmq, StringIO.new("[rabbitmq_management,rabbitmq_management_visualiser,rabbitmq_stomp,rabbitmq_amqp1_0,rabbitmq_mqtt]."), "/etc/rabbitmq/enabled_plugins"
25
21
  end
26
-
27
22
  end
28
-
29
23
  end
30
24
 
31
25
  after "setup:system", "setup:rabbitmq"
32
26
 
33
-
34
27
  namespace :deploy do
35
28
  task :rabbitmq do
36
29
  end
@@ -38,7 +31,7 @@ end
38
31
 
39
32
  namespace :firewall do
40
33
  task :rabbitmq do
41
- on roles(:rabbitmq) do |server|
34
+ on roles(:rabbitmq) do |_|
42
35
  sudo :ufw, :allow, :in, :epmd
43
36
  sudo :ufw, :allow, :in, :amqp
44
37
  sudo :ufw, :allow, :in, :'25672'
@@ -47,6 +40,5 @@ namespace :firewall do
47
40
  end
48
41
  end
49
42
 
50
-
51
43
  before "deploy:publishing", "deploy:rabbitmq"
52
44
  after "setup:firewall", "firewall:rabbitmq"
@@ -3,30 +3,26 @@ namespace :deploy do
3
3
  before :starting, "deploy:resque:deployment_hooks"
4
4
 
5
5
  namespace :resque do
6
-
7
6
  task :deployment_hooks do
8
- after 'deploy:starting', 'deploy:resque:stop'
9
- after 'deploy:updated', 'deploy:resque:update'
10
- after 'deploy:reverted', 'deploy:resque:stop'
11
- after 'deploy:published', 'deploy:resque:start'
7
+ after "deploy:starting", "deploy:resque:stop"
8
+ after "deploy:updated", "deploy:resque:update"
9
+ after "deploy:reverted", "deploy:resque:stop"
10
+ after "deploy:published", "deploy:resque:start"
12
11
  end
13
12
 
14
13
  task :stop do
15
14
  on roles(:resque) do
16
- service = [fetch(:application), fetch(:stage), 'resque', '*'].join("-")
15
+ service = [fetch(:application), fetch(:stage), "resque", "*"].join("-")
17
16
  execute :find, "/etc/init.d", "-type f", "-name #{service}", "-exec {} stop \\;"
18
17
  end
19
18
  on primary :resque_scheduler do
20
19
  execute "/etc/init.d/#{fetch(:application)}-scheduler stop || true"
21
20
  end
22
-
23
21
  end
24
22
 
25
-
26
23
  task update: :stop do
27
24
  on roles(:resque) do |host|
28
-
29
- match = [fetch(:application), fetch(:stage), 'resque', '*'].join("-")
25
+ match = [fetch(:application), fetch(:stage), "resque", "*"].join("-")
30
26
  sudo :find, "/etc/init.d", "-type f", "-name '#{match}'", "-exec rm -f {} \\;"
31
27
 
32
28
  if test "[ -f /etc/init/#{fetch(:application)}-worker.conf ]"
@@ -35,8 +31,7 @@ namespace :deploy do
35
31
  end
36
32
 
37
33
  host.properties.workers.to_i.times do |worker_id|
38
-
39
- service_name = [fetch(:application), fetch(:stage), 'resque', worker_id].join("-")
34
+ service_name = [fetch(:application), fetch(:stage), "resque", worker_id].join("-")
40
35
  service service_name do
41
36
  user fetch(:user)
42
37
  working_dir release_path
@@ -44,16 +39,15 @@ namespace :deploy do
44
39
  pid_file shared_path.join("tmp/pids/resque-#{worker_id}.pid")
45
40
  log_file shared_path.join("log/resque-#{worker_id}.log")
46
41
 
47
- start "bundle exec rake resque:work RAILS_ENV=#{fetch(:framework_env)} 'QUEUE=*' PIDFILE=#{pid_file} INTERVAL=#{fetch(:resque_interval, 0.1)} LOGFILE=#{log_file}"
42
+ env = "RAILS_ENV=#{fetch(:framework_env)} 'QUEUE=*' PIDFILE=#{pid_file}"
43
+ env << " INTERVAL=#{fetch(:resque_interval, 0.1)} LOGFILE=#{log_file}"
44
+ start "bundle exec rake resque:work #{env}"
48
45
  stop "kill -QUIT $(cat '#{pid_file}')"
49
-
50
46
  end
51
47
  end
52
-
53
48
  end
54
49
 
55
50
  on primary :resque_scheduler do
56
-
57
51
  service "#{fetch(:application)}-scheduler" do
58
52
  user fetch(:user)
59
53
  working_dir release_path
@@ -61,19 +55,18 @@ namespace :deploy do
61
55
  pid_file shared_path.join("tmp/pids/resque-scheduler.pid")
62
56
  log_file shared_path.join("log/resque-scheduler.log")
63
57
 
64
- start "bundle exec rake environment resque:scheduler RAILS_ENV=#{fetch(:framework_env)} 'QUEUE=*' PIDFILE=#{pid_file} RESQUE_SCHEDULER_INTERVAL=#{fetch(:resque_interval, 0.1)} LOGFILE=#{log_file}"
58
+ env = "RAILS_ENV=#{fetch(:framework_env)} 'QUEUE=*' PIDFILE=#{pid_file}"
59
+ env << " RESQUE_SCHEDULER_INTERVAL=#{fetch(:resque_interval, 0.1)} LOGFILE=#{log_file}"
60
+ start "bundle exec rake environment resque:scheduler #{env}"
65
61
  stop "kill -QUIT $(cat '#{pid_file}')"
66
62
  end
67
-
68
63
  end
69
64
  end
70
65
 
71
-
72
66
  task :start do
73
67
  on roles(:resque) do
74
-
75
68
  host.properties.workers.to_i.times do |worker_id|
76
- service_name = [fetch(:application), fetch(:stage), 'resque', worker_id].join("-")
69
+ service_name = [fetch(:application), fetch(:stage), "resque", worker_id].join("-")
77
70
  sudo "/etc/init.d/#{service_name}", :start
78
71
  end
79
72
  end
@@ -83,14 +76,8 @@ namespace :deploy do
83
76
  sudo "/etc/init.d/#{fetch(:application)}-scheduler", :start
84
77
  end
85
78
  end
86
-
87
79
  end
88
80
 
89
81
  task restart: [:stop, :start]
90
-
91
-
92
82
  end
93
-
94
83
  end
95
-
96
-
@@ -1,13 +1,12 @@
1
1
  namespace :deploy do
2
-
3
2
  before :starting, "deploy:sidekiq:deployment_hooks"
4
3
 
5
4
  namespace :sidekiq do
6
5
  task :deployment_hooks do
7
- after 'deploy:starting', 'deploy:sidekiq:stop'
8
- after 'deploy:updated', 'deploy:sidekiq:update'
9
- after 'deploy:reverted', 'deploy:sidekiq:stop'
10
- after 'deploy:published', 'deploy:sidekiq:start'
6
+ after "deploy:starting", "deploy:sidekiq:stop"
7
+ after "deploy:updated", "deploy:sidekiq:update"
8
+ after "deploy:reverted", "deploy:sidekiq:stop"
9
+ after "deploy:published", "deploy:sidekiq:start"
11
10
  end
12
11
 
13
12
  task :update do
@@ -15,16 +14,18 @@ namespace :deploy do
15
14
  service "#{fetch(:application)}-sidekiq" do
16
15
  user fetch(:user)
17
16
  working_dir current_path
18
- start "bundle exec sidekiq -e '#{fetch(:framework_env)}' -C '#{current_path}/config/sidekiq.yml' -L '#{current_path}/log/sidekiq.log' -P '#{current_path}/tmp/pids/sidekiq.pid' #{fetch(:sidekiq_options)}"
17
+ args = "-e '#{fetch(:framework_env)}' -C '#{current_path}/config/sidekiq.yml'"
18
+ args << " -L '#{current_path}/log/sidekiq.log'"
19
+ args << " -P '#{current_path}/tmp/pids/sidekiq.pid' #{fetch(:sidekiq_options)}"
20
+ start "bundle exec sidekiq #{args}"
19
21
  stop "bundle exec sidekiqctl stop '#{current_path}/tmp/pids/sidekiq.pid' 10"
20
22
  end
21
23
  end
22
24
  end
23
25
 
24
-
25
26
  task :start do
26
27
  on roles(:sidekiq) do
27
- sudo "/etc/init.d/#{fetch(:application)}-sidekiq" , :start
28
+ sudo "/etc/init.d/#{fetch(:application)}-sidekiq", :start
28
29
  end
29
30
  end
30
31
 
@@ -35,8 +36,5 @@ namespace :deploy do
35
36
  end
36
37
 
37
38
  task restart: [:stop, :start]
38
-
39
39
  end
40
-
41
40
  end
42
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-cluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Verestiuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,4 +220,3 @@ signing_key:
220
220
  specification_version: 4
221
221
  summary: Environment setup automation.
222
222
  test_files: []
223
- has_rdoc: