-
Notifications
You must be signed in to change notification settings - Fork 6
/
good_job.rb
26 lines (22 loc) · 879 Bytes
/
good_job.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Capistrano
class GoodJob < Capistrano::Plugin
include PumaCommon
def set_defaults
set_if_empty :good_job_role, "db"
set_if_empty :good_job_access_log, -> { File.join(shared_path, "log", "good_job.log") }
set_if_empty :good_job_error_log, -> { File.join(shared_path, "log", "good_job.log") }
set_if_empty :good_job_service_unit_name, -> { "#{fetch(:application)}_good_job_#{fetch(:stage)}" }
set_if_empty :good_job_systemd_conf_dir, -> { File.join("/home/#{fetch(:user)}", ".config", "systemd", "user") }
end
def define_tasks
eval_rakefile File.expand_path("../tasks/good_job.rake", __FILE__)
end
def register_hooks
after "deploy:finished", "good_job:restart"
end
def execute_systemd(*args)
command = ["/bin/systemctl", "--user"] + args
backend.execute(*command)
end
end
end