Fork me on GitHub
#boot
<
2016-03-25
>
Jon02:03:53

My issue is alread here...

Jon04:03:38

how do you keep the process running in boot watch? My code looks not good

(if alone (loop []
      (Thread/sleep 400)
      (recur))))

Jon08:03:54

just migrated my first project from lein to boot. Noticed by projects based on Node.js might not be ready since boot-reload does not work for Node.js .

mangr3n08:03:21

I’m thinking of trying to use boot to watch manage and mutate a set of services running from a github backed configuration (.edn file) that might include building docker images, creating new clusters of services and modifying/restarting existing services. I’m guessing creating tasks that wrap command-line tools and perhaps turn the results of commands (like docker inspect) into clj data structures might be useful. Anyone tried anything like this?

Jon08:03:04

Like this one https://github.com/danielsz/boot-shell ? Or even deftask with sh directly?

alandipert13:03:01

@mangr3n: that sounds like something clojure could definitely do and you could put boot in front as the interface. at adzerk we have lots of boot scripts for doing admin stuff

alandipert13:03:42

however for infrastructure admin/ops we lean on awscli, bash, and json-table

alandipert13:03:19

so i would say if what you imagine is more like a daemon, boot could be good. if you'll be running it a lot, the startup time will be a bummer

mangr3n14:03:21

I think of modern applications as long running entities with replaceable parts, and the meta-system is an important part of the “system” if that makes sense. The watcher/manager is what I’m envisioning here. I’d like to be in immutable data structures with functional pipelines for that, externally, if I can describe an intention in data and the system rearranges to accommodate the intention… Eventually the system develops an immune system, and other types of analogous infrastructure in service of whatever the prime business function of the system is. One can see how metrics tools like graphite become part of the feedback loop. With all of that nascent in my mind, I’m looking for a flexible tool that can watch a resource and if I were to do a diff, turn the diff result into a command to trigger “recipes” that could be executed, and perhaps a check to validate, and lastly maybe an “undoing” function. Eventually it could watch metrics tools or data analytics tools and develop new “commands” from those inputs for scaling services, or other behaviors, but the way that boot thinks about the world feels like a powerful effective way to model this set of problems.

mangr3n14:03:14

Thanks for your thoughts. @alandipert, do you have a link to json-table? I’m moving into docker on openstack, and I’d like to move up a level from bash, which is what I’m using now. I want to decompose my functionality into reusable parts. that I can recombine into new patterns. I also want to create templates for deploying N2-Nn of my application. I’d used pystache (mustache with python) to do the template instantiation work, but I’d prefer to use <something> + edn in clojure instead. Everywhere I can use clojure I find myself happier, because I’m feeding my ongoing functional/immutable mental renaissance.

micha14:03:56

jt is normally used from a shell script though

micha14:03:01

that's what it's really designed for

micha14:03:51

to get data out of nested data structure land and into a tab delimited line oriented format that you can use with shell coreutils

dominicm20:03:17

Is it possible to get the current class loader in boot?

dominicm20:03:37

i've tried (.getContextClassLoader (Thread/currentThread)) and also (clojure.lang.RT/baseLoader) neither had my dependencies on the classpath though

micha20:03:20

@dominicm: that should work

dominicm20:03:14

Do I not need to mess with dynapath or something like that @micha ?

micha20:03:26

i don't think so

micha20:03:55

dynapath is just a way to mark classloaders as mutable or imutable

micha21:03:11

it's a convention, basically

dominicm21:03:31

oh right. I see.

dominicm21:03:37

Hmm... I wonder why it's not working then

micha21:03:45

i think the repl does weird classloader things

micha21:03:50

what are you doing?

micha21:03:10

(io/resource "some/thing" (clojure.lang.RT/baseLoader))

micha21:03:12

like that?

dominicm21:03:14

Slightly more complex.. maybe I'm taking it too far though.

(defn find-the-class
  [c]
  (if (= java.lang.ClassLoader c)
    c
    (find-the-class (.getSuperclass c))))


(let [cl (.getContextClassLoader (Thread/currentThread)) #_(clojure.lang.RT/baseLoader) #_(first (pod/classloader-hierarchy))
        cl-class (find-the-class (class cl))
        cl-field (.getDeclaredField cl-class "classes")]
    (.setAccessible cl-field true)
    (println
      (filter #(re-matches #".*hara.*" %)
              (map str (vec (.get cl-field cl))))))

dominicm21:03:34

I'm trying to get a list of classes

dominicm21:03:31

... I just realised I can just use the autocomplete in the repl

dominicm21:03:59

I'm trying to find something in datomic, because the free transactor isn't being published anymore as a lib, and I'm wondering if it's been merged into the core lib for distribution

dominicm21:03:42

Doesn't seem so 😞 hmph

dottedmag21:03:44

I have added to build.boot [com.github.bdesham/clj-plist "0.10.0"], which uses clj-time. Now when I run boot repl and try to require a namespace which uses clj-plist, I'm getting clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: org.joda.time.YearMonth, compiling:(clj_time/core.clj:1:1)

dottedmag21:03:48

How do I debug such an error?

dottedmag21:03:19

I'm not even sure it is related to Boot, actually.

micha21:03:38

can you do (require 'clj-time.core)

dottedmag21:03:52

No, it gives the same error.

dottedmag21:03:20

I don't have clj-time in build.boot, I thought it should be picked up recursively, should it?

micha21:03:31

hm, what about (import org.joda.time.YearMonth)

micha21:03:35

does that work in the repl?

dottedmag21:03:55

ClassNotFoundException

micha21:03:12

ah yeah, the first step in debugging is probably to do boot show -d

micha21:03:19

that will show you your dependency graph

micha21:03:21

as a tree

micha21:03:42

that will show the result that maven arrived at after resolving conflicts

micha21:03:29

perhaps it's the wrong version though, so that particular class doesn't exist in the jar

micha21:03:40

i.e. it was added in a later version of joda

micha21:03:48

to see that you can do boot show -p

micha21:03:56

that will print only conflicts

dottedmag21:03:09

Ah, clj-time is hanging from buddy-sign, but joda-time is from clj-plist, I see.

micha21:03:26

yeah show -p will show the conflicting versions

micha21:03:43

that gives you the info you need to be able to add :exclusions

dottedmag22:03:03

clj-plist depends on joda-time 1.6, but buddy-sign depends on joda-time 2.8.2, right?

micha22:03:21

so the top level is the contested dependency

micha22:03:03

the item in the box is [!] or [check]

micha22:03:25

the ! means that maven chose the version by its own resolution strategy

dottedmag22:03:05

Thanks, now it works!

micha22:03:14

where the check means that you specified it as a dependency

micha22:03:38

yeah the class not found error, when it's a weird java class you never heard of

micha22:03:50

that's a dependency version issue like 90% of the time

micha22:03:59

some later version added that class

dottedmag22:03:19

The dependencies management is such an easy task with Boot, actually, once the basics set in. Not that Boot can help when different projects require conflicting versions, but the boot show -[pd] is so sweet.

micha22:03:10

also boot show -c might help sometimes

micha22:03:18

that lets you see the jars easily

micha22:03:23

so you can do things in the shell

dottedmag22:03:23

And there's -u to avoid hunting for updates. boot show is now my favourite Boot command ever :)

micha22:03:34

hahaha 👍

micha22:03:56

you can also do a thing like this:

micha22:03:11

boot -d hoplon show -u

micha22:03:25

that shows you the latest release version of hoplon

micha22:03:34

without needing a build.boot or anything

dottedmag22:03:11

Ah, I was looking how to do a similar thing, missed -d option. nice.

micha22:03:36

you can have multiple -d options also

micha22:03:05

boot -d foo -d bar/baz show -u

lilymgoh23:03:05

Hi, I’m new to boot. I installed it through homebrew successfully. When I try running boot, I’m getting this weird error back.

clojure.lang.ExceptionInfo: Unable to resolve symbol:  in this context
    data: {:file
           "/var/folders/z_/ffgkd2vx1njf0bgs8vvngn600000gn/T/boot.user5783172942691039801.clj",
           :line 0}
java.lang.RuntimeException: Unable to resolve symbol:  in this context
               ...                
boot.main/-main/fn   main.clj: 192
   boot.main/-main   main.clj: 192
               ...                
  boot.App.runBoot   App.java: 390
     boot.App.main   App.java: 467
               ...                
         Boot.main  Boot.java: 258