Add power to follow logs on app and traefik

This commit is contained in:
David Heinemeier Hansson
2023-01-22 11:27:31 +01:00
parent 6eb0abbb30
commit 598e7ab97f
5 changed files with 60 additions and 19 deletions

View File

@@ -24,12 +24,17 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
docker :ps, "--filter", "name=traefik"
end
def logs(since: nil, lines: nil)
docker :logs, "traefik",
(" --since #{since}" if since),
(" -n #{lines}" if lines),
"-t",
"2>&1"
def logs(since: nil, lines: nil, grep: nil)
pipe \
docker(:logs, "traefik", (" --since #{since}" if since), (" -n #{lines}" if lines), "-t", "2>&1"),
("grep '#{grep}'" if grep)
end
def follow_logs(host:, grep: nil)
run_over_ssh pipe(
docker(:logs, "traefik", "-t", "-n", "10", "-f", "2>&1"),
("grep '#{grep}'" if grep)
).join(" "), host: host
end
def remove_container