tilt-example-java
tilt-example-java copied to clipboard
Is `entr` redundant in the 102-jib-live-update example?
https://github.com/tilt-dev/tilt-example-java/blob/5aa9b4ef07ad3c85aa8663d839b8b13aef84a6f1/102-jib-live-update/Tiltfile#L18
This example also includes spring-dev-tools, which automatically restarts the Spring Boot ExampleApplication without restarting the entire Java process. The recommended example seems to rely on this this and doesn't use entr in its entrypoint.
Is there something different about using jib that makes entr necessary for live updates?
Sort of! This is a good question @hiremaga
In this example, Spring Dev tools also do their own live-reloading. We touch on this a bit in the tutorial: https://docs.tilt.dev/example_java.html#optimizations
Re:
"The recommended example seems to rely on this this and doesn't use entr in its entrypoint."
Ah, this is subtle! The recommended example does use entr! It uses the docker_build_with_restart, which uses entr under the hood. The tutorial also touches on this: https://docs.tilt.dev/example_java.html#step-4-lets-live-update-it
So why do we recommend entr in this example? This is intended as a general purpose example for all Java users, including frameworks that:
- DON'T support live-reload
- SORT OF live-reload in SOME cases, but it's buggy inside containers
- DO support live-reload robustly
i haven't evaluated recently whether spring-dev-tools is in (2) or (3). But lots of users don't know how to evaluate how well their framework supports live-reload (and file bugs against us about it), so sometimes our examples err on the side of redundancy.
Maybe it would help to leave a note about this in the README? ya, if you're able to wire up a framework-native restart that works for you, you can remove the Tilt general-purpose one.
Thanks for the clarification @nicks, both the subtlety about entr & the scope of this example.
A note in the README might help. Another approach might be having the examples that start off without spring-dev-tools initially and introducing it in a new example in lieu of entr. Similar in spirit to having a separate example for jib.
I've been playing around with Spring Boot and Tilt so I might be able to submit a PR for this. WDYT?
Yes, a PR to add some notes and pointers on spring-dev-tools would be much appreciated! (we're certainly not experts on Spring Boot)