Fork me on GitHub
#boot
<
2017-01-22
>
qqq00:01:35

C-c C-c is not working inside of emacs -> boot I'm at a "boot.user>" prompt -- how do I end the session?

adamkowalski01:01:33

are there any tutorials that go through releasing a library to clojars using boot?

adamkowalski01:01:37

I have tried to publish something but when I tried importing somewhere else I got "Could not locate lib_name/core__init.class or lib_name/core.clj on classpath.”

adamkowalski01:01:16

But in my project I have the following structure lib_name boot.build src core.clj

adamkowalski01:01:28

I am using bootlaces and trying to deploy with boot build-jar push-snapshot

bhagany02:01:50

In case anyone was following along earlier - I think listing each of the modules as its own dependency is the way to go. Still interested to know if there's an easier way, though.

candera02:01:14

@qqq if you’re using cider, I imagine there must be something like M-x cider-disconnect available.

richiardiandrea05:01:23

@bhagany maven has the concept of modules that probably we don't have a way to detect in Clojure. The pom file should contain the list of modules of what they call a "parent pom" but boot does not parse it. There is a boot-pom task but even that one iirc does not handle submodules. It should definitely be added there imho.

bhagany05:01:46

@richiardiandrea okay, that makes sense. Thanks for the explanation. I did end up pulling the modules from the pom into my dependencies, and that worked, but it's still good to know that this is how it "should" be done, at least for the time being.

richiardiandrea05:01:08

Iight end up doing it myself at some point, it is just an XML parse I guess. The only problematic thing in pom.xml is the use of variables, which can come from anywhere..Again iirc you can print out a pom with everything resolved but you might need to shell out to mvn... mmm...Not good

bhagany05:01:53

yeah, that doesn't sound pleasant

msch11:01:18

Hi, total boot (and Clojure) newbie here: Just looked through the boot-gae examples and spotted something that requires an absolute configured path: https://github.com/migae/boot-gae-examples/blob/master/standard-env/greeter/build.boot#L8-L9 -> Is that a typical pattern? Any pointers on how to make this just relative to the file?

mobileink15:01:29

@msch: A relative path will work: :app-dir “../microservices-app"

msch16:01:37

@mobileink ah thanks. I've now just removed it, since I don't want a microservices app, just the simplest thing that works.

msch16:01:56

(now fighting boot - it's not easy for a total clojure newbie)

mobileink16:01:25

you should not need to remove it. just gae/build without the -s flag.

msch16:01:07

it's been a few hours, so I don't remember 100% but I think I did boot gae/run and that didn't work.

msch16:01:44

That leads my to the next thing where I've been hitting my head against the wall for 10 minutes now... I've defined two tasks, run and deploy that should both first invoke build and then either gae/run or gae/deploy. Yet only the gae/run task builds something, the deploy task just goes and tries to deploy the non-existant target directory...

msch16:01:52

;; copied from gae/build:
(deftask build
  "assemble, configure, and build app"
  [k keep bool "keep intermediate .clj and .edn files"
   p prod bool "production build, without reloader"
   v verbose bool "verbose"]
  (comp (gae/install-sdk :verbose verbose)
        (gae/libs :verbose verbose)
        (gae/logging :verbose verbose)
        (builtin/javac :options ["-target" "1.7"])
        (if prod identity (gae/reloader :keep keep :verbose verbose))
        (gae/servlets :keep keep :verbose verbose)
        (gae/webxml :verbose verbose)
        (gae/appengine :verbose verbose)
        (builtin/sift :move {#"(.*clj$)" (str classes-dir "/$1")})
        (builtin/sift :move {#"(.*\.class$)" (str classes-dir "/$1")})
        (gae/target)))

(deftask deploy
  "build and deploy"
  []
  (comp
    (build :prod true)
    (gae/deploy :module "default")))

(deftask run
  "run locally"
  []
  (comp
    (build :prod false)
    (gae/run)))

msch16:01:02

@mobileink I had to copy the gae/build task, to add the ["-target" "1.7"] to builtin/javac. Any chance you could make that a default?

mobileink16:01:16

try omitting the :module param to gae/deploy

mobileink16:01:41

good catch, will add default -target 1.7

msch16:01:18

@mobileink I had to add that, since it didn't use the one from set-env! when I tried it -> just tried to do HTTP requests with &module=

msch16:01:38

but trying again, maybe I broke it in some other way 🙂

msch16:01:47

Really appreciate you helping me out!

mobileink16:01:23

thanks for trying it; sorry the experience isn’t a little more smooth.

msch16:01:05

@mobileink ah one more thing: It'd be nice if it would be possible to do arbitrary :version strings, because they break in https://github.com/migae/boot-gae/blob/master/src/migae/boot_gae.clj#L309 right now

msch16:01:40

@mobileink no worries, I'm just trying to get something set up to hand to people that are new to programming. We're doing a small course and it'd be amazing if people could deploy their stuff on the free tier somewhere. And GAE is just the right thing for that

mobileink16:01:46

I was just working on that. module version strings will be independent of project version strings.

msch17:01:05

awesome!

mobileink17:01:20

did you try running boot gae/build gae/run from e.g. the greeter directory (with a fresh copy)? that should build a plain old servlet-based app, with the :module stuff ignored.

msch17:01:48

let me try. Without changing anything, not even the app-dir?

mobileink17:01:15

right, app-dir should be ignored unless -s is passed

mobileink17:01:25

for both gae/build and gae/monitor

msch17:01:43

@mobileink here's my full build.boot and the failure I get when trying to run boot deploy, it just seems to ignore the build task: https://gist.github.com/MSch/dca0d5f5260043e63f05920f529380e3

msch17:01:49

trying now

msch17:01:47

@mobileink yep, boot gae/build gae/run worked in a clean copy of greeter. No idea what I messed up when trying originally, thanks again!

mobileink17:01:13

your :gae map looks off, make it :module {:name “default”} not :module “default"

msch17:01:44

@mobileink now I'm getting OPTS: {:sdk-root /Users/msch/.appengine-sdk/appengine-java-sdk-1.9.48, :build-dir target/default} which results in Unable to find the webapp directory target/default. But it's still not running the build task, so the whole target directory doesn't exist

msch17:01:21

(my overall goal here is to have two foolproof tasks I can hand to beginners, that will remove the target dir, build the project either in prod or not and then run it locally or deploy it.)

mobileink17:01:04

ok, that probably means it thinks or thought you’re building a service.

msch17:01:04

yeah that's what I surmised and why I tried to change the :module setting. But I'm not doing -s anywhere

mobileink17:01:07

ok, I’m getting same running your build task.

mobileink17:01:23

i mean your deploy task

mobileink17:01:22

Found it! Bug in gae/deploy. Must not have tested that for servlet apps, dangit. Sorry about that, will fix and push shortly.

msch17:01:32

@mobileink no worries. Thank you so much!

mobileink17:01:52

Workaround: pass the -b (:build-dir) parameter to deploy: (gae/deploy :build-dir "target")

mobileink17:01:41

oh wait, that won’t work yet. 😬

mobileink17:01:56

might take me a few hours. if you want to hack a temp version see https://github.com/migae/boot-gae/issues/5

msch17:01:38

Where do I put that?

mobileink17:01:15

clone boot-gae, edit boot_gae.clj (near the top of deftask deploy), save, then run $ boot pom jar install to install it locally. then your app should pick it up. i think.

msch17:01:57

got it. I'll spend the time trying to merge the gae/run and gae/monitor tasks I think. Do you think it's possible to have the file watch in the same process?

mobileink17:01:45

you mean like run-async, then monitor, in the same task pipeline?

msch17:01:04

yep, so that everyone can just start/stop boot run and doesn't have to keep boot gae/monitor running

mobileink17:01:48

i’m not sure i can make that work with the mechanism I’m using (appcfg). the newer maven plugin from google does support async start/stop, but I’ve only just started to look at that. maybe someday.

mobileink17:01:53

there might be a way to fake it using boot pods, if you feel like becoming a boot wizard.

msch17:01:05

ah, I don't think that would be necessary. I read through what you do, and I think just doing the whole com.google.appengine.tools.KickStart in a spawned thread should work fine, no? So then boot goes to the next task in the pipeline and that's the monitor task

msch17:01:25

after all the monitor task just copies over .clj files into the target directory, right? (not sure if I missed something)

msch17:01:48

I'm just unsure because of the classloader shenanigans, if there's some danger in just starting the dev server in a newly spawned thread

msch17:01:04

(and as I said, total clojure newb, so literally 0 idea what is actually going on with boot and filesets and so on)

mobileink17:01:10

yep, only reason for monitor (instead of plain watch) is to deal with different output dirs between servlet apps and service apps

msch17:01:09

so you think doing the kick-start (Class/forName "com.google.appengine.tools.KickStart" true class-loader) part in a new Thread is all that's necessary? (or at least worth a try?)

mobileink17:01:53

might work. iirc kickstart itself launches a new process.

msch17:01:52

just checked the docs, yep it does. so I assume it blocks until that process dies, which doesn't happen since it's the gae dev server. Guess I can give doing that a try

mobileink17:01:57

but you’re asking the wrong guy when it comes to classloader hairiness.

mobileink17:01:31

i rely on the kindness of strangers to deal with that kinda stuff.

msch17:01:45

hehe 🙂 same here, same here 🙂

mobileink18:01:42

question for boot wizards: this pipeline works: boot gae/build gae/run. build creates the target etc. but this does not work: boot gae/build gae/deploy. the build task does not run. no idea what’s going on.

mobileink18:01:18

the deploy task invokes a method on a java object that spawns a process. is boot running these two tasks in parallel or sth?

msch19:01:17

@mobileink should the servlets (and other classes) be AOT compiled as part of the deploy? I just got Caused by: com.google.apphosting.api.DeadlineExceededException: This request ... was still executing ..., compiling:(ring/middleware/defaults.clj:1:1)

mobileink19:01:41

the servlet and filter stubs are always aot compiled; nothing else is. where are you getting this error, dev or cloud?

mobileink19:01:38

just pushed [migae/boot-gae "0.1.1-SNAPSHOT"]

msch19:01:41

@mobileink cloud, it doesn't start fast enough apparently

mobileink19:01:19

deploy should work for plain servlet apps, javac defaults to 1.7

msch19:01:32

@mobileink awesome. I'll update right away and will ping you.

mobileink19:01:43

startup in cloud is a wk prob for java

mobileink19:01:15

clojure doesn’t help much. 😉 but once the first instance is up it’s pretty fast

msch19:01:42

yeah but right now it seemed to not be able to start at all, so I had to redeploy and then it worked

msch19:01:01

is there a way I could aot-compile all libraries? Or is that something that would break clojure's dynamism?

mobileink19:01:39

sure, you can aot compile the whole schmear if you want to. do a little googling, though, I gather its not always the best strategy.

mobileink19:01:58

boot has an aot task

msch19:01:15

kk, will check that out

mobileink19:01:43

fwiw i haven’t had a problem with minimal aot. course i’ve only tried relatively small apps.

msch19:01:47

yeah I tried to change the scaling behavior, set it to min/max idle instances of 1 (so it doesn't shut down over night) and then it happened

msch19:01:04

(yes I saw that it doesn't yet create the config in the mustache templates, I just manually edited the xml while testing)

mobileink19:01:38

ah, yes, I should add a Caveat to the docs: I have done almost no testing with various production configurations. just crossing my fingers expecting it will all work somehow if basic examples work.

msch19:01:24

ah just ran into something else, I killed the appstats.edn and gae/build expects one, I also removed that line from my build task

mobileink19:01:24

oops. that’s on my enhancement list. ditto for filters.

msch19:01:40

no worries, just throwing it out there

mobileink19:01:00

but isn’t boot sweet? you can adjust to stuff like this by building your own tasks.

msch19:01:37

it is super nice. It is a bit hard to grasp the concepts when totally new, I am still unsure how it actually works with filesets and pre/post and env etc etc

msch19:01:41

but just hitting things works so far 😄

msch19:01:33

@mobileink boot build -p && boot gae/deploy works, boot build -p gae/deploy still doesn't run the build task, but I think that's also not meant to be solved right?

msch19:01:09

@mobileink so just checking, the -SNAPSHOT versions are stable? If we depend on 0.1.1-SNAPSHOT it'll remain the same version? I'd rather not have different people have different versions of the lib on their notebooks 🙂

mobileink19:01:35

SNAPSHOT is for work in progress, I actually pushed to it twice. but it should be feature stable, in this case. if I don’t find any other annoyances I’ll push 0.1.1 in a little while. I’ve got more enhancements etc. for 0.2.0

msch19:01:24

ok awesome. Just making sure for the workshop we want to do. I was thinking alternatively I'd fork it on clojars and have it as a private group (or whatever it is called) just available to workshop attendees

mobileink19:01:00

BTW, I’m thinking of switching the default to build service apps instead of servlet apps, since the Google docs treat services as kinda basic, even if they don’t deprecate seervlet apps. So -s would mean —servlet-app. What do you think?

msch19:01:52

Hm, again I'm neither a clojure nor an app engine expert, but coming from Elixir I think it should be something I have to configure in my build.boot and if I don't have either :servlet or :service it errors.

msch19:01:23

I'd do one example that is the absolute minimum, like what I'm working on right now, that just deploys a simple servlet app, and the rest can be the more-complex service setup, as you have right now

msch19:01:27

I've invited you to the repo I'm working in, if you care to take a look

mobileink19:01:30

will do in a while, must watch a football game for now:simple_smile:

msch19:01:53

hehe, enjoy it!

msch19:01:43

It's just me trying to do a minimal example, so nothing much to look at anyhow

mobileink19:01:43

btw you can set flags per task in build.boot. see task-options in https://github.com/migae/boot-gae/blob/master/build.boot

msch20:01:07

ah so it would be possible to make something that could do that for all gae tasks? E.g. (task-options! gae/base {:style :servlet})

mobileink20:01:56

i don't think that's possible right now in boot. not sure how useful it would be, since all tasks would need to support those opts. or they could just be ignored, i guess. this would be useful for e.g. --verbose.

mobileink20:01:02

well, i guess anything is possible, since we have clojure, but it't not designed-in, i think

neupsh20:01:37

hi, why does boot not add "target" directory in classpath?

neupsh20:01:12

i tried :`(map #(.getFile %) (-> {} .getClass .getClassLoader .getURLs))`

neupsh20:01:01

and it adds the jars from .m2 directories, and i see some .boot/cache/tmp/... directories which are added to classpath, but the 'target' directory is not there

juhoteperi20:01:26

target directory is write only, and exists only if you use target task

neupsh20:01:01

i have a few gen-class namespace, and i am facing errors while importing them (ClassNotFoundException), but i see those classes in target directory

neupsh20:01:23

i have the target directory, and it has the class as well

juhoteperi20:01:27

they should also be in some tmp directories

neupsh20:01:30

but i dont see it in classpath

neupsh20:01:43

but those temp dirs in the classpath don't have those classes

juhoteperi20:01:21

hmm, yeah if I recall correctly those gen-classes can be a pain

juhoteperi20:01:26

but the problem is not with target directory

juhoteperi20:01:55

are you using aot task to compile those namespaces? That should write the classes to temp directories?

juhoteperi20:01:10

I'm not sure if loading them only from repl works

neupsh20:01:01

yes, i have aot before the repl

mobileink20:01:24

@neupsh do you have a target task after the aot task?

neupsh20:01:18

yes i have the target task

mobileink20:01:02

hmm, looks ok to me. let's start with the obvious: are you sure you got the syntax and spelling right for import?

neupsh20:01:40

yes, let me try to write a small test project and see if it works or not

neupsh22:01:45

nevermind, i found the issue. it was a require statement for my system.clj file in my boot.clj, which had nested require statements and these were called before aot was run

mobileink22:01:22

been there done that. heh.