This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-22
Channels
- # beginners (10)
- # boot (134)
- # cider (29)
- # clara (2)
- # cljs-dev (10)
- # cljsjs (2)
- # cljsrn (13)
- # clojure (76)
- # clojure-india (4)
- # clojure-ireland (1)
- # clojure-russia (20)
- # clojure-spec (11)
- # clojure-uk (7)
- # clojurescript (88)
- # core-async (5)
- # core-logic (3)
- # cursive (17)
- # datascript (5)
- # datomic (123)
- # hoplon (8)
- # klipse (6)
- # lambdaisland (2)
- # leiningen (4)
- # luminus (2)
- # off-topic (23)
- # om (23)
- # om-next (1)
- # onyx (20)
- # pedestal (2)
- # perun (2)
- # re-frame (11)
- # ring-swagger (3)
- # untangled (12)
C-c C-c is not working inside of emacs -> boot I'm at a "boot.user>" prompt -- how do I end the session?
are there any tutorials that go through releasing a library to clojars using boot?
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.”
But in my project I have the following structure lib_name boot.build src core.clj
I am using bootlaces and trying to deploy with boot build-jar push-snapshot
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.
@qqq if you’re using cider, I imagine there must be something like M-x cider-disconnect available.
@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.
@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.
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
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?
@mobileink ah thanks. I've now just removed it, since I don't want a microservices app, just the simplest thing that works.
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.
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...
;; 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)))
@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?
@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=
@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
@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
I was just working on that. module version strings will be independent of project version strings.
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.
@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
@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!
@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
(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.)
yeah that's what I surmised and why I tried to change the :module
setting. But I'm not doing -s
anywhere
Found it! Bug in gae/deploy. Must not have tested that for servlet apps, dangit. Sorry about that, will fix and push shortly.
@mobileink no worries. Thank you so much!
Workaround: pass the -b (:build-dir) parameter to deploy: (gae/deploy :build-dir "target")
might take me a few hours. if you want to hack a temp version see https://github.com/migae/boot-gae/issues/5
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.
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?
yep, so that everyone can just start/stop boot run
and doesn't have to keep boot gae/monitor
running
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.
there might be a way to fake it using boot pods, if you feel like becoming a boot wizard.
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
after all the monitor task just copies over .clj
files into the target directory, right? (not sure if I missed something)
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
(and as I said, total clojure newb, so literally 0 idea what is actually going on with boot and filesets and so on)
yep, only reason for monitor (instead of plain watch) is to deal with different output dirs between servlet apps and service apps
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?)
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
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.
the deploy task invokes a method on a java object that spawns a process. is boot running these two tasks in parallel or sth?
@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)
the servlet and filter stubs are always aot compiled; nothing else is. where are you getting this error, dev or cloud?
@mobileink cloud, it doesn't start fast enough apparently
@mobileink awesome. I'll update right away and will ping you.
yeah but right now it seemed to not be able to start at all, so I had to redeploy and then it worked
is there a way I could aot-compile all libraries? Or is that something that would break clojure's dynamism?
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.
fwiw i haven’t had a problem with minimal aot. course i’ve only tried relatively small apps.
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
(yes I saw that it doesn't yet create the config in the mustache templates, I just manually edited the xml while testing)
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.
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
but isn’t boot sweet? you can adjust to stuff like this by building your own tasks.
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
@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?
@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 🙂
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
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
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?
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.
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
btw you can set flags per task in build.boot. see task-options in https://github.com/migae/boot-gae/blob/master/build.boot
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})
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.
well, i guess anything is possible, since we have clojure, but it't not designed-in, i think
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
target directory is write only, and exists only if you use target
task
i have a few gen-class namespace, and i am facing errors while importing them (ClassNotFoundException), but i see those classes in target directory
they should also be in some tmp directories
hmm, yeah if I recall correctly those gen-classes can be a pain
but the problem is not with target directory
are you using aot
task to compile those namespaces? That should write the classes to temp directories?
I'm not sure if loading them only from repl works
(though nrepl task should take care of this https://github.com/boot-clj/boot/commit/32585458a536a7b791a8247c9c340d3eb9ba11c2)
hmm, looks ok to me. let's start with the obvious: are you sure you got the syntax and spelling right for import?