Fork me on GitHub
#boot
<
2016-01-20
>
jethroksy00:01:51

Huh I always thought sift did some IO

jethroksy00:01:17

I've been using it to move my files out of the target directory

micha00:01:56

@jethroksy: it only manip[ulates the fileset

micha00:01:12

it doesn't do anything with actual files or directories at all

jethroksy00:01:07

So what it does now is to change the file write directory and name for a specific file?

jannis00:01:44

Is there a better way to re-test on changes than (deftask autotest (comp (watch) (test))? I keep getting OutOfMemoryErrors.

sooheon00:01:47

Hey all, I’m trying to deploy my boot managed app to heroku, but I should’ve figured it’s not a drop in replacement for lein here. I thought just having the uberjar and Procfile would be enough, but heroku rejects it:

remote:  !     Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote:       to use for this application automatically.
remote: See 
Anyone have experience with this?

codefinger00:01:12

sooheon: are you using a custom buildpack? maybe this one: https://github.com/upworthy/heroku-buildpack-boot

sooheon00:01:04

codefinger: ah I was just getting to the docs about buildpacks on heroku’s site. So the default buildpack expects lein I guess

codefinger00:01:26

you'll need to run heroku buildpacks:set

sooheon00:01:04

aha what do I need to change in my app itself?

sooheon00:01:24

ah ok I should supply my boot build tasks

codefinger00:01:40

You'll need a Procfile still, probably to run your uberjar. But then the boot build process is defined by that buildpack.

sooheon00:01:46

hm so if i have a (deftask package [] …) that created my jar for me, how should this buildpack know about it?

codefinger00:01:32

what command would you run locally to build the uberjar?

sooheon00:01:48

this one

(deftask package
  "Build the package"
  []
  (comp
   (less :compression true)
   (cljs :optimizations :advanced)
   (aot)
   (pom)
   (uber)
   (jar)))

sooheon00:01:06

so boot package

codefinger00:01:18

i mean what would you run at the command line?

codefinger00:01:56

so probably heroku config:set BOOTBUILD_CMD="boot package"

codefinger00:01:26

or maybe rename your package task to build (which is the default for the buildpack)

sooheon00:01:52

ah perfect I supply it to BOOTBUILD_CMD. I guess it defaulted to build yeah saw that in the logs

sooheon00:01:59

thanks very much!

jannis00:01:23

@codefinger: Does it split up building and running to avoid hitting Heroku's up-and-running timeout?

codefinger00:01:03

@jannis: not sure I follow. you mean splitting build (create the uberjar) and running (running the uberjar)?

codefinger00:01:33

oh, would you expect it to build the uberjar everytime you run the app?

codefinger00:01:27

Heroku is a container-based system (like Docker but it uses LXC), so the build process creates an image, which is used to run your app. That's why it can launch new instances so quickly

jannis00:01:17

I tried one of the older buildpacks for boot with Heroku and it didn't work because it would just run boot run-production (or whatever command you defined) and that might take forever pulling in dependencies. Heroku has a timeout set for when the app needs to serve via the specified port and it always hit that.

codefinger00:01:19

so the build process creates the uberjar (and the image) and then every time you run the app, or launch a new instance (scale horizontally) it runs from that immutable image

codefinger00:01:35

oh yea, that's a bad idea

codefinger00:01:57

i think the lein buildpack used to do that a long time ago (and probably still can)

codefinger00:01:07

but now it's uberjars all the way down simple_smile

jannis00:01:40

Yeah, makes sense. I assume the build command is triggered on every push but not if you restart the app?

codefinger00:01:28

i'm of the opinion that you use build tools to build and app -- not run it. So lein run, mvn jetty:exec, boot run-production or whatever is a bad idea IMO

codefinger00:01:03

except in dev of course

codefinger00:01:21

@jannis: yes that's correct

codefinger00:01:52

so the image is immutable. That's why you can run heroku run rm -rf * and not break anything simple_smile

jannis00:01:58

Good. I would've needed this a few months ago but I'm glad something that works is out there now simple_smile

jannis01:01:28

And I fully agree about using an uberjar rather than boot for running the app.

jannis01:01:57

Among many things, it reduces the requirements for the host system to "is a JVM available?"

jannis01:01:23

Which is good, avoids dealing with distro packaging and admin complexity.

codefinger01:01:45

yea, it's really unique and amazing to have your only external dependency by the JVM.

jannis01:01:33

Slack really needs support for editing the previous mesage wth s/.../... (it actually works in Skype) 😉

sooheon01:01:50

wow skype has that? that’s pretty funny

sooheon01:01:55

s/funny/neat

codefinger01:01:56

especially given how i make mistakes

jannis01:01:36

Yeah, Skype is not very developer-oriented and it has it... go figure simple_smile

sooheon01:01:18

ah so much fun. the deploy has finished and I’m met with application error.

codefinger01:01:36

@sooheon: what does heroku logs show?

sooheon01:01:04

looking now...

sooheon01:01:39

@codefinger: this seems to be the relevant part

2016-01-20T01:03:50.277008+00:00 app[web.1]: Starting tomaton...
2016-01-20T01:04:16.856901+00:00 app[web.1]: System started
2016-01-20T01:04:16.835470+00:00 app[web.1]: Starting web server on 
2016-01-20T01:04:35.814912+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host= request_id=3c04485a-939c-4a74-b293-64ea546c3f95 fwd="110.76.142.159" dyno= connect= service= status=503 bytes=
2016-01-20T01:04:46.633792+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-01-20T01:04:46.633792+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-01-20T01:04:47.493600+00:00 heroku[web.1]: State changed from starting to crashed
2016-01-20T01:04:47.435510+00:00 heroku[web.1]: Process exited with status 137
2016-01-20T01:04:50.736134+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host= request_id=d728b842-6f1a-4749-932a-044a90b112e8 fwd="175.116.54.44" dyno= connect= service= status=503 bytes=

codefinger01:01:01

ah need to bind to 0.0.0.0 instead of localhost

jannis01:01:20

Ah. The timeout I was talking about 😉

sooheon01:01:27

just using my dev config

sooheon01:01:40

can you tell this is my first time? haha

codefinger01:01:41

yea, but in this case, it's just because it didn't bind to 0.0.0.0:$PORT at all

sooheon01:01:51

@codefinger: looking more carefully, the message was inaccurate. It does start the server on 0.0.0.0, it just displays localhost for convenience. Is it the port number thats the problem?

sooheon01:01:27

using http-kit’s run-server

codefinger01:01:47

@sooheon: are you setting $PORT as the port?

codefinger01:01:57

or (env :port)

sooheon01:01:09

ah looks like that’s the problem. I can’t explicitly set that, because heroku will do it for me.

codefinger01:01:04

Heroku sets the $PORT var. it will be different every time your app runs

sooheon01:01:13

how do I access $PORT from inside clojure?

codefinger01:01:09

or (System/getenv "PORT")

codefinger01:01:58

g2g. i'll be around tomorrow if you want to ping me with questions

martinklepsch05:01:59

@jannis: regarding your out of memory error: check the wiki on increasing permgen space (JVM opts page I believe) and make sure you're using boot 2.4.2 or later. My guess is the problem will be gone after those changes.

martinklepsch05:01:32

Instead of increasing permgen space you could also upgrade to Java 8 if that's a possibility

nayzak05:01:52

Hi to all simple_smile I've already got help about boot-cljs in #C03S1L9DN room. And now have new problem... My head is blowing up right now after trying to solve problem myself. By the way, I just started to learn clojure (particularly clojurescript). So I have website project mixed golang and cljs. In this project I have cljs source dir and public dir, where stored images, stylesheets, uploaded stuff and so on. Public directory is serving by web server. My goal is to build cljs sources into public/build directory. So in build.boot file I have (set-env! :source-paths #{"assets/cljs"} ...) and (target :dir #{"public/build"}). In assets/cljs I have file main.cljs.edn where I pass :asset-path option to cljs compiler. asset-path is "/build/main.out". And in my html page i have <script type="text/javascript" src="/build/main.js"></script>. And this configuration works. But boot-reload tries to reload files not from /build/main.out. It searches files in /main.out. If I change target dir from "public/build" to "public" and move main.cljs.edn from "assets/cljs" to "assets/cljs/build", then boot-reload works as expected. But content of my public directory erases every time cljs sources are compiled. And this behavior is unexpected by me. Have I any options to solve problem with build-reload paths, or with erasing contents of target directory? Or there is other way to make things right?

jaredly05:01:42

@nayzak: I’ve also had this issue. so what I do is have a static directory that is added as an asset-path (it’s the stuff that you have in public, I imagine) and boot copies the stuff over into the target directly. check this out https://github.com/jaredly/reepl/blob/master/build.boot

nayzak05:01:17

@jaredly I had an idea to ask boot to copy files in public dir, but didn't know how to do it simple_smile And what about saving content, that users uploaded, between builds?

jaredly06:01:23

Hmm I would say have the target path be different from the serve path — e.g.` (serve “public”)` but (target :dir #{“public/build”}) then you can put user stuff in public/uploads or something —— but you were having reloading problems with that setup?

nayzak06:01:55

@jaredly, yes... I tried to do that and got reload problem.

nayzak06:01:42

Hmm... asset-paths option helped me simple_smile Problem with uploads could be resolved on deployment level with symlinks for example.

seancorfield06:01:54

Question for @micha or @alandipert I think: it looks like you can specify "RELEASE" instead of a specific version to cause Boot to pick up the latest full release (or rather Aether). However, I just published a non-SNAPSHOT release of a project to http://clojars.org and "RELEASE" didn't work -- I had to specify an explicit release. Any insight into that?

seancorfield06:01:01

What's odd is that if I run boot -d seancorfield/boot-new new ... it picks up the very latest release from Clojars. I thought specifying "RELEASE" in dependencies was the same thing...?

seancorfield07:01:22

Anyways seancorfield/boot-new 0.2.1 is available with Boot template support, and built-in Boot templates for app, default (library), task, and template.

seancorfield07:01:28

Probably about time to start publicizing it simple_smile

seancorfield07:01:14

OK, this is weird... sometimes I can just run boot -d seancorfield/boot-new new -t foo -n bar but sometimes I need to specify the version (`seancorfield/boot-new:0.2.1`) depending on the template so I suspect it's something in my code 😞

seancorfield07:01:52

Hmm, I think it's just a caching issue...

seancorfield08:01:57

OK, wow, this is weird. The exact same Boot command sometimes succeeds and sometimes fails when it is run repeatedly in the same command window. OK, if I can figure out a pattern, I'll open a ticket. Maybe this is just a Windows thing?

ska08:01:16

@pesterhazy, @martinklepsch Thanks for your hints. I know I can suppress the warning, but I would rather Do The Right Thing. I thought, adding (target) to my deftask would suffice, but it looks like it doesn't. Note, that I also added :dir config to the call to target as well as to task-options!.

ska08:01:16

Or is it The Right Thing to set BOOT_EMIT_TARGET=no ?

ska08:01:31

The function run-tasks in core.clj seems to only look for that config setting.

pesterhazy08:01:35

@ska, it is The Right Thing

ska09:01:34

So I have to do a second step in order to avoid a deprecation warning. Ho humm. I expect that the default will be changed in one of upcoming versions then?

martinklepsch09:01:31

Also @jaredly just opened this one https://github.com/boot-clj/boot/issues/391 - I guess silencing the warning when using target would make sense

pesterhazy10:01:20

yeah I was confused by the warning message as well initially

magomimmo10:01:04

@martinklepsch: yep. in my tutorial I explained about the target warning and how to silence it, but I agree that the notification is not so clear to be immediately understood, because the only way you have to silence the warning it’s by adding the BOOT_EMIT_TARGET=no to boot.properties file in the project home directory or in the ~/.boot/boot.properties file. That said I really like the fact that by not using the new target task, I can still do a lot of thing in a much more efficient way: in the tutorial-20 I explained how to build, install and publish an artifact without using the target task. Probably there should be a guide about use cases that really need the target task and uses cases that do not need it.

martinklepsch10:01:02

Probably something the tasks docstring could elaborate on

jannis11:01:52

@martinklepsch: Thanks, I'll try increasing permgen space, although my system is already on struggling with 3-4 JVMs + 70 chrome tabs, memory-wise... 😉

jannis11:01:57

@codefinger: @sooheon: Following up on our short discussion last night. The feature is there, you have to type /s/foo/bar, not s/foo/bar though

martinklepsch12:01:34

@jannis: what boot/java versions were you running?

jannis12:01:01

@martinklepsch: In this case: boot 2.4.2 (should switch to 2.5.x) and java-1.7.0-openjdk-1.7.0.65

jannis12:01:53

Trying boot 2.5.5 and the permgen options from https://github.com/boot-clj/boot/wiki/JVM-Options now

martinklepsch12:01:07

There was an issue with pod pools fixed in 2.4.0 so 2.4.2 should be good https://github.com/boot-clj/boot/blob/master/CHANGES.md#240

martinklepsch12:01:10

with java 8 the permgen stuff has been renamed & changed significantly. most importantly there's no hard capping anymore

jannis13:01:19

Looks like I'll have to try Java 8. Even with the PermGen options, I'm running out of memory.

martinklepsch13:01:37

@jannis: what have you set it to?

jannis13:01:08

128M right now, I'll try 512M

jannis13:01:58

It takes like three reruns of (test) until it its the 128M limit.

martinklepsch13:01:04

in the worst case one of the tasks you're using has some sort of class leak in which case you could use a profiling tool to figure it out yourself or provide a minimal case and someone else can take a look at it

martinklepsch13:01:38

@jannis: usually after those runs stuff should get garbage collected

jannis13:01:00

There's not much going on apart from a Datomic database being created and deleted for every test (there are 6 tests).

jannis13:01:14

Via use-fixtures

martinklepsch13:01:59

each test run uses a new pod which adds to permgen. As said before an earlier problem with that has been fixed so not sure what is going on in your case

martinklepsch13:01:35

If you have JVisualVM installed you could check if the process actually reaches your permgen limit or faults because there is no more memory available on your machine

jannis13:01:38

At 8GB of RAM and 8GB of swap that seems unlikely. There are 1.6GB + 7GB free memory remaining after 1-2 runs of the tests.

jannis13:01:47

Unless top is lying to me. 😉

micha13:01:35

512M doesn't seem like enough memory for 6 datomic transactors and peers

martinklepsch13:01:02

@micha: this is just permgen not heap — still?

micha13:01:32

yeah still seems low

martinklepsch13:01:32

@jannis: Ah ok, thought you mentioned something like you were using most of your memory simple_smile

jannis13:01:05

@martinklepsch: I didn't actually check before now, sorry. I just noticed my system getting really slow and made that assumption.

jannis13:01:05

I'll be back later. It's survived 5 test runs with 512M of PermGen space, so perhaps that's good enough for now. Thanks! simple_smile

micha13:01:49

GC doesn't happen immediately, so things can pile up

pandeiro15:01:10

@juhoteperi: re: https://github.com/Deraen/sass4clj/issues/8, are you thinking that compass is incompatible with sass4clj?

juhoteperi15:01:55

@pandeiro: compass-mixins mentions Libsass so it should probably work

pandeiro15:01:35

Huh, yeah, b/c it was "working" with 0.1.1 (but only on initial compile; incremental would throw)

pandeiro15:01:49

But on 0.2.0 I can't even get the first compile to happen

pandeiro15:01:27

Yeah me neither simple_smile

pandeiro15:01:51

The exception is very cryptic too

pandeiro15:01:09

Does it really not know how to handle "file" urls?

pandeiro15:01:15

I'll post the full stacktrace in the issue for now...

juhoteperi15:01:21

But that should be fixed in 0.2 because I threw away custom webjars implementation

pandeiro15:01:00

OK I'll try to find the time to create a minimal repro these days; maybe it will clear things up

pandeiro15:01:00

Weird, I'm still having issues with Boot 2.5.5 fetching dependencies slowly / getting stuck while retrieving

pandeiro15:01:06

No one else has hit this I guess?

pandeiro15:01:59

I'm hesitant to open an issue b/c it seems like it is only happening when I run Boot via docker... but it's something I never hit with versions <=2.3.3

pandeiro15:01:36

Anyhow @juhoteperi good news is 0.2.0 does work w/ compass etc; closing my issue. Thanks for the help!

micha15:01:28

i've also noticed slow maven in docker

pandeiro15:01:12

docker keeps trying to get me to un-adopt it... but I'm pretty resilient (considering the alternatives)

micha15:01:23

haha yeah it's still pretty great

micha15:01:55

you won't hear me complaining about docker

pandeiro15:01:14

@micha You probably aren't on OS X right?

micha15:01:40

but i heard that they incorporated boot2docker into docker lately

micha15:01:47

so that should be looking better all the time

pandeiro15:01:13

Yes, they say... still doesn't work for my team due to a ~8 year old VirtualBox bug

pandeiro15:01:36

(Even the new docker-machine thing that is replacing boot2docker relies on virtualbox)

pandeiro16:01:21

Essentially you can't rely on being able to mount volumes from an OS X host in a container 😞

seancorfield16:01:05

I wasn't quite sure what to do for the task template in Boot new so I had it generate four example tasks (pre, post, pass-thru, and simple). Not sure of the value of simple. It doesn't include a fully expanded middleware example.

martinklepsch16:01:48

@seancorfield: I like that! simple_smile Just having something there already makes things usually a lot easier

seancorfield16:01:28

Happy to incorporate any and (almost) all feedback!

martinklepsch16:01:16

Don't have anything specific right now. I'm looking forward to your ideas regarding scaffolding/composable templates though

jellea16:01:21

Hi! Is there a way of disabling the HUD in boot-reload? It's the last step to get boot-react-native error free! 😄

jellea16:01:04

(because there's no dom there) simple_smile

martinklepsch16:01:20

I'll take a look

martinklepsch16:01:04

@jellea: currently there's no way but the fix shouldn't be to hard if you open an issue I can give it a go later today (maybe 😛 )

jellea17:01:36

martinklepsch: cracked it! how do I install homebrew pods? simple_smile

martinklepsch17:01:51

homebrew pods?

martinklepsch17:01:18

"you are speaking in puzzles my friend" 😂

jellea17:01:06

meant that I forked boot-reload, modded it and now want to install it locally simple_smile

martinklepsch17:01:25

@jellea: boot pom jar install I believe

pesterhazy17:01:15

not sure the HUD is a good thing to enable by default anyway

martinklepsch17:01:39

@jellea: PR certainly welcome. I guess in general we just need another option and the server should not send visual messages anymore.

pesterhazy17:01:44

by the way, #boot definitely has become TEH place to hang out

pesterhazy17:01:40

it seems like an optional feature that can break things and may be surprising to newbies (I didn't know about it)

martinklepsch17:01:12

especially for newbies I see big value in being more proactive about communicating compilation errors/warnings

jellea17:01:31

yeah think react-native is an edge case

martinklepsch17:01:50

There was another case where it broke something though so I guess I agree about that bit but I'd rather fix those issues than disabling it by default

onetom17:01:08

@pandeiro: i find this "dev & prod env should be the same" rule is a bit over-hyped. in practice it might be an issue 0-2 times a year... the ~6 of us are running our clojure code directly on osx and it works just fine on amazon linuxes in production too.

martinklepsch17:01:45

how bad on a 1-10 scale is a fn signature like this? 😄

([callback])
  ([library callback])

alandipert17:01:57

why not make callback the first argument in both cases?

alandipert17:01:26

(that's what i usually do unless there's some other reason not to)

martinklepsch17:01:39

@alandipert: because the library is more imortant info when reading the code

micha17:01:40

depends on how you are going to thread it

martinklepsch17:01:02

I guess I'll just do [library callback] and handle a :default case for library

micha17:01:32

thread-last vs thread-first, i usually do the former when it's a function that operates on collections, like map/filter/reduce, and the latter when it's an operation on an object

martinklepsch17:01:46

more important info... or at least becomes less well readable as a single keyword in tailpos

micha17:01:50

either way makes sense i think

martinklepsch17:01:54

anyways... 😄

micha17:01:10

(partial f library) vs (partial f callback)

alandipert17:01:32

in the end i'd recommend an options map and a set of multimethods for handling various scenarios. each method should return a deftype and then the user-facing API can be protocols

martinklepsch17:01:49

😄 😄 😄 😂

pesterhazy17:01:16

I don't think that's a bad signature

jaen17:01:04

@martinklepsch: IIRC the HUD also caused problems if you wiped the body content (like with mounting React directly on the body tag). Not sure if that's something to fix though.

martinklepsch17:01:56

@jaen: ah right that was it. IMO probably not worth fixing though. easy fix for user + I believe wiping body might also kill many third party script thingies (e.g. intercom)

pandeiro17:01:12

@onetom: yeah I agree, but then what if your company/project has N different runtimes?

pandeiro17:01:18

(not just clojure)

jaen17:01:45

@martinklepsch: not sure if there's something in the DOM you can listen on to see if DOM changed. Could be a helpful hint to say "you're changing the body, it might trip boot-reload up".

martinklepsch17:01:26

@jaen: I'd put it in the readme under # Troubleshooting and be done with it 😄

jaen17:01:44

That's also sensible ; d

malcolmsparks19:01:07

I wondered if anyone on the boot channel were using cider with boot-cljs-repl and have cider-find-var (M-. on a symbol) jumping to the symbol definition - I just want to know if it's possible before I try to configure it - it's the one thing I really miss

pandeiro19:01:02

@malcolmsparks: would you need to have eval'd the namespace first to be able to jump to definitions?

pandeiro19:01:21

or is it enough to open a cljs file once the boot-cljs-repl is started and connected?

pandeiro19:01:03

I tried to M-. on subscribe (re-frame.core/subscribe) and it says 'Symbol subscribe not resolved'

pandeiro19:01:11

I'm also unable to cider-eval-buffer on cljs file buffers without a java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #' found for class: nil

pandeiro19:01:38

I end up using projectile more to find vars and strings in general in other files

pandeiro19:01:00

Definitely not as nice as M-. but sort of accomplishes something similar

laforge4921:01:44

Re scoping of dependencies for a library. Only dependencies used by the library itself should be unscopped, with dependencies used for testing and the build.boot file given a scope of test, yes?

laforge4921:01:46

With only org.clojure/clojure being implicitly required by a .cljc file?

alandipert21:01:26

@laforge49: in most cases it's best for clojure to be an implicit dependency, yeah

laforge4921:01:03

unscoped then, hmm?

laforge4921:01:16

Thanks guys!

micha21:01:39

implicit? you mean explicit, right?

micha21:01:18

with boot you want to specify a clojure dependency, and it should be the same as BOOT_CLOJURE_VERSION or you may see weird things

alandipert21:01:47

im talkin bout in your build.boot w/ your deps if you're making a library

micha21:01:17

that's a tricky problem

alandipert21:01:43

i think leaving the clojure version specification to applications is the best default

micha21:01:54

i think we see a somewhat distorted view of it because clojure itself is so stable

micha21:01:08

so we can get away with that so far

micha21:01:36

but if that changes there could be a lot of issues, so i don't know what is the best way

micha21:01:09

not specifying a clojure dep makes it maybe easier for the consumer because you're not going to pull in your own version of clojure

micha21:01:24

but that is also maybe a moot point because some dependency will anyway

alandipert21:01:37

i am hopeful that languages and platforms of the future will all of pod-like things

alandipert21:01:49

docker holds the torch

micha21:01:54

dunaj has a pretty nice solution there, too

alandipert21:01:00

what do they do?

micha21:01:09

like you said, core pragmas etc

micha21:01:27

there is no automatic refer-clojure in dunaj

micha21:01:46

you need to do that, but there are recipes, the pragmaesque things

alandipert21:01:43

yeah that's sweet

alandipert21:01:10

man i need to do more dunaj

meow23:01:58

I want to do more dunaj as well - perhaps even another LISP...

seancorfield23:01:24

Re: versions of Clojure — we wrote a wrapper script for Boot itself and we "pin" versions of a number of libraries using a version.properties file in our project. Our wrapper looks for that file, reads the Clojure version out of it, and sets BOOT_CLOJURE_VERSION from that. Then in our build.boot, we also read that file and we post-process the dependencies vector to override any versions that are "pinned".

seancorfield23:01:01

We also calculate our JVM opts in that wrapper script (setting client / TieredCompilation or server as appropriate based on the environment)