From 285e7b199647c3932ccf64fdaa370648be3edc55 Mon Sep 17 00:00:00 2001 From: Axel Gustav Date: Mon, 14 Oct 2024 16:23:51 -0300 Subject: [PATCH] Fix litestream showing as "not running" in Docker When deploying litestream-ruby via Kamal and Docker, the dashboard shows the process as not running. Using the "x" option for "ps" seems to solve this. As per ps man page: x Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like. The set of processes selected in this manner is in addition to the set of processes selected by other means. An alternate description is that this option causes ps to list all processes owned by you (same EUID as ps), or to list all processes when used together with the a option. Resolves: https://github.com/fractaledmind/litestream-ruby/issues/43 --- lib/litestream.rb | 2 +- test/test_litestream.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/litestream.rb b/lib/litestream.rb index 71720ce..f43bac6 100644 --- a/lib/litestream.rb +++ b/lib/litestream.rb @@ -115,7 +115,7 @@ def replicate_process end end else - litestream_replicate_ps = `ps -a | grep litestream | grep replicate`.chomp + litestream_replicate_ps = `ps -ax | grep litestream | grep replicate`.chomp litestream_replicate_ps.split("\n").each do |line| next unless line.include?("litestream replicate") pid, * = line.split(" ") diff --git a/test/test_litestream.rb b/test/test_litestream.rb index d76e4c6..d8f0c5b 100644 --- a/test/test_litestream.rb +++ b/test/test_litestream.rb @@ -41,7 +41,7 @@ def test_replicate_process_ps stubbed_backticks = proc do |arg| case arg - when "ps -a | grep litestream | grep replicate" + when "ps -ax | grep litestream | grep replicate" stubbed_ps_list when %(ps -o "state,lstart" 40364) stubbed_ps_status