Fork me on GitHub
#hyperfiddle
<
2023-08-17
>
joshcho11:08:58

Curious if there are interesting ideas for in-browser devtools like re-frisk or Fulcro inspect that leverage Electric's unique powers. My own, but maybe sth like https://clojurians.slack.com/archives/C7Q9GSHFV/p1691215465636979 as a chrome extension could be cool.

Dustin Getz15:08:21

absolutely possible, sky is the limit to introspect and reflect the DAG and in depth observability

❤️ 2
Dustin Getz12:08:13

I think it would be straightforward to visualize that using GraphViz or whatever

Dustin Getz12:08:39

That would be step 1; step 2 would be to observe the events on the wire protocol in order to animate the graph and see values flow through it

Dustin Getz12:08:15

Separate idea – a "reactive REPL"

Dustin Getz12:08:56

in a simple terminal repl, you type a form and press enter and get a result. Request/response

Dustin Getz12:08:23

Imagine that same terminal UI except in a browser and the response is animated like the Two Clocks demo

Dustin Getz12:08:01

user=> (println (e/server e/system-time-ms)) 1692449153122 ; animated

Dustin Getz12:08:37

each REPL interaction is a live app and stays live until you delete it

Dustin Getz12:08:19

the blocker to this is that Electric is still a compiler (no eval) so you have to wait on shadow rebuilds

Dustin Getz12:08:51

in 2024 Electric will become a JIT (like the JVM and also Clojure), moving the compiler analysis to runtime, which will enable such a REPL without iframing a second shadow instance or something

Dustin Getz12:08:40

the live-coding demo video on our homepage http://www.hyperfiddle.net uses a second shadow instance with an iframe (and the video is also sped up to hide the hot code reloading pauses)

Dustin Getz12:08:46

A cheaper alternative is making Electric compatible with SCI, which has no blockers but someone has to do the work it's probably a few weeks of work that we dont have time for, perhaps someone could get Clojurists Together funding for this

👀 3
Dustin Getz13:08:53

Finally we still are looking for notebook infrastructure a la NextJournal that is unbundled and separate from any application level concerns. "Session-lived backend" is the term for an on-demand "flyweight" backend to spin up and host a throwaway JVM and classpath for livecoding "fiddle" infrastructure. This missing piece gets end-user programmers the ability to build real apps (that have dependencies and need classpath control, i.e. can safely connect to some arbitrary database from userland)

🚀 1
Garrett Hopper20:08:59

Has anyone tried or considered running an Electric server on Datomic Ions? Not sure how it would work due to the inherent stateful relationship of websocket <-> server instance. Would be very interesting to have the Electric server running directly in the DB though :thinking_face:

Dustin Getz21:08:59

we have only run it so far in onprem, there are some threads discussing the websocket issue if you search this channel and #C03RZMDSH

Garrett Hopper21:08:07

👍 I searched for Ions and only found a brief mention from 2018; will look more for websockets 👀

Dustin Getz21:08:55

search by @U0514DPR7 they are his threads

Garrett Hopper21:08:07

Thank you 🙂

🙂 2
Garrett Hopper21:08:05

Seems like it's probably possible through API Gateway's websocket support. Just need to abstract the session management outside of the electric adapter. Is there any documentation on different adapters? Seems like I could reuse most of the logic from hyperfiddle.electric-jetty-adapter?

Dustin Getz12:08:15

@U5JUDH2UE if you would summarize the issue please in as few bullet points as possible, that would be helpful

Garrett Hopper13:08:48

• Electric requires the WS session to be handled by the same server instance for the duration of a user's session due to its inherent stateful nature. (Running the server side version of components and sending the client any data when the client expects to receive it.) • Diatomic Ions are useful for deploying Clojure functions in a scalable way while also having very fast Diatomic DB access. • Ions can be exposed either through a Lamda proxy or API Gateway HTTP endpoint. • There's no way to route either to always be handled by the same server instance when scaled horizontally. • This could be handled by placing WS events in something like Redis and relying on each instance to publish messages it received and subscribe to messages related to sessions it's currently serving. • Doing so would also require a custom Electric adapter which abstracts the API Gateway WS abstraction where new events being received are translated to HTTP requests and sending events requires calling an HTTP endpoint. • Ions also don't seem to provide any lifecycle hooks when being scaled down, which would be a major problem for long-lived Electric sessions which would be lost and require a user to refresh/connect elsewhere. All together, I'm not sure Ions are the right deployment solution given Electric's design. The server/client needing to run the same code in parallel and communicating throughout is, I think, inherently different from what Ions expect and likely requires a more traditional server deployment.

👀 2
Garrett Hopper13:08:46

That's not very few 😬 More of the story is that it probably shouldn't be done, I think.

Dustin Getz15:08:53

Thanks, I'd guess the path forward is to reject that sticky session routing to an ion is impossible and figure out how to do it

Dustin Getz15:08:31

anyway isn't this a dead product? Nubank uses Datomic Onprem

👍 2
Garrett Hopper15:08:20

I think you might be right about that. I'd never looked closely, but I was getting a sense that it may not be desirable to use even outside of this limitation.

Daniel Jomphe21:08:58

Dustin… you’re… saying it… out loud… I’ve been “regularly” asking them if they’ve started to use Datomic Cloud at Nubank. Never got a response. So: they didn’t yet start to use it. Still, the way they develop first for On-Prem, but in a Cloud-compatible way, then release things for Datomic Cloud a few months later, proves that the product is not yet dead at all in their mind. I don’t know if it’s just to support their existing Cloud clients, or if they’re really investing in it for the long run. I’ve got the feeling they want the long run for it, but might someday unify things so much so that the CloudFormation templates for configuring AWS would also become useful for On-Prem (Clouded On-Prem).

stuarthalloway19:09:56

The "release for Cloud later" was mostly an artifact of jumping through hoops of the AWS marketplace. Now that Datomic Cloud is free, no marketplace hoops, so we should be able to release Cloud and Pro at more nearly the same time.

👍 6
2
stuarthalloway19:09:56

The "release for Cloud later" was mostly an artifact of jumping through hoops of the AWS marketplace. Now that Datomic Cloud is free, no marketplace hoops, so we should be able to release Cloud and Pro at more nearly the same time.

👍 6
2