Fork me on GitHub
#boot
<
2017-02-10
>
twashing04:02:04

Does anyone know how to get trapperkeeper working with boot?

twashing04:02:23

Nevermind. Got it.

(require 'puppetlabs.trapperkeeper.main)

(deftask run-trapperkeeper []
  (with-pass-thru _
		  (puppetlabs.trapperkeeper.main/-main
		   "--config" "dev-resources/config.conf"
		   "--bootstrap-config" "dev-resources/bootstrap.cfg")))

richiardiandrea05:02:32

Do you guys have any opinion on this pomegranate thing I found? https://github.com/cemerick/pomegranate/pull/80#issuecomment-278858505

twashing05:02:55

For boot-cljs-repl , when you (start-repl) , how do you instrument your index.html to connect back to the dynamically generated ws port?

boot.user> (start-repl)
<< started Weasel server on ws://127.0.0.1:55652 >>
<< waiting for client to connect ... 

twashing05:02:40

… I see how to do it if you want to hard-code the port 9001, for example.

twashing05:02:00

But I’m interested in how to do it for the dynamic ports that weasel throws up.

qqq06:02:09

@twashing : my understanding is that you have to run two repls, "boot repl <-- this one you run (serve ... ), and (cljs-repl) , and (watch)" ; then in a seprate shell, you run "boot repl -c // (start-repl)" -- then by some magic, the second one (which I start after the first one), pulls all the port info from the first one

qqq06:02:18

I don't know how they communicate (file?) but somehow they do

twashing06:02:12

@qqq Hmm. Ok. I’m digging into it as we speak.

qqq06:02:18

@twashing : you seem like someone who's not afraid of hardwork; let me grab you the uber docs

twashing06:02:43

Lol. Thanks.. I think :)

qqq06:02:54

https://github.com/magomimmo/modern-cljs/tree/master/doc/second-edition <- someone recommended this to me. I worked through the first 6 tutorials (they're very short).

qqq06:02:19

It walks you step by step on how to setup cljs with boot. It's amazing in that it goes "this is the dumb way to do it ;; this become tedious ;; now I will teach you a new feature to make past work trivial "

qqq06:02:31

and at the end of it, you get a very very good understanding of what each of the boot tasks means

qqq06:02:53

boot/cljs did NOT make sense to me until I worked through the first 6 of that series; and afterwards, I got not only a fully working setup, but also a fundamental understanding

qqq06:02:57

I can't oversell / over recommend this.

twashing06:02:58

I’m actually trying to get this working in boot… in trapperkeeper

twashing06:02:49

I want to see if I can stitch a cljs browser repl in there

twashing06:02:09

I have TK and boot-cljs-repl running separately

twashing06:02:26

Now it’s a matter of making them work together.

qqq06:02:27

can you get cljs browser repl working without trapper keeper ?

twashing06:02:48

Well… I need to serve up the index.html that connects back to the ws

qqq06:02:48

you know what this means? I can't help you 🙂 because you no longer have a boot problem, you have a trapper keeper problem 🙂

twashing06:02:58

But you get the idea

qqq06:02:32

I don't understand how "long running services" and cljs brepl work together.

twashing06:02:39

Well, I think I have a weael problem

qqq06:02:52

when I wnat code reloading, it's because I'm developing locally

qqq06:02:00

if I want long running services, they're on some remote server

twashing06:02:03

I need to know how its generating it dynamic port

qqq06:02:42

wait wit wait

twashing06:02:46

I find when I deploy things, it’s nice to have a service that fires up my code and just runs there.

qqq06:02:48

run "cat .nrepl-port"

qqq06:02:56

I thikn that's how the "two boots" communicate the port#

twashing06:02:14

Ahh, that may be it. Lemme check.

qqq06:02:42

yeah, so if you fire up a regular nrepl in boot, it appears it writes a ./.nrepl-port ; which I thikn is how the other nrepl picks it up

twashing06:02:10

That sounds right.

twashing06:02:42

But now, weasel opens a ws on a dynamic port. What I think I’ll do is just spell it out explicitly (cljs-repl 9001).

qqq06:02:12

1) I was right, you're definitely hard working. 2) looks like we have returned to your exact solution from an hour ago -- hard coding 9001 🙂

minikomi06:02:06

Hi there. I was hoping I could get some guidance when developing using boot for front end (less, cljs), while the backend is running on vagrant. I'd like to run boot locally, and mirror output to another folder which is served from vagrant.. but I think I lose reloading then?

minikomi06:02:10

the backend is not clojure, unfortunately.

qqq06:02:54

I would just rsync the source directory to vagrant

qqq06:02:05

this would cause the vagrant to recompile + reload

qqq06:02:00

watch rsync: local/src to vagrant/src edit: local/src on save, rsync auto runs, updating vagrant/src this triggers cljs recompile + reload on vagrant

juhoteperi06:02:02

@minikomi In addition to http server serving the files, for reloading browser needs connection to http server set up by boot-reload. You could configure boot-reload to use address and port that are accessible from vagrant.

minikomi06:02:30

If I was running boot on the vagrant maching I'd do so, but I'd rather have boot running locally than in the constrained vagrant machine. Also, I won't be using clojure in produciton and I'd like to keep my vagrant machine as close to prod as possible

minikomi06:02:19

Yeah, it seems like running boot on the vagrant machine simplifies everything. oh well.

qqq06:02:07

So (1) you're running boot locally (2) you want your browser pointed at VAGRANT, not LOCAL, and (3) you want browser to auto reload?

minikomi06:02:44

right. when using gulp i was able to do it since every save compiled and output a file to disk - mirrored and served from vagrant.. but the livereload chrome plugin was notified by local server and reloaded the javascript from there.

qqq06:02:15

I think the problem is that boot reload sets up some magic via websockets.

qqq06:02:33

So unless your ssh portforward the local ws server to vagrant, it's not clear how it would work.

qqq06:02:23

Actually, there's probably a way to get boot to hardcode the ip address of the ws server, this would cause the browser to load webpage from VAGRANT, but then connect to local for ws.

minikomi06:02:56

That would be ideal.

qqq06:02:21

I faced this exact problem.

qqq06:02:25

I thikn the line you want is:

qqq06:02:43

(I should ask for a financial donation here) 🙂

qqq06:02:47

[I'm kidding]

minikomi06:02:04

looks like i can set IP/port? hmm

qqq06:02:05

the line you want is: (cljs-repl :ip (.getHostAddress (java.net.InetAddress/getLocalHost)))

qqq06:02:31

oh wait, maybe this is not what you want; this is for connecting repl ws

qqq06:02:33

you want reload

minikomi06:02:41

yeah, i think reload should work just fine

minikomi06:02:11

it's more, the output js / less -- should I do a sift to make it output after every watch?

minikomi06:02:59

i'm still a bit unsure how boot-cljs, boot-less and boot-http work without outputting to a build folder

minikomi06:02:09

some kind of tmp folder magic?

juhoteperi06:02:20

fileset contents are available from classpath

qqq06:02:30

I have never used boot-less, so this unfortunately is the limit of my helpfulness.

qqq06:02:58

but I think (1) if you just rsync, live.js will pick it up and (2) if you have websockets pointed at correct ip, brepl should work -- and it's not clear you need anything more

minikomi06:02:30

local files from my backend folder are automatically mirrored to the vagrant machine

minikomi06:02:55

i'd ideally like to get output from less/cljs into a /static folder there

qqq07:02:10

isnt't this just watch + rsync, or is there something more ?

minikomi07:02:02

sure.. I guess I'm not sure where files are being output when I don't do a sift/target? Or, should I do that in my dev build too to get the files?

qqq07:02:23

(defmulti foo :foo)
^^ should the above code work inside a browser repl? I'm gettin a weird ferror of "can not read foo of undefined"

minikomi07:02:04

Not entirely sure how to go forward from here.. can you give me another hint? 🙂

minikomi07:02:50

@qqq The following worked fine for me:

cljs.user> (defmulti foo :foo)
nil
cljs.user> (defmethod foo 1 [] "one")
#object[cljs.core.MultiFn]
cljs.user> (foo {:foo 1})
"one"

qqq07:02:53

@minikomi: thanks! that worked for me too. For some weird reason, the difference is: 1. if I type it in the repl buffer, it works 2. if I type it in my source buffer and do eval-last-sexp, it fails this is very helpful as it points the bug at "what is the difference between typing in repl vs C-x C-e"

qqq07:02:53

@minikomi : thanks! that fixed my problem

qqq07:02:56

are you still stuck on your problem?

minikomi07:02:14

I think just using a (target) at the end if my dev pipeline solves what i want

qqq07:02:28

yeah, (target) is what causes stuff ot be written out

qqq07:02:36

how would it be possible to work without a target?

minikomi07:02:56

using (serve) was working for just local files

minikomi09:02:41

:ws-host was what i wanted for reload.. works great!!

pesterhazy11:02:34

the poll function looks like a great hack

pesterhazy11:02:07

exactly the kind of idea you're inspired to when working from a repl

alandipert14:02:29

@pesterhazy thanks man, that was exactly my goal, spark the imagination

podviaznikov16:02:17

this is amazing. I usually don’t write many boot files so that wasn’t a big problem for me to wait 7 seconds. But for demos when you show how to use create boot files (or perun tasks in my case) this is great

qqq16:02:47

@pesterhazy @alandipert pool should be a builtin, I have used (load-file "build.boot") so often that I ask myself "why can't boot just reload this too)

hiredman19:02:43

any advice to speed up uberjar creation?

hiredman19:02:56

on our ci server the uberjar creation part of the build takes over 10 minutes

joshmiller19:02:38

@hiredman Are you making sure dev/test-only source and dependencies are excluded?

dominicm19:02:06

@hiredman I think @micha mentioned something about a function which could cache library explosions for uberjars. I'm not sure if it was used in the latest boot or not though.

richiardiandrea19:02:50

yes uberjar explosion is cached

richiardiandrea19:02:21

in theory that should work fine, unless there are bugs

dominicm20:02:09

@hiredman are you all up to date?

hiredman20:02:59

well a cache only works if your build carries the cache forward between runs

richiardiandrea21:02:55

the build should use .boot for storing stuff

podviaznikov23:02:05

is there some project that generates nice html docs for boot tasks?

richiardiandrea23:02:25

not that I know of

danielsz23:02:17

@podviaznikov You could try with codox.

danielsz23:02:33

Not specific to Boot tasks, mind you.