Fork me on GitHub
#hyperfiddle
<
2023-04-11
>
Dustin Getz13:04:09

FYI: I just pushed breaking changes to master without documentation. Reminder to please get off of master and use the https://github.com/hyperfiddle/electric/blob/master/CHANGELOG.md

teodorlu14:04:01

I did a quick check for dependency behavior with #babashka-neil. TL;DR: • neil dep add com.hyperfiddle/electric installs version v2-alpha-263-g89da9d11 • running neil dep add com.hyperfiddle/electric again when an old clojars-alpha version is installed, installs the latest clojars alpha version --- Details: 1. neil dep add com.hyperfiddle/electric installs v2-alpha-263-g89da9d11 2. but neil dep upgrade com.hyperfiddle/electric doesn’t seem to be able to update an old electic version to the new version. 3. running neil dep add com.hyperfiddle/electric again when an alpha version is installed installs the new version. neil 0.1.60 changed the default dep add behavior to add the latest unstable version of no stable versions are found. But nep upgrade hasn’t gotten the same behavior. So using neil dep add seems to give the latest recommended alpha version.

teodorlu16:04:10

oh, sorry, that probably read like it was totally out of context. i was thinking that the recent change in neil behavior might be useful for electric users, since it matches which electric version you want people to use.

Dustin Getz16:04:36

what is neil?

teodorlu16:04:20

Neil is a babashka CLI for installing and updating Clojure dependencies in deps.edn projects: https://github.com/babashka/neil

vincent22:04:42

Okay so I'm working from the XTDB-Electric examplez

vincent22:04:06

I'm wondering, how I would do a cloud deploy like electric has for the example pages w/ 5 worldwide mirros

Dustin Getz00:04:15

you’ll need a cross region cloud database like say google spanner not xtdb - it’s not trivial

alexdavis09:04:56

You can use a single central document/tx store for xtdb and deploy the electric instances to the edge. xtdb will store the document and tx logs on each node so you would only have to go to the central db for writes or cold reads. If you're using http://fly.io you should be able to just deploy a single region postgres and use that. you can get help on setting up your xtdb config in #CG3AM2F7V, you'll probably want to utilise checkpointing or the electric nodes will be slow to start

Dustin Getz10:04:55

@U7KPK060K please say more and/or ELI5 without XTDB prior knowledge and i will add this to our docs

alexdavis11:04:23

I'm far from an expert on XTDB so @U899JBRPF correct me if I'm wrong about any of this, but here are the basics as I understand them: • an XTDB deployment consists of one or more Nodes, a document store and a tx store (immutable transaction log of changes to the doc store). You can choose different places to persist these, by default I think they both get stored on the node using rocksdb, but you can also persist them outside the node using one of thehttps://docs.xtdb.com/storage/ • the XTDB nodes usually run in the same process as the host application (in this case electric) and each node connects (remotely via http/jdbc etc or in memory/local disc) to the doc/tx store • when a node starts up it will retrieve a copy of the indexes and store them in memory. queries made on the node (e.g using xt/q or xt/entity) will be executed against these local indexes (though I'm a little unclear about this because I know you can configure the amount of memory available to xtdb for local indexes, so possibly there are cases where the query will have to wait for the node to fetch data from the central store). • Deploying electric to the edge is probably beneficial if the app isn't write heavy, as each edge node will effectively cache the db and trips to the central store will only need to happen when doing writes or reading recently stored data, but electric does encourage frequent writes for realtime applications and in those cases it might be better to have the electric node close to the doc/tx store There is more info available here (and in the guides/tutorials on the same site) https://docs.xtdb.com/concepts/what-is-xtdb/

2
👀 2
thanks2 1
vincent22:04:06

I just figured XTDB is a drop-in and free replacement for Datomic, is this assumption flawed

vincent22:04:21

Maybe I can just go with Datomic Free, and this will be simpler significantly

Dustin Getz22:04:51

datomic free is probably the easiest possible thing

Dustin Getz22:04:29

It's still not quite trivial with docker, you'll need to configure a persistent disk for the state if you haven't used Docker before. (IIRC, i can barely keep the container stuff straight) The dead simple thing is to use digital ocean, ssh in, mount persistent disk from digital ocean admin panel, install datomic, run app

Dustin Getz22:04:22

Once you outgrow that you can dockerize it

vincent23:04:25

Okay cool. So i can copy the electric-starter-app to my server, link in datomic, and should be good to go?

Dustin Getz00:04:25

yeah, make sure the hard disk doesn’t get erased when the box restarts

💡 2
vincent22:04:35

I usually log into a box and run a server from a specific ip. cloud deploys are a little different and i was wondering if anyone had any pointers

Dustin Getz00:04:57

do you need cloud? we need it because our demos are accessed worldwide; digital ocean by ssh is perfectly acceptable

Dustin Getz00:04:52

you can also look into railway, http://render.app, google cloud run - these all involve learning docker, which with XTDB may not be trivial

Dustin Getz00:04:32

really figuring how how to run XTDB in prod is the first thing to do, this will determine your options for hosting

vincent01:04:54

I see, I don't need cloud. I just thought it was the next logical step. But if db is whack++ then I can just do a singular local instance based in NYC area or whatever the digital ocean cluster is

vincent22:04:17

Also, unrelatedly to deployment, I have a question regarding views. I have a dom/button with the on-click set to toggle an atom, and an if statement in the view (or a case statement) but the view never changes. I'm curious what I would be doing incorrectly there

Dustin Getz00:04:17

post the snippet, did you forget e/watch?

vincent01:04:05

possibly! ty for the idea. will check.