Logging in docker
Hi,
I have big troubles getting solara logging to work within docker. I guess solara run does some redirect away from pid1?
I do specify --log-level in my entrypoint but still nothing.. I do not do anything special with respect to logging, just want to see the solara (+ my own logs) from the app on the docker dashboard etc..
Is there some hidden config i need to adjust somewhere, or is this supported at all..
Would be very much appreciated!
1 Reply
I think i understand what is happening.. since i am using "mamba run .." my solara process is not a pid1 process..
so one needs to find a way around this probably.
actually.. probably solara does something with the logging (that matters when stuff are in docker), since a simple mamba run.. with a test file works well and logging is capture by docker
ENTRYPOINT ["mamba", "run", "-n", "my-env", "python", "test_log.py"]
works but
ENTRYPOINT ["mamba", "run", "-n", "my-env", "solara", "run", "app.py", "--host=0.0.0.0", "--production", "--port", "8765", "--log-level", "info"]
does not
Ok i figured it out, for anyone that might be struggling with this in the future:
If you have a dockerfile trying to set up a solara webapp (for production use), if you do something like
the logs will not pooled by docker, since mamba run
lives in a separate process and spans a new process that runs solara.. Something similar happens with uv run
if that is more your thing.
If you use CMD [...]
even if solara does not run in pid1 the logs will be properly found.
However, for production use, ENTRYPOINT is preferred.. so at the end .. the best solution I could find after some research is the following..
install tini
and supervisord
from apt-get if your base image does not already have it and do something like
you will need to have a supervisord.config
file and possibly some startup.sh
script.
If you are not familiar with these, read about them, quite useful in this set up (your neighbourhood LLMs also know about them).
example
To the moderators: you can consider thi issue closed.
Thanks!