So writing to a peer will not reflect in the other peers. In order for all peers to see "a single source of truth" datahike needs to be set up with a special "writer" node that all peers submit transactions to. (This creates a queue and potential bottlenecks, which the original design of datahike tried to avoid.)
So I will add :writer to my cfg but my app runs on Heroku; the URL should point to what exactly? Any dedicated dyno? Nevertheless, datahike will know how to coordinate these resources?
{:writer {:backend :datahike-server
:url ""
:token "securerndompassword"}} You need to run datahike-server. It's an uberjar that you need to build and run.
You can do :writer or you can do :remote-peer which makes a thin client
This repo is what I'm doing in prod: https://github.com/alekcz/datahike-server I build the uberjar in github actions then make a docker image which I then deploy.
Thanks Alek
Can I integrate this into my existing prod app / codebase? (Or this somehow has to be a separate service?)
It makes sense to use this if you need multiple datahike instances you want to updates the db from your reply and not your running app. If your ran app is the only writer then you don't need it.
It has to be its own service.
Or you could extract the datahike server code and put that into your app.
I'm not sure if I need multiple datahike instances; I'm still not clear what that means. My understanding is simplistic. I am trying to create something like Reddit, practically speaking. (But much smaller : )
Driving. Will reply now now.
(Going to reply in the main thread so I have space to write)
Thanks Alek. My general goals are these: When a user to this new web app refreshes a page, or visits a new one, I would like what they see to reflect the state of the db when they make that request. But I would also like to change the prod app and schema "on the fly" from my REPL. Call this "the old Lisp way" (which Paul Graham writes about when he was developing his startup Viaweb).
I get you. We need to make changes to datahike to make that easy. I'm hoping to get to that soon. I have the same issue.
When I try to transact against my prod conn (from local repl), I have no success/ stalls out; I have to kill my REPL, reconnect and re-load my project. It's a real downer because it kills my flow. What am I doing wrong?
Hi @feedmyinbox02_clojuri, do you have an exception or something? Is it always like that or only after a while?
Hi timo. It's only after some time has passed. I will try to reproduce and confirm, and also get some error information for you. Thank you for reply