duct-framework / duct

Server-side application framework for Clojure
MIT License
1.13k stars 51 forks source link

nREPL and Duct #113

Closed kendagriff closed 5 months ago

kendagriff commented 5 months ago

Hi @weavejester,

What is the appropriate way to access a live Integrant system map via nrepl when using duct/exec-configs? In development with integrant-repl we're able to invoke integrant.repl/go, then inspect integrant.repl.state/system, but we can't seem to find a similar approach with Duct in production.

Any advice?

weavejester commented 5 months ago

There isn't a way to access a system map in production, as it's not intended that a production system be interacted with in that way. That's not to say you couldn't build one, replacing the -main function with something of your own, but that's not something Duct provides.

kendagriff commented 5 months ago

Do you recommend a separate Integrant environment altogether for accessing production-level resources?

weavejester commented 5 months ago

I'm afraid I don't entirely understand what you mean by that.

The intent is that inspection at production is handled via logging, rather than by accessing a REPL.

kendagriff commented 5 months ago

Okay. We decided to take this approach via Integrant-REPL:

(defn- repl-enabled-exec-config
  "In Duct you typically call duct/exec-config to start the system. Here it is being
   blended with integrant-repl/go to give us REPL access in production."
  [config profiles keys]
  (ir/set-prep! #(duct/prep-config config profiles))
  (ir/go keys)
  (duct/await-daemons is/system))