Sha256: 724fb729cc3ebde335d8b5d1c4bdfa89433cc47d473a2a65771dc46e797d0015

Contents?: true

Size: 1.73 KB

Versions: 4

Compression:

Stored size: 1.73 KB

Contents

git_plugin = self

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

    desc 'Monitor Puma monit-service'
    task :monitor do
      on roles(fetch(:puma_role)) do
        begin
          git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)} monitor #{puma_monit_service_name}"
        rescue
          invoke 'puma:monit:config'
          git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)} monitor #{puma_monit_service_name}"
        end
      end
    end

    desc 'Unmonitor Puma monit-service'
    task :unmonitor do
      on roles(fetch(:puma_role)) do
        begin
          git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)} unmonitor #{puma_monit_service_name}"
        rescue
          # no worries here (still no monitoring)
        end
      end
    end

    desc 'Start Puma monit-service'
    task :start do
      on roles(fetch(:puma_role)) do
        git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)} start #{puma_monit_service_name}"
      end
    end

    desc 'Stop Puma monit-service'
    task :stop do
      on roles(fetch(:puma_role)) do
        git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)}  stop #{puma_monit_service_name}"
      end
    end

    desc 'Restart Puma monit-service'
    task :restart do
      on roles(fetch(:puma_role)) do
        git_plugin.sudo_if_needed "#{fetch(:puma_monit_bin)} restart #{puma_monit_service_name}"
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano3-puma-3.1.0 lib/capistrano/tasks/monit.rake
capistrano3-puma-3.0.3 lib/capistrano/tasks/monit.rake
capistrano3-puma-3.0.2 lib/capistrano/tasks/monit.rake
capistrano3-puma-3.0.1 lib/capistrano/tasks/monit.rake