Module: Capistrano::DSL::RunitPaths
- Defined in:
- lib/capistrano/dsl/runit_paths.rb
Overview
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/
Instance Method Summary collapse
- #create_service_folders(service_name) ⇒ Object
- #runit_base_log_path ⇒ Object
- #runit_base_path ⇒ Object
- #runit_etc_service_app_symlink_name ⇒ Object
-
#runit_etc_service_path ⇒ Object
/etc/service.
-
#runit_etc_sv_path ⇒ Object
/etc/sv.
- #runit_finish_file ⇒ Object
- #runit_log_run_file ⇒ Object
- #runit_run_file ⇒ Object
- #runit_service_control_file(service_name, control_letter) ⇒ Object
- #runit_service_control_path(service_name) ⇒ Object
- #runit_service_finish_config_file(service_name) ⇒ Object
- #runit_service_finish_file(service_name) ⇒ Object
- #runit_service_log_path(service_name) ⇒ Object
- #runit_service_log_run_file(service_name) ⇒ Object
-
#runit_service_path(service_name) ⇒ Object
Paths and files in shared_folder.
- #runit_service_run_config_file(service_name) ⇒ Object
- #runit_service_run_file(service_name) ⇒ Object
- #runit_user_base_path ⇒ Object
- #runit_var_log_service_path ⇒ Object
-
#runit_var_log_service_runit_path ⇒ Object
/var/log/service/‘usr_app_env_folder’/runit.
- #runit_var_log_service_single_service_path(service_name) ⇒ Object
- #service_pid(service_name) ⇒ Object
Instance Method Details
#create_service_folders(service_name) ⇒ Object
103 104 105 106 107 108 109 110 |
# 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 ⇒ Object
28 29 30 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 28 def runit_base_log_path File.join(runit_base_path, 'log') end |
#runit_base_path ⇒ Object
24 25 26 |
# 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_app_symlink_name ⇒ Object
62 63 64 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 62 def runit_etc_service_app_symlink_name File.join('/etc', 'service', user_app_env_file_name) end |
#runit_etc_service_path ⇒ Object
/etc/service
58 59 60 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 58 def runit_etc_service_path File.join('/etc', 'service') end |
#runit_etc_sv_path ⇒ Object
/etc/sv
16 17 18 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 16 def runit_etc_sv_path File.join('/etc', 'sv') end |
#runit_finish_file ⇒ Object
36 37 38 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 36 def runit_finish_file File.join(runit_base_path, 'finish') end |
#runit_log_run_file ⇒ Object
40 41 42 |
# 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 ⇒ Object
32 33 34 |
# 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) ⇒ Object
79 80 81 |
# 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) ⇒ Object
75 76 77 |
# 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) ⇒ Object
99 100 101 |
# 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) ⇒ Object
91 92 93 |
# 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) ⇒ Object
71 72 73 |
# 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) ⇒ Object
83 84 85 |
# 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) ⇒ Object
Paths and files in shared_folder
67 68 69 |
# 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) ⇒ Object
95 96 97 |
# 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) ⇒ Object
87 88 89 |
# 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 ⇒ Object
20 21 22 |
# 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 ⇒ Object
44 45 46 |
# 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 ⇒ Object
/var/log/service/‘usr_app_env_folder’/runit
53 54 55 |
# 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) ⇒ Object
48 49 50 |
# 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) ⇒ Object
112 113 114 |
# File 'lib/capistrano/dsl/runit_paths.rb', line 112 def service_pid(service_name) File.join(runit_service_path(service_name), 'supervise', 'pid') end |