Skip to content

Commit 1104dcd

Browse files
authored
Merge pull request #639 from hackworthltd/dhess/docker-image-debugging-tools
chore: Debugging improvements
2 parents e4a6910 + 1ce548b commit 1104dcd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

flake.nix

+2
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@
342342
# These are helpful for debugging broken images.
343343
bashInteractive
344344
coreutils
345+
lsof
346+
procps
345347
]);
346348

347349
config =

primer-service/exe-server/Main.hs

+10-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ import Primer.Server (
5757
)
5858
import StmContainers.Map qualified as StmMap
5959
import System.Environment (lookupEnv)
60+
import System.IO (
61+
BufferMode (LineBuffering),
62+
hSetBuffering,
63+
)
6064

6165
{- HLINT ignore GlobalOptions "Use newtype instead of data" -}
6266
data GlobalOptions = GlobalOptions
@@ -189,7 +193,12 @@ run opts = case cmd opts of
189193
runDb (Db.ServiceCfg dbOpQueue ver) db
190194

191195
main :: IO ()
192-
main = execParser opts >>= run
196+
main = do
197+
-- It's common in Linux containers to log to stdout, so let's ensure
198+
-- it's line-buffered, as we can't guarantee what the GHC runtime
199+
-- will do by default.
200+
hSetBuffering stdout LineBuffering
201+
execParser opts >>= run
193202
where
194203
opts =
195204
info

0 commit comments

Comments
 (0)