Container Takes Hours To Start or Sometimes Just Doesn't
alec2435
PROOP

2 years ago

I'm trying to deploy a docker container to railway and it builds with no errors from the dockerfile, but the deploy produces no logs for hours and the service is unavailable. Sometimes after waiting a few hours it'll eventually start but most of the time it just sits with no logs or info coming out of the deploy. Here's the dockerfile I'm using:

FROM haskell:9.4.7-buster

WORKDIR /opt/

RUN apt install --no-install-recommends curl

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./.cabal /opt/selene/.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal new-build --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/
RUN cabal new-install exe: -j4

CMD [""]

18 Replies

alec2435
PROOP

2 years ago

60e7b407-448b-408b-84c2-c8ac25deef63


alec2435
PROOP

2 years ago

Like most of the "deploy" logs for this service are just fully empty. Only when a new deploy doesn't happen for many hours it'll have the start logs from my app show up with a timestamp that's hours after the "deploy" time


2 years ago

please attach the Dockerfile without the needless censoring


alec2435
PROOP

2 years ago

sure I didn't think it made a difference

FROM haskell:9.4.7-buster

WORKDIR /opt/selene

RUN apt install --no-install-recommends curl

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./selene.cabal /opt/selene/selene.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal new-build --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/selene
RUN cabal new-install exe:selene -j4

CMD ["selene"]

2 years ago

the little details matter


2 years ago

does this dockerfile build an image and run fine locally?


alec2435
PROOP

2 years ago

Yep and in ECS and in my K8S cluster


2 years ago

zero logs what so ever for hours?


alec2435
PROOP

2 years ago

yep


2 years ago

how are you logging? are you logging unbuffered to stdout / stderr?


alec2435
PROOP

2 years ago

I believe so let me check


alec2435
PROOP

2 years ago

This is the entry point code:

main :: IO ()
main = do
  withEnv $ \env -> do
    appToRun <- Scotty.scottyAppT (runM env) (app env)
    let warpSettings = setPort 3005 defaultSettings
    runM env $ do
      $logInfo "Selene start at port 3005"

    runSettings warpSettings appToRun

alec2435
PROOP

2 years ago

I'm not super familiar with the internals of the haskell io monad but I was pretty sure this logs unbuffered to stdout, doing some more research now


2 years ago

i am even less familiar


alec2435
PROOP

2 years ago

ok i think you might be right on the stdout log buffering


alec2435
PROOP

2 years ago

thanks!


2 years ago

and just to be clear, your service will always stay unavailable, even once the logs do print?


2 years ago

application failed to respond, right? if so, please check out this docs page -


Loading...