lib/capistrano/tasks/runit.rake in capistrano-monit_runit-3.0.4 vs lib/capistrano/tasks/runit.rake in capistrano-monit_runit-3.1.0

- old
+ new

@@ -30,31 +30,10 @@ set :runit_autorestart_clear_interval, 90 end end namespace :runit do - desc 'Get the config needed to add to sudoers for all commands' - task :sudoers do - run_locally do - puts '# -----------------------------------------------------------------------------------------' - puts "# Sudo runit entries for #{fetch(:application)}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/mkdir -p #{runit_user_base_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chown #{fetch(:user)}\\:root #{runit_user_base_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chmod 6775 #{runit_user_base_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/mkdir -p #{runit_etc_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chown #{fetch(:user)}\\:root #{runit_etc_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chmod 6775 #{runit_etc_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/mkdir -p #{runit_var_log_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chown #{fetch(:user)}\\:root #{runit_var_log_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chown -R #{fetch(:user)}\\:#{fetch(:runit_log_group)} #{runit_var_log_service_path}" # rubocop:disable Metrics/LineLength: - puts "#{fetch(:user)} ALL=NOPASSWD: /bin/chmod 6775 #{runit_var_log_service_path}" - puts "#{fetch(:user)} ALL=NOPASSWD: /usr/bin/sv *" - puts '# -----------------------------------------------------------------------------------------' - end - # info "#{fetch(:user)} ALL=NOPASSWD: /bin/chown deploy:root #{monit_monitrc_file}" - end - desc 'Setup runit for the application' task :setup do on roles(:app) do |host| info "RUNIT: Setting up initial runit configuration on #{host}" if test "[ ! -f #{fetch(:runit_dir)}/.env/HOME ]" @@ -68,27 +47,17 @@ namespace :setup do # '[INTERNAL] create /etc/sv folders and upload base templates needed' task :runit_create_app_services do on roles(:app) do |host| - # set :pw, ask("Sudo password", '') - # execute :echo, "#{fetch(:pw)} | sudo -S ls /" - execute :sudo, :mkdir, "-p '#{runit_user_base_path}'" if test("[ ! -d '#{runit_user_base_path}' ]") - execute :sudo, :chown, "#{fetch(:user)}:root '#{runit_user_base_path}'" - execute :sudo, :chmod, "6775 '#{runit_user_base_path}'" - - execute :sudo, :mkdir, "-p '#{runit_etc_service_path}'" if test("[ ! -d '#{runit_etc_service_path}' ]") - execute :sudo, :chown, "#{fetch(:user)}:root '#{runit_etc_service_path}'" - execute :sudo, :chmod, "6775 '#{runit_etc_service_path}'" 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 upload! template_to_s_io(fetch(:runit_finish_template)), runit_finish_file - # Should now work without sudo... ? execute :chmod, "0775 '#{runit_run_file}'" execute :chmod, "0775 '#{runit_finish_file}'" info "RUNIT: Created inital runit services in #{runit_base_path} for #{fetch(:application)} on #{host}" end end @@ -98,15 +67,10 @@ on roles(:app) 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 - if test("[ ! -d #{runit_var_log_service_path} ]") - execute :sudo, :mkdir, "-p '#{runit_var_log_service_path}'" - execute :sudo, :chmod, "6775 '#{runit_var_log_service_path}'" - execute :sudo, :chown, "-R #{fetch(:user)}:#{fetch(:runit_log_group)} '#{runit_var_log_service_path}'" # rubocop:disable Metrics/LineLength: - end execute :mkdir, "-p #{runit_var_log_service_runit_path}" if test("[ ! -d #{runit_var_log_service_runit_path} ]") execute :chmod, "775 '#{runit_log_run_file}'" info "RUNIT: Created inital runit log services in #{runit_base_log_path} for #{fetch(:application)} on #{host}" end @@ -169,6 +133,5 @@ after 'deploy:updated', 'runit:enable' # after 'deploy:setup', 'runit:setup' after 'runit:setup', 'runit:setup:runit_create_app_services' after 'runit:setup:runit_create_app_services', 'runit:setup:runit_create_app_log_services' after 'runit:setup:runit_create_app_services', 'runit:setup:runit_ensure_shared_sockets_and_pids_folders' -after 'sudoers', 'runit:sudoers'