module Capistrano::DSL::RunitPaths

Paths and filenames for runit

Main app services are placed under /etc/sv/username/appname_env

They are symlinked for enabling / disabling the entire app like this: /etc/service/username_appname_env –> /etc/sv/username/appname_env

All services run/finish scripts e.g. puma/delayed job etc are located in 'shared_folder'/runit/service_name/

Public Instance Methods

create_service_folders(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 103
def create_service_folders(service_name)
  if test "[ -d #{runit_service_path(service_name)} ]"
    execute :mkdir, "-p #{runit_service_path(service_name)}"
  end
  if test "[ -d #{runit_service_path(service_name)} ]"
    execute :mkdir, "-p #{runit_service_path(service_name)}"
  end
end
runit_base_log_path() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 28
def runit_base_log_path
  File.join(runit_base_path, 'log')
end
runit_base_path() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 24
def runit_base_path
  File.join(runit_user_base_path, app_env_folder)
end
runit_etc_service_path() click to toggle source

/etc/service

# File lib/capistrano/dsl/runit_paths.rb, line 58
def runit_etc_service_path
  File.join('/etc', 'service')
end
runit_etc_sv_path() click to toggle source

/etc/sv

# File lib/capistrano/dsl/runit_paths.rb, line 16
def runit_etc_sv_path
  File.join('/etc', 'sv')
end
runit_finish_file() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 36
def runit_finish_file
  File.join(runit_base_path, 'finish')
end
runit_log_run_file() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 40
def runit_log_run_file
  File.join(runit_base_log_path, 'run')
end
runit_run_file() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 32
def runit_run_file
  File.join(runit_base_path, 'run')
end
runit_service_control_file(service_name, control_letter) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 79
def runit_service_control_file(service_name, control_letter)
  File.join(runit_service_control_path(service_name), control_letter)
end
runit_service_control_path(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 75
def runit_service_control_path(service_name)
  File.join(runit_service_path(service_name), 'control')
end
runit_service_finish_config_file(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 99
def runit_service_finish_config_file(service_name)
  File.join(runit_service_path(service_name), "#{service_name}_finish")
end
runit_service_finish_file(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 91
def runit_service_finish_file(service_name)
  File.join(runit_service_path(service_name), 'finish')
end
runit_service_log_path(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 71
def runit_service_log_path(service_name)
  File.join(runit_service_path(service_name), 'log')
end
runit_service_log_run_file(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 83
def runit_service_log_run_file(service_name)
  File.join(runit_service_log_path(service_name), 'run')
end
runit_service_path(service_name) click to toggle source

Paths and files in shared_folder

# File lib/capistrano/dsl/runit_paths.rb, line 67
def runit_service_path(service_name)
  File.join(fetch(:runit_dir), service_name)
end
runit_service_run_config_file(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 95
def runit_service_run_config_file(service_name)
  File.join(runit_service_path(service_name), "#{service_name}_run")
end
runit_service_run_file(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 87
def runit_service_run_file(service_name)
  File.join(runit_service_path(service_name), 'run')
end
runit_user_base_path() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 20
def runit_user_base_path
  File.join(runit_etc_sv_path, fetch(:user))
end
runit_var_log_service_path() click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 44
def runit_var_log_service_path
  File.join('/var', 'log', 'service')
end
runit_var_log_service_runit_path() click to toggle source

/var/log/service/'usr_app_env_folder'/runit

# File lib/capistrano/dsl/runit_paths.rb, line 53
def runit_var_log_service_runit_path
  runit_var_log_service_single_service_path('runit')
end
runit_var_log_service_single_service_path(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 48
def runit_var_log_service_single_service_path(service_name)
  File.join(runit_var_log_service_path, user_app_env_underscore, service_name)
end
service_pid(service_name) click to toggle source
# File lib/capistrano/dsl/runit_paths.rb, line 112
def service_pid(service_name)
  File.join(runit_service_path(service_name), 'supervise', 'pid')
end