Fork me on GitHub
#datomic
<
2019-07-02
>
dl06:07:07

@joe.lane I have not much experience with Clojure and Datomic, just have tried the tutorials and created the first AWS API Gateway. Just curious if there is a way on how I can push from Datomic to the client via Websockets just like when using Sente with Clojure (https://github.com/ptaoussanis/sente)

fdserr09:07:40

Hi there. Who's got the best Dockerfile and Helm chart for Datomic Pro and wants to share them?

😪 4
cjsauer13:07:55

Is it possible to augment the solo topology with an NLB to take advantage of HTTP Direct? Just ran into Java cold start on my startup project, and I’m not quite at the point that I can justify the prod topo cost. Obviously the NLB would only have a single target, but it might let me bypass lambda.

Joe Lane13:07:33

@cjsauer Set up a cloudwatch event to ping your lambda. It’s waaay simpler than I thought it would be.

cjsauer14:07:26

@joe.lane okay, that was plan B. I had a little deflambda macro in mind that could check for a “keep warm” header value. That way I could decorate all my ions with that short-circuit logic.

cjsauer14:07:05

I’ll have quite a few lambda functions, so maybe I should write a “keep warm” lambda that pings all the others. Could register them in an atom as part of deflambda perhaps :thinking_face:

cjsauer14:07:03

Doesn’t really solve the fact that cold starts affect every concurrent execution, but at that point I think the prod topo becomes viable anyway.

cjsauer14:07:52

Actually ion-config.edn could just be read to find all the lambdas that need warming. Much simpler.

Joe Lane14:07:44

Do it in data, You can annotate the ion-config.edn however you want. Or make your own file.

👍 4
souenzzo15:07:33

Any plans about fast/forkable memdb on datomic.client.api ?

souenzzo15:07:17

I'm using datomic-client-memdb that uses datomic-free. But now with com.datomic/client-cloud {:mvn/version "0.8.78"} it do not work anymore https://github.com/ComputeSoftware/datomic-client-memdb datomock it is also a great tool but do not work on cloud 😞 https://github.com/vvvvalvalval/datomock

souenzzo15:07:30

There is docs about :server-type :local?

shaun-mahood15:07:46

@plexus Does https://github.com/lambdaisland/metabase-datomic support Datomic Cloud? I couldn't find any information on it either way.

souenzzo15:07:18

@shaun-mahood probably not. It's hard(and expansive) to foss developer access datomic cloud, once to test it, you need to pay aws infrastructure 😞 "datomic-peer" has a awesome feature: it's simple and accessible. Just (d/connect "datomic:") anyware and it's ready to develop tools "datomic-cloud" you need to setup AWS Machines, connect proxies, stay online (harder to run CI)... 😣 https://github.com/lambdaisland/metabase-datomic/blob/master/deps.edn

shaun-mahood15:07:23

That's kind of what I figured - there's a lot of awesome things about running local Datomic, and the kind of things Metabase do seem pretty well geared towards it. Thanks for letting me know!

fdserr15:07:15

I can confirm metabase-datomic is (so far) for Datomic on-prem only.

plexus16:07:05

as mentioned metabase-datomic uses the peer api, so it's not currently compatible with Datomic Cloud. I do think it's doable, and perhaps not even that much work, but I haven't looked into it so far. If there's commercial interest I'd be happy to look into it and make an estimate. The development so far has been funded by http://runeleven.com (@fdserr et al) who don't have a need for Datomic Cloud support at this point. There's still quite a bit that could be improved in general as well, so if more companies would be willing to pitch in this could be something everyone would benefit from.

shaun-mahood16:07:40

Makes sense - nice to hear that Datomic Cloud sounds doable! I assumed it would be much harder without the peer api. Hopefully there will be enough commercial interest to keep improving things. Thanks for the answer!

hadils16:07:55

What version of com.cognitect.aws/ssm is in the {:url ""}?

Alex Miller (Clojure team)16:07:35

Probably none, that should be in maven-central

hadils16:07:13

My release is not working, Alex.

hadils16:07:50

{:deploy-status "ERROR",
 :message "Could not find artifact com.cognitect.aws:ssm:jar:697.2.391.0 in datomic-cloud ()"}

hadils16:07:21

This used to work...

hadils16:07:28

Does this not work anymore?

(defn release
  "Do push and deploy of app.  Supports stable and unstable releases.  Returns when deploy finishes running."
  [args]
  (try
    (let [push-data (ion-dev/push args)
          deploy-args (merge (select-keys args [:creds-profile :region :uname])
                             (select-keys push-data [:rev])
                             {:group group})]
      (let [deploy-data (ion-dev/deploy deploy-args)
            deploy-status-args (merge (select-keys args [:creds-profile :region])
                                      (select-keys deploy-data [:execution-arn]))]
        (loop []
          (let [status-data (ion-dev/deploy-status deploy-status-args)]
            (if (= "RUNNING" (:code-deploy-status status-data))
              (do (Thread/sleep 5000) (recur))
              status-data)))))
    (catch Exception e
      {:deploy-status "ERROR"
       :message       (.getMessage e)})))

Alex Miller (Clojure team)16:07:34

The error is misleading - it checks every repo but just reports the last error

hadils16:07:24

I upgraded to 480--8770

Alex Miller (Clojure team)16:07:45

What version of tools.deps.alpha are you using?

hadils16:07:46

Oh, I am using a new computer. How do I install tools.deps.alpha onto MacOS?

Alex Miller (Clojure team)16:07:05

Just back up and tell me from the beginning what you’re doing

hadils16:07:11

Ok, I have a new MacOS laptop. I am pushing my code to Datomic Production topology for the first time since getting this computer.

hadils16:07:37

Yes. The version is 1.10.1.458.

hadils16:07:43

I just changed tools.deps.alpha to 0.7.516.

hadils16:07:54

Still doesn't work.

Alex Miller (Clojure team)16:07:27

could you humor me on trying something?

hadils16:07:35

Of course!

Alex Miller (Clojure team)16:07:17

brew uninstall clojure
curl  > clojure.rb
brew install clojure.rb

Alex Miller (Clojure team)16:07:25

basically a forced downgrade to older version

Alex Miller (Clojure team)16:07:34

then try it and see if it works

hadils16:07:12

That works! Thanks Alex.

markbastian16:07:26

I'm really liking the new tuple features, especially for defining composite keys. Thanks! One question, though. It appears that if you use a composite key and want to update it you'll need to explicitly add that key to the transaction after the entity has been initially installed. Here's an example:

;Relevant composite key in schema. Other fields (person, time, balance, are primitives with cardinality one)
{:db/ident       :person+time
 :db/valueType   :db.type/tuple
 :db/tupleAttrs  [:person :time]
 :db/cardinality :db.cardinality/one
 :db/unique      :db.unique/identity}
Now, given a connection I transact my schema and a single initial entry:
@(d/transact conn schema)
@(d/transact conn [{:person "Mark" :time #inst "2000-02-01" :balance 200}])
So far, so good. Now I want to correct my balance as of the above time:
@(d/transact conn [{:person "Mark" :time #inst "2000-02-01" :balance 100}])
I now get an error:
Syntax error (Exceptions$IllegalStateExceptionInfo) compiling at (src/datomic_playground/understanding_time.clj:61:1).
:db.error/unique-conflict Unique conflict: :person+time, value: ["Mark" #inst "2000-02-01T00:00:00.000-00:00"] already held by: 17592186045418 asserted for: 17592186045425
However, I can do either of these to update my entity:
;Works because I am explicitly creating the identity key
@(d/transact conn [{:person+time ["Mark" #inst "2000-02-01"] :balance 100}])
;Also works, as expected
@(d/transact conn [{:person+time ["Mark" #inst "2000-02-01"] :person "Mark" :time #inst "2000-02-01" :balance 150}])
Is this behavior (needing to explicitly create the id key after the initial transaction) expected? Is there a way to auto-imply the unique key after the first transaction?

stuarthalloway19:07:56

Hi @U0JUR9FPH! A couple of thoughts here.

stuarthalloway19:07:27

1. You can alway use the actual entity id, so you don't need to use any identity to perform an update. (I presume you know this but am including it for completeness.)

stuarthalloway20:07:46

2 If you do want to identify an entity by a unique key, you must indeed specify that unique key (not its constituents). This is clean and unambiguous.

markbastian20:07:52

Hey @U072WS7PE, thanks for getting back to me! Yes, case 1 makes total sense (and perhaps I should have put that as a third "works" example for completeness. For anyone following the conversation this would be 17592186045418 in this particular case.). I was indeed looking at case 2. My intuition was that transacting two schema-compliant items with the same constituent elements that form a unique key would resolve to that unique key and either insert or update as appropriate. However, I do see your point that future updates could cause ambiguity. Easy enough to handle once you know the behavior. Thanks!

Alex Miller (Clojure team)16:07:29

@hadilsabbagh18 thanks, I will follow up with the datomic team (I suspect latest version of clj has changed assumptions ion-dev is relying on)

hadils16:07:03

@alexmiller I appreciate the time you took to help me. I know you are very busy.

Alex Miller (Clojure team)16:07:24

well, I think I'm the one that caused it :)