dotnet / tye

Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
MIT License
5.29k stars 520 forks source link

Hotreload feature #1496

Closed csteeg closed 1 year ago

csteeg commented 1 year ago

Based on #1013 but now optional I added a 'hotReload' property to project-info (see samples/frontend-backend/tye.yaml where front-end is now using hotReload) It only starts when combined with --watch. All projects that don't have this property set, still use DotnetFileWatcher.

Although I don't see when you'd prefer DotnetFileWatcher is preferred over dotnet watch, it still is backwards compatible since you must explicitly tell that a project should use dotnet watch.

davidfowl commented 1 year ago

I'm not a fan of this change. The watcher can't be an external calls because we have no control over building in that case. The right way to do this is to integrate watch with tye (the way it is done today).

csteeg commented 1 year ago

I somewhat get that, but hot-reload is so much faster then a rebuild and thus a restart. Also, ,the watch from dotnet feels a little more stable (eg I never get dll's that are locked with dotnet watch where I do get that in the tye builder)

But, now with the start-/stop feature from my other PR, we're able to stop the service in tye and start it in hot-reload mode from visual studio. The ingress from tye keeps working to proxy the requests, so that's cool. We could live without this feature now.

Just out of curiosity since I don't see the need at our development environment: Why do we want control over building?

davidfowl commented 1 year ago

Tye is the orchestrator. It has to be the thing building and launching the app. It makes it easy to do things like:

  1. coordinate the build when multiple projects change so there’s no file locking issues.
  2. Launching multiple replicas means build is decoupled from run. Watch is a black box, we can’t have it launch the process.

This is why we need to use watch like a library instead of s launcher

csteeg commented 1 year ago

Point 1: The file locking issues are with tye only for us... perhaps I should take a look at that someday. Point 2: yes, understood. We don't use replica's in our dev-environment but I see that you'd need to be in control here