-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to refresh business logic and restart affected components automatically? #94
Comments
Hi Petrus, Here is the place in the docs that talks about restarting on recompile. I use vi for development, but some of my coworkers do use Cursive and auto component restart works there as well. As long as the editor (vi, IntelliJ, Emacs, etc.) recompiles the file on save, mount will restart all the affected states. The flow is quite simple:
this would start the app
You'll see this in the terminal dev=> INFO utils.logging - >> starting.. #'neo.www/neo-app and this is what I see in vi (you should see the same message in other editors): let me know whether this helps. |
I have a similar problem, i have a yada/bidi web server that requires vhost structures that are defined in other files, when i change/compile a vhost def, my webserver does not stop/start, which means everytime i change a vhost i have to go to the repl and do a manual even if i wrap the vhost stuff in a defstate, only the vhost defstate does stop/start on compile, not the webserver. example of the server, each (defstate server
:start (start-server config
prelaunch/routes
backoffice/routes
storybook/routes)
:stop (stop-server server)) here is my state tree. the ({:name "#'my-project.config/config", :order 1, :status #{:started}, :deps #{}}
{:name "#'my-project.sendpulse/mail", :order 2, :status #{:started}, :deps #{"#'my-project.config/config"}}
{:name "#'my-project.mail/send", :order 3, :status #{:started}, :deps #{"#'my-project.config/config"}}
{:name "#'my-project.web.forms.malli/coercer", :order 4, :status #{:started}, :deps #{"#'my-project.config/config"}}
{:name "#'my-project.db/conn", :order 5, :status #{:started}, :deps #{"#'my-project.config/config"}}
{:name "#'my-project.web.storybook/routes", :order 6, :status #{:started}, :deps #{"#'my-project.config/config"}}
{:name "#'my-project.web.backoffice/routes",
:order 7,
:status #{:started},
:deps #{"#'my-project.web.forms.malli/coercer" "#'my-project.config/config" "#'my-project.db/conn"}}
{:name "#'my-project.web.prelaunch/routes",
:order 8,
:status #{:started},
:deps #{"#'my-project.web.forms.malli/coercer" "#'my-project.config/config" "#'my-project.db/conn"}}
{:name "#'my-project.gateway/server", :order 9, :status #{:started}, :deps #{"#'my-project.config/config"}}) I was able to solve my issue by directly referencing the deps in [my-project.web.storybook :as storybook :refer [routes] :rename {routes storybook-routes}]
[my-project.web.backoffice :as backoffice :refer [routes] :rename {routes backoffice-routes}]
[my-project.web.prelaunch :as prelaunch :refer [routes] :rename {routes prelaunch-routes}] however, i still have the issue where when i reload a dep to gateway/server (backoffice/routes), gateway/server doesn't restart (no stop, no start). only the reloaded files state restarts. i would expect the states that depend on it to restart as well. new state graph looks correct, but behaviour has not changed. {:name "#'my-project.gateway/server",
:order 9,
:status #{:started},
:deps #{"#'my-project.web.storybook/routes"
"#'my-project.config/config"
"#'my-project.web.prelaunch/routes"
"#'my-project.web.backoffice/routes"}} |
Hey Anatoly. Mount looks pretty cool - I like the idea of using the build system to handle dependencies instead of reimplementing the dependency graph.
Been using boot-clj, system.component and danielsz's system. Some of my lifecycle components like Ring handlers are constructed dynamically, which makes it hard to reload web handlers automatically.
I glossed over the mount README and downloaded and ran examples like Neo, but it's not obvious how I can automatically trigger a reload (
(reset)
?) when code is changed. If I edit this file and save, I don't see any reload notices (can I log this?), but I can call(reset)
to see any changes.Using Cursive as my IDE, and maybe I need to add some tooling there to run (reset) on save?
Especially for beginners, would greatly appreciate a GIF showing what kind of workflow is supported for auto-reloading, because I've spent so much time trying to figure out why my handlers don't respond the way the code looks, until I realised I need to manually reload components (which can take a long time for many components). Not saying this is something mount doesn't live up to, but something I would like to do :).
The text was updated successfully, but these errors were encountered: