Fork me on GitHub
#untangled
<
2016-12-29
>
fragamus00:12:58

Now I am having fun with these recipes. I like that I can have embedded css in my render functions. Some might say that it should be separated so that a non-developer could mess with it, but in a full stack development mode this way seems better.

fragamus06:12:22

Is there a recipe for using datomic

ianchow06:12:49

there’s untangled-todomvc. it uses untangled’s own layer on top of datomic. personally i just roll an ad hoc component like so https://github.com/swannodette/om-next-demo/blob/master/todomvc/src/clj/todomvc/datomic.clj

wilkerlucio17:12:47

hello, I'm trying to compile an untangled app for production, but I'm getting this error:

wilkerlucio17:12:52

you guys have any idea what this is about?

wilkerlucio17:12:27

when I try to compile using the lein uberjar I get a different error message:

tony.kay17:12:32

Hm. Not sure why it is looking for that interface. @adambros made those changes recently to server. If you're not needing the latest server, then I'd drop back on the version. We have not had time to debug :advanced compilation either, so you try :whitespace or :simple optimizations instead.

wilkerlucio17:12:06

@tony.kay actually this is using simple, I didn't changed the template, so I'm trying to get that first before trying advanced

tony.kay17:12:43

but it builds in figwheel?

tony.kay17:12:55

latest version of cljsbuild?

wilkerlucio17:12:17

[lein-cljsbuild "1.1.4"]

tony.kay17:12:47

try 1.1.5 (clean and rebuild)

tony.kay17:12:55

this is on untangled-template?

tony.kay17:12:22

also, did you add deps? If so, have you analyzed and corrected any problems in lein deps :tree?

tony.kay17:12:47

the default template compiles for me in production mode

wilkerlucio17:12:10

just tried the update, but no success...

wilkerlucio17:12:58

it's from the template and I have added a few dependencies, I should being trying to compile from the start, but this is first time I try, so, kind stuck here...

tony.kay17:12:29

lein deps :tree is your friend, for sure

wilkerlucio17:12:35

I'm using latest cljs and clojure ([org.clojure/clojure "1.9.0-alpha14"] [org.clojure/clojurescript "1.9.293"]), the bad part is that I'm actually using clojure.spec a lot, I can't try rolling back

wilkerlucio17:12:45

ok, let me check what the deps tell me

tony.kay17:12:53

are you using any cljc files?

tony.kay17:12:09

Ah, you might have clj only stuff not annotated that way

tony.kay17:12:27

not sure why it would work in figwheel, but never know

tony.kay17:12:14

the untangled/server/core/APIHandler bit should not be showing up

tony.kay17:12:24

you might have a require that is hitting both sides

wilkerlucio17:12:26

my cljc files are pretty simple, mostly they used shared stuff, the only occasions it doesn't are for integer coercion and string trimming (which uses google closure on cljs)

tony.kay17:12:30

com.google.common...same thing

wilkerlucio17:12:38

I tried to look for unwanted things, but not much there

tony.kay17:12:48

both of those things are Java/Clojure things, not cljs

tony.kay17:12:38

maybe you meant goog.string

tony.kay17:12:34

anyhow, those are my best guesses based on your errors

wilkerlucio17:12:37

this is the file, I don't think it's about it:

wilkerlucio17:12:39

(ns remember.input-tags
  (:require [clojure.string :as str]
    #?(:cljs [goog.string :as gstr])))

(defn str-trim [s]
  #?(:clj  (.trim s)
     :cljs (gstr/trim s)))

(def tag-regex #"\[(.+?)]")
(def tag-regex-with-empty #"\[(.*?)]")

(defn process [input]
  (let [input (or input "")]
    {:text (-> input
               (str/replace tag-regex-with-empty "")
               (str-trim))
     :tags (into #{} (map second) (re-seq tag-regex input))}))

wilkerlucio17:12:22

on the dependencies side, I added friend, which had some problems with ring-core because it was pointing to an old version incompatible with clj 1.9 (`ns` was incorrect)

wilkerlucio17:12:58

just the error message is weird, why it's failing on Java stuff during cljs compilation?

tony.kay17:12:15

agreed it is weird

tony.kay17:12:29

what JVM version?

tony.kay17:12:32

JDK, that is

tony.kay17:12:09

Is your IDE perhaps using one, and the command-line another?

tony.kay17:12:20

maybe you're hitting an old version of the JVM at the command line?

wilkerlucio17:12:06

Wilkers-MacBook-Pro:datomic-pro-0.9.5530 wilkerlucio$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

wilkerlucio17:12:29

ok, I tried changing the compilation from :simple to :none and now it worked

wilkerlucio18:12:03

@tony.kay now let's see how the uberjar goes 🙂

wilkerlucio18:12:47

so, seems to be working with none, thanks for the help Tony

tony.kay18:12:37

but none does not generate a single js file

tony.kay18:12:37

you at least want :whitespace

fragamus19:12:35

Are you guys aware that one month ago Datomic Pro became free to use with unlimited clients (no support though)? I am asking because I want to use it, and I'm wondering how hard it would be to fork untangled-todomvc and make it use Datomic Pro.

wilkerlucio19:12:03

@tony.kay just tried changing to whitespace, and errors got back

tony.kay19:12:45

@fragamus I was not aware. Should be nothing more than a dependency change, assuming you don't have to apply for a license file

tony.kay19:12:02

@wilkerlucio Hm. I'd be interested if you find out why. The template works, so it is something you added. I would strongly suspect the cljc stuff since it is complaining about Java stuff

wilkerlucio19:12:50

@tony.kay I'll find some time to investigate it deeper, try to debug and see if I can pinpoint whats going on, I'll let you know

tony.kay19:12:32

@fragamus Staying with free version we're on. Sounds like you still need a license file to make Starter work

tony.kay19:12:50

I want people to be able to try out the example code without going through extra hoops

tony.kay19:12:14

hopefully they'll continue to provide datomic-free. If not, then we'll look at the options

fragamus19:12:28

Of course, but my aim is to morph untangled-todomvc into an app of my own, and in order to scale, I'll need something like this Datomic Pro.

wilkerlucio19:12:27

@tony.kay I tried to run the compiled uberjar, and the error from ApiHandler showed up again

wilkerlucio19:12:44

Wilkers-MacBook-Pro:remember2 wilkerlucio$ PORT=8080 java -Dconfig=config/prod.edn -jar target/remember.jar 
Exception in thread "main" java.lang.NoClassDefFoundError: untangled/server/core/APIHandler (wrong name: untangled/server/core/ApiHandler)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:344)
        at clojure.lang.RT.classForName(RT.java:2183)
        at clojure.lang.RT.classForName(RT.java:2192)
        at untangled.server.core__init.__init0(Unknown Source)
        at untangled.server.core__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:344)
        at clojure.lang.RT.classForName(RT.java:2183)
        at clojure.lang.RT.classForName(RT.java:2192)
        at clojure.lang.RT.loadClassForName(RT.java:2211)
        at clojure.lang.RT.load(RT.java:445)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__7846.invoke(core.clj:6008)
        at clojure.core$load.invokeStatic(core.clj:6007)
        at clojure.core$load.doInvoke(core.clj:5991)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5812)
        at clojure.core$load_one.invoke(core.clj:5807)
        at clojure.core$load_lib$fn__7791.invoke(core.clj:5852)
        at clojure.core$load_lib.invokeStatic(core.clj:5851)
        at clojure.core$load_lib.doInvoke(core.clj:5832)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$load_libs.invokeStatic(core.clj:5889)
        at clojure.core$load_libs.doInvoke(core.clj:5873)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:659)
        at clojure.core$require.invokeStatic(core.clj:5911)
        at clojure.core$require.doInvoke(core.clj:5911)
        at clojure.lang.RestFn.invoke(RestFn.java:482)
        at remember.core$loading__7732__auto____16713.invoke(core.clj:1)
        at remember.core__init.load(Unknown Source)
        at remember.core__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:344)
        at clojure.lang.RT.classForName(RT.java:2183)
        at clojure.lang.RT.classForName(RT.java:2192)
        at clojure.lang.RT.loadClassForName(RT.java:2211)
        at clojure.lang.RT.load(RT.java:445)
        at clojure.lang.RT.load(RT.java:421)
        at clojure.core$load$fn__7846.invoke(core.clj:6008)
        at clojure.core$load.invokeStatic(core.clj:6007)
        at clojure.core$load.doInvoke(core.clj:5991)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.lang.Var.invoke(Var.java:379)
        at clojure.lang.Util.loadWithClass(Util.java:250)
        at remember.core.<clinit>(Unknown Source)

tony.kay19:12:02

turn on verbose compile option for cljs

wilkerlucio19:12:07

do you think the fact you have the protocol APIHandler and the class ApiHandler could be a problem?

tony.kay19:12:09

perhaps you can at least see which file it is hitting

tony.kay19:12:21

I didn't write APIHandler

tony.kay19:12:27

and have not reviewed it

wilkerlucio19:12:30

I just have a hunch that the names might be clashing

wilkerlucio19:12:45

the compiled output only has core$api_handler.class

tony.kay19:12:57

where would the clash be coming from?

tony.kay19:12:07

where is the class?

tony.kay19:12:13

I see the protocol

wilkerlucio19:12:24

there is a protocol named APIHandler and a defrecord named ApiHandler (line 181)

wilkerlucio19:12:38

the difference on name is only on the letter case

tony.kay19:12:57

Ah, I was looking at develop (where it is changed)

tony.kay19:12:37

just pushed 0.7.0-SNAPSHOT to clojars. Try that

tony.kay19:12:03

of server, but I assume you knew that

wilkerlucio19:12:09

can you remind me how I force the snapshot update?

tony.kay19:12:27

lein deps -U I think?

tony.kay19:12:11

oh, just lein -U any-task

tony.kay19:12:22

is the new way

tony.kay19:12:28

sweet. So, the current master is busted, but develop is not. I should cut a release probably

tony.kay19:12:16

actually, the current master was an internal release only, so you were already using 0.7.0-SNAPSHOT I take it

tony.kay19:12:27

and it was busted. So, guess we're ok

tony.kay19:12:57

your optimizations should work now on cljsbuild as well

wilkerlucio19:12:40

no, compilation with optimizations still failing, but I'm starting to suspect that the problem might be about my user.clj, I see some logs messages indicating it's being loaded, and I don't expected it too (because it loads some code to easy querying my system, but I don't expected it to be running during cljs compilations)

wilkerlucio20:12:07

@tony.kay hey, I found more weirdness here, hehehe, if I just remove datomic dependency the compilation with :whitespace starts working again

wilkerlucio20:12:45

I tried switching datomic versions, but any of then are failing (free or pro)

wilkerlucio20:12:33

seems that the guava dependency is incompatible between datomic and cljs 1.9.293

wilkerlucio21:12:18

@tony.kay all compilations working again! solution: add :exclusions [com.google.guava/guava] to datomic dependency

wilkerlucio21:12:37

even :advanced!! 😄

wilkerlucio21:12:08

so happy that advanced worked with no extra change 😄

therabidbanana21:12:50

This is timely info - I've been updating libraries today - cljs was going to be my last one - might be a problem from the sounds of it. Glad you found the source of the error @wilkerlucio 😄

wilkerlucio21:12:15

cool, hopefully it will be easier for you, please let us know if you bump in some problem 😉

tony.kay21:12:03

@wilkerlucio Yes, I did suspect that kind of dep conflict. That has very frequently been the source of problems for me.

tony.kay21:12:50

just for my own edification: were you getting warnings from lein deps :tree around that?

wilkerlucio21:12:36

kind of, it pointed that, but in the wrong direction

wilkerlucio21:12:47

it asked to exclude it on the clojurescript side

wilkerlucio21:12:00

but that didn't worked, excluding on datomic did

wilkerlucio21:12:26

I'm thinking that an alternative would be to move datomic dependency into a different profile, and exclude that profile while compiling cljs

wilkerlucio21:12:48

because I'm afraid excluding it from datomic might cause some problem in some situation

tony.kay21:12:40

so, the recommendataions are typically crap...it's the fact that it makes one that is helpful

tony.kay21:12:20

The exclusions route is so-so, as it just causes some other inherited dep to take precedence. If you nail the top-level to a version it is more explicit.

tony.kay21:12:33

but then you're saying you depend directly on the resource

tony.kay21:12:31

so, hard balance to strike. I have often chosen the route of declaring an explicit dependency rather than an exclusion, since the exclusions end up needing to be peppered about like the swedish chef got hold of your project file.

wilkerlucio22:12:02

had you people deployed datomic to heroku? I'm trying to follow this tutorial: https://elements.heroku.com/buildpacks/opengrail/heroku-buildpack-datomic

wilkerlucio22:12:20

I'm just not sure what my datomic connection url should look like

wilkerlucio22:12:26

should I point to localhost?

therabidbanana23:12:21

Since this is a buildpack for a transactor, I'm guessing the idea is to point another Heroku app's datomic client to whatever your heroku appname is - something like datomic:?

therabidbanana23:12:53

But we've always had Datomic in AWS and it's been a while since we moved off Heroku.

wilkerlucio23:12:26

humm, thanks @therabidbanana, I was trying to use both on the same app, I'll try to make a different one, thanks

fragamus23:12:07

how hard is it to deploy untangled-todomvc on heroku? I am going through the arduous process of morphing their starter app into untangled-todomvc. I tried to deploy untangled-todomvc but it lacked that certain something with which I am unfamiliar.