This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-15
Channels
- # beginners (56)
- # boot (4)
- # cider (22)
- # clara (10)
- # cljs-dev (50)
- # cljsrn (27)
- # clojure (27)
- # clojure-conj (4)
- # clojure-dev (3)
- # clojure-italy (17)
- # clojure-nl (12)
- # clojure-norway (3)
- # clojure-spec (10)
- # clojure-uk (137)
- # clojurescript (132)
- # cursive (4)
- # datascript (2)
- # datomic (109)
- # devcards (2)
- # editors (1)
- # emacs (4)
- # euroclojure (2)
- # events (4)
- # figwheel (1)
- # fulcro (15)
- # jobs (1)
- # jobs-discuss (4)
- # juxt (3)
- # leiningen (2)
- # off-topic (21)
- # onyx (13)
- # other-languages (8)
- # pedestal (6)
- # re-frame (22)
- # reagent (5)
- # reitit (1)
- # ring-swagger (3)
- # shadow-cljs (75)
- # sql (6)
- # tools-deps (2)
- # vim (1)
- # yada (8)
Released Datomock v0.2.1. Fixed a bug causing d/transact
to throw instead of returning a failed ListenableFuture, which means that you could typically see some errors in development and not see them in production. Thanks @tony.kay for spotting this.
https://github.com/vvvvalvalval/datomock
hello! does anyone have any experience with migrations in datomic cloud? i've been using conformity for on-prem but it seems that the library doesn't support client API š
Question about the Ions starter project: should you expect to have to push your ions before you can develop against them locally?
Iām getting an error about datomic/ion-starter.edn
not being on the classpath and I see it both in my REPL and in the log output from my Cloud instance:
datomic-datomic-cloud-appsync datomic-cloud-appsync-datomic-cloud-appsync-Compute-AKGO1YKWH8U7-i-0a275b66a345e2502-2018-06-09-17-06-06- {"Msg":"ClientSPIAnomaly","DatomicClientSpiErrorResponse":{"Status":200,"Body":{"CognitectAnomaliesCategory":"CognitectAnomaliesNotFound","CognitectAnomaliesMessage":"'datomic\/ion-config.edn' is not on the classpath"}},"Type":"Event","Tid":361,"Timestamp":1529069275190}
datomic-datomic-cloud-appsync datomic-cloud-appsync-datomic-cloud-appsync-Compute-AKGO1YKWH8U7-i-0a275b66a345e2502-2018-06-09-17-06-06- {"Msg":"AdopterCheck","DbId":"c4f19984-b350-4a1e-94de-5368e4b26b12","Type":"Event","Tid":382,"Timestamp":1529069276364}
which makes me think maybe you have to push ā¦first? Maybe you have to push an āempty projectā so that the ion-config.edn
file exists in the Cloud instance, and then you can develop against your local one? I find this confusing.
@chris_johnson the file is read locally. deploy
will upload the necessary files to s3
hm. thatās confusing but in a different and more-manageable way
I sure did, itās right next to ion-config-sample.edn
and the only difference between the two is that I added my system name
I restarted my REPL too
and deps.edn
does have {:paths ["src" "resources"]
in it
well, so I do have one other thing going on which I suppose will end up being the problem somehow, though I donāt see how: I added CIDER to my deps like so:
cider/cider-nrepl {:mvn/version "0.18.0-SNAPSHOT"}
refactor-nrepl {:mvn/version "2.4.0-SNAPSHOT"}
and I start the REPL with clj
and then (require 'cider-nrepl.main)
and (cider-nrepl.main/init ["cider.nrepl/cider-middleware"])
and I am C-c C-e
evalāing this: (items-by-type* (d/db (get-connection)) :hat)
indeed
that was the substance of my initial, poorly-worded question
so you can do truly local development (e.g., handing a map into a fn) in isolation, but in order to exercise something that uses get-connection
you have to push and deploy that first
that makes sense now that I know it, but it wasnāt clear to me from the way the starter docs order things. Thanks for clearing it up. As you might guess from my log message above, my Friday Me Time⢠today is all about getting an Ion or two working with AppSync and writing it up for others to see. Onward and upward! š
@chris_johnson not exactly -- see https://docs.datomic.com/cloud/ions/ions-reference.html#server-type-ion
get-connection
is not part of Datomic Cloud, but if it uses :server-type :ion
you can dev locally without :push
also cider et al should not be in your production deps? just under e.g. :dev
alias
so, I do in fact have :server-type :ion
set up and Iām using the get-connection -> ensure-dataset -> get-client
machinery in the starter project
I guess based on my reading of the docs I would have expected to be able to exercise all the ions in the project locally against the Cloud instance over the SOCKS proxy (which is running)
ensure-dataset
appears to have transacted schema and data to the Cloud instance
and thanks for the pointer about :dev
- this is my first time trying out a tools.deps
based project so I took the bull-in-a-china-shop approach and said āoh look, a dependencies array! Iāll just leave these hereā š
I want to learn Ions now and will go back and learn tools.deps
in more depth after I have my blog post written hehe
I do get the same error from the stock clj
REPL too:
user=> (in-ns 'datomic.ion.starter)
#namespace[datomic.ion.starter]
datomic.ion.starter=> (items-by-type* (d/db (get-connection)) :hat)
ExceptionInfo 'datomic/ion-config.edn' is not on the classpath clojure.core/ex-info (core.clj:4739)
datomic.ion.starter=>
haha, yes
@chris_johnson is that error from the Cloud or the local REPL?
I think the problem is actually right here:
> I want to learn Ions now and will go back and learn tools.deps
in more depth after I have my blog post written hehe
what does (
tell you?
I was running clj
without -Rdev
and so Iām 99% sure I was running without ion-dev
loaded at all
should -R:dev
btw (although -Rdev works right now)
Iām a few seconds away from apologizing for wasting yours and Marshallās coffee break
the error message was on point š
hm, well I still get that error so that wasnāt it
Itās being reported by the local REPL but is also showing up in the Cloud logs:
datomic-datomic-cloud-appsync datomic-cloud-appsync-datomic-cloud-appsync-Compute-AKGO1YKWH8U7-i-0a275b66a345e2502-2018-06-09-17-06-06- {"Msg":"ClientSPIAnomaly","DatomicClientSpiErrorResponse":{"Status":200,"Body":{"CognitectAnomaliesCategory":"CognitectAnomaliesNotFound","CognitectAnomaliesMessage":"'datomic\/ion-config.edn' is not on the classpath"}},"Type":"Event","Tid":357,"Timestamp":1529072273749}
to answer your question:
user=> ( "datomic/ion-config.edn")
#object[java.net.URL 0x73a19967 "file:/Users/chris/src/ion-starter/resources/datomic/ion-config.edn"]
user=>
and slurp
ing that does show the contents I would expect to see in the file, including a valid value for :app-name
https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-private-endpoints/
yeah, thatās going to be Big⢠- Iām sure lots of peopleās Friday is figuring out how to use that to pull a bunch of their service API surface āinside the wireā
@chris_johnson did you edit the client map in ion/starter.clj ?
I did do that
okay, so this appears to be working:
Clojure 1.9.0
(def cfg {:server-type :ion
:region "us-east-2"
:system "datomic-cloud-appsync"
:query-group "datomic-cloud-appsync"
:endpoint " "
:proxy-port 8182})
#'user/cfg
user=> (require '[datomic.client.api :as d])
nil
user=> (def client (d/client cfg))
#'user/client
user=> (def conn (d/connect client {:db-name "datomic-docs-tutorial"}))
#'user/conn
(defn create-item
"Transaction fn that creates data to make a new item"
[db sku size color type]
[{:inv/sku sku
:inv/color (keyword color)
:inv/size (keyword size)
:inv/type (keyword type)}])
#'user/create-item
user=> (create-item (d/db conn) "test-001" "large" "blue" "shirt")
[#:inv{:sku "test-001", :color :blue, :size :large, :type :shirt}]
(note that this is just mechanically copying into the REPL the very same config map and fn def that exist in the local source file)
@chris_johnson pretty sure @marshall was right at the beginning
you cannot call a query function that you haven't deployed
you can dev and test it directly, e.g.
(datomic.ion.starter/feature-item? db some-e)
but not inside a query as items-by-type*
does
we probably could use more pictures describing the dev workflow
right, that makes sense and tracks with the next thing I tried, which was to defn
feature-item?
in #'user
and re-`defn` items-by-type*
to use that
which yields ExceptionInfo Unable to resolve symbol: feature-item? in this context clojure.core/ex-info (core.clj:4739)
that all makes perfect sense and for the record I was 100% sure at every point that one of the two of you was right and I was doing something incorrectly š
hopefully your efforts to help an under-caffeinated neophyte will persist in the logs long enough to help someone else. Thanks, as always, for being so willing to spend time in here working through issues.
I am afraid my contribution here was net negative. Sorry @marshall and @chris_johnson
I agree, I think at least for me there was value in having you both assert the correct things you did and then having to convince myself they were true at the REPL. As I find often to be the case, coming at something with a half-correct mental model and a thoroughly-broken code example, with a couple of willing experts to offer advice, has taught me much more than just having the tutorial work right the first time ever would have.
iāll let @stuarthalloway interpret that as he sees fit š
and indeed, as a final check before deploying anything, reloading starter.clj
with this form of items-by-type*
does work at the REPL (and in CIDER for that matter):
(defn items-by-type*
"Returns info about items matching type"
[db type]
(d/q '[:find ?sku ?size ?color #_?featured
:in $ ?type
:where
[?e :inv/type ?type]
[?e :inv/sku ?sku]
[?e :inv/size ?size]
[?e :inv/color ?color]
#_[(datomic.ion.starter/feature-item? $ ?e) ?featured]]
db type))
Completely unrelated question while youāre (maybe) still reading, @marshall - does the Peer library log anything about its use of memcached? Not the transactorās CloudWatch metrics but the Peer library. Iām moving a service from Heroku to AWS and it doesnāt seem to be using the shiny new Elasticache cluster I set up for it, even though it was making use of Memcachier in Heroku. I tried turning the datomic
logger in our logback.xml
up to āDEBUGā
but I still donāt see any telemetry I can use to figure out What I Did Wrong
Yes, we do that
It will report metrics? Like, CloudWatch metrics or logging statements?
you could use println if you just want them locally in a repl, or you can write (or use a community) wrapper to push them to CloudWatch
i.e. something like this https://gist.github.com/geoff-kruss/4504cdcf7e017d289862ab75fc856720 **I havenāt used that specifically and canāt officially endorse it, but that should give you an idea
Oh ho
No, I donāt believe we have a callback handler set
I was expecting to find stuff in the console logs because I am a bad person who doesnāt read documentation, apparently
I will try that, thanks!
if you have logging enabled (i.e. logback or something) you will likely see them there too
iād suggest looking at the logs when you start up the app - it should record some details about the datomic config and creating the memcached connection
it should be and the fellow who set this up in Heroku in the long-long ago claims that heās seen useful peer logging in the past by changing the same value I did in our logback.xml
but I have not seen with my own eyes proof that this is true
hrm. you should just need to have logback.xml on your classpath and logback in your project deps
yeah, we do - just knowing that it should be logging something at startup is enough for me to chew on
We had one user who made the following suggestion, I havenāt tested but others have and it seems to work: >I installed autossh instead and hacked the script to use this, and it is now much more stable (and survives sleeps of my laptop). I wonder whether it might be worth having the standard script check for the installation of autossh and if found, use that instead (and maybe print a message to the user if not found, before continuing with the regular ssh client). For anybody interested in my little hack, I just commented out the ssh command at the bottom of the script, and added the autossh one. Like this... #ssh -v -i $PK -CND ${SOCKS_PORT:=8182} ec2-user@${BASTION_IP} autossh -M 0 -o āServerAliveInterval 5ā -o āServerAliveCountMax 3" -v -i $PK -CND ${SOCKS_PORT:=8182} ec2-user@${BASTION_IP}
Credit to @U9HA101PY. I might copy it over to the forum as I think this is the second or third time Iāve linked it.
as reduce says, https://mosh.org/ would probably work as well