Packages
deli
0.1.11
0.2.0-rc.6
0.2.0-rc.5
0.2.0-rc.4
0.2.0-rc.3
0.2.0-rc.2
0.2.0-rc.1
0.1.28
0.1.27
0.1.26
0.1.25
0.1.23
0.1.22
0.1.21
0.1.20
0.1.19
0.1.18
0.1.17
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
retired
0.1.7
retired
0.1.6
retired
0.1.5
retired
0.1.4
retired
0.1.3
retired
0.1.2
retired
0.1.1
retired
0.1.0
retired
Easy deployment for Elixir apps
Current section
Files
Jump to
Current section
Files
lib/deli/controllers/systemctl.ex
defmodule Deli.Controllers.Systemctl do
import Deli.Shell
@behaviour Deli.Starter
@behaviour Deli.Checker
@impl Deli.Starter
def restart_host(app, _target, host) do
id = "#{app}@#{host}"
IO.puts("restarting #{id}")
cmd("ssh #{id} 'sudo systemctl restart #{app}'")
IO.puts("restarted #{id}")
end
@impl Deli.Checker
def check_service_status(app, host) do
id = "#{app}@#{host}"
status = "ssh #{id} 'systemctl status #{app}'" |> cmd_result
if status =~ ~r/Active\: active \(running\)/ do
IO.puts([IO.ANSI.green(), "running #{id}", IO.ANSI.reset()])
true
else
IO.puts([IO.ANSI.red(), "not running #{id}", IO.ANSI.reset()])
IO.puts(status)
false
end
end
end