lib/capistrano/tasks/runit.rake in capistrano-monit_runit-3.1.1 vs lib/capistrano/tasks/runit.rake in capistrano-monit_runit-3.1.2

- old
+ new

@@ -32,11 +32,11 @@ end namespace :runit do desc 'Setup runit for the application' task :setup do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| info "RUNIT: Setting up initial runit configuration on #{host}" if test "[ ! -f #{fetch(:runit_dir)}/.env/HOME ]" if test "[ ! -d #{fetch(:runit_dir)}/.env ]" execute :mkdir, "-p '#{fetch(:runit_dir)}/.env'" end @@ -46,11 +46,11 @@ end namespace :setup do # '[INTERNAL] create /etc/sv folders and upload base templates needed' task :runit_create_app_services do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| within("#{runit_user_base_path}") do execute :mkdir, "-p #{app_env_folder}" end upload! template_to_s_io(fetch(:runit_run_template)), runit_run_file @@ -62,11 +62,11 @@ end end # [Internal] create log service for app task :runit_create_app_log_services do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| within("#{runit_base_path}") do execute :mkdir, '-p log' end upload! template_to_s_io(fetch(:runit_log_run_template)), runit_log_run_file execute :mkdir, "-p #{runit_var_log_service_runit_path}" if test("[ ! -d #{runit_var_log_service_runit_path} ]") @@ -75,20 +75,20 @@ info "RUNIT: Created inital runit log services in #{runit_base_log_path} for #{fetch(:application)} on #{host}" end end # '[INTERNAL] create /etc/sv folders and upload base templates needed' task :runit_ensure_shared_sockets_and_pids_folders do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| execute :mkdir, fetch(:pids_path) if test("[ ! -d #{fetch(:pids_path)} ]") execute :mkdir, fetch(:sockets_path) if test("[ ! -d #{fetch(:sockets_path)} ]") end end end desc 'Disable runit services for application' task :disable do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| if test "[ -h #{runit_etc_service_app_symlink_name} ]" execute :rm, "-rf '#{runit_etc_service_app_symlink_name}'" info "RUNIT disabling on '#{host}'" else info "RUNIT already disabled on '#{host}'" @@ -96,11 +96,11 @@ end end desc 'Enable runit services for application' task :enable do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| if test "[ ! -h #{runit_etc_service_app_symlink_name} ]" execute :ln, "-sf '#{runit_base_path}' '#{runit_etc_service_app_symlink_name}'" info "RUNIT enabling on '#{host}'" else info "RUNIT already enabled on '#{host}'" @@ -108,20 +108,20 @@ end end desc 'Purge/remove all runit configurations for the application' task :purge do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| execute :rm, "-rf #{runit_etc_service_app_symlink_name}" execute :rm, "-rf #{runit_base_path}" info "RUNIT purging config on '#{host}'" end end %w(stop start once restart).each do |single_cmd| desc "#{single_cmd} runit services for application" task single_cmd.to_sym do - on roles(:app) do |host| + on roles([:app, :worker]) do |host| info "RUNIT: #{single_cmd} on #{host}" runit_app_services_control(single_cmd) end end end