Sha256: 974d6847ecbfa4ab69ef00305303edd26eaea27de99dab2aa459f2f496c9c1b3

Contents?: true

Size: 1.57 KB

Versions: 9

Compression:

Stored size: 1.57 KB

Contents

namespace :load do
  task :defaults do
    set :puma_monit_conf_dir, -> { "/etc/monit/conf.d/#{puma_monit_service_name}.conf" }
    set :puma_monit_bin, -> { "/usr/bin/monit" }
  end
end


namespace :puma do
  namespace :monit do
    desc 'Config Puma monit-service'
    task :config do
      on roles(fetch(:puma_role)) do |role|
        @role = role
        template_puma 'puma_monit.conf', "#{fetch(:tmp_dir)}/monit.conf", @role
        sudo "mv #{fetch(:tmp_dir)}/monit.conf #{fetch(:puma_monit_conf_dir)}"
      end
    end

    desc 'Monitor Puma monit-service'
    task :monitor do
      on roles(fetch(:puma_role)) do
        sudo "#{fetch(:puma_monit_bin)} monitor #{puma_monit_service_name}"
      end
    end

    desc 'Unmonitor Puma monit-service'
    task :unmonitor do
      on roles(fetch(:puma_role)) do
        sudo "#{fetch(:puma_monit_bin)}  unmonitor #{puma_monit_service_name}"
      end
    end

    desc 'Disable Puma monit-service'
    task :start do
      on roles(fetch(:puma_role)) do
        sudo "#{fetch(:puma_monit_bin)}  start #{puma_monit_service_name}"
      end
    end

    desc 'Disable Puma monit-service'
    task :stop do
      on roles(fetch(:puma_role)) do
        sudo "#{fetch(:puma_monit_bin)}  stop #{puma_monit_service_name}"
      end
    end

    desc 'Disable Puma monit-service'
    task :restart do
      on roles(fetch(:puma_role)) do
        sudo "#{fetch(:puma_monit_bin)}  restart #{puma_monit_service_name}"
      end
    end

    def puma_monit_service_name
      fetch(:puma_monit_service_name, "puma_#{fetch(:application)}")
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
capistrano3-puma-0.8.3 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.8.2 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.8.1 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.8.0 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.7.0 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.6.1 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.6.0 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.5.1 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.5.0 lib/capistrano/tasks/monit.cap