Sha256: 9355d690ae35a8897bb7c230c871b1e44cd5cb9b0ff9f67553fb04c5226e861a

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_monit_#{fetch(:application)}")
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
capistrano3-puma-0.4.2 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.4.1 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.4.0 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.3.7 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.3.3 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.2.2 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.2.0 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.1.3 lib/capistrano/tasks/monit.cap
capistrano3-puma-0.1.2 lib/capistrano/tasks/monit.cap