This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-15
Channels
- # alda (4)
- # beginners (9)
- # boot (2)
- # cider (56)
- # cljsrn (6)
- # clojure (29)
- # clojure-belgium (2)
- # clojure-gamedev (1)
- # clojure-russia (19)
- # clojure-uk (3)
- # clojurescript (7)
- # core-async (2)
- # datomic (16)
- # hoplon (96)
- # lein-figwheel (4)
- # om (2)
- # om-next (3)
- # other-languages (6)
- # planck (11)
- # reagent (9)
- # rethinkdb (1)
- # ring-swagger (1)
- # spacemacs (1)
What is your server?
@Ispector ^^^
The hoplon-castra template is a good start and with it you can deploy to heroku easily or any where that accepts a war file
You create template like so: lein new hoplon-castra my-project-name
and when you cd in your project you do boot make-war
which should output a war file located in target dir.
For client only, i guess you could compile to javascript and use it on any server.
https://github.com/tailrecursion/hoplon-template/blob/master/src/leiningen/new/hoplon/build.boot
I guess you do boot prod
Then look for js files in target...
Not sure i have never done client only builds
Can't test right now to tell you where exactly are the output files in target but maybe somebody else could answer...
This is for client only apps. I don't see anything about "prod" in boot help
... but boot prod
does indeed seem to do something in the address-book project from Getting Started... but whatever it does doesn't seem to leave anything new in the project directory.
PS I don't know anything about heroku or war files. I have a directory on a machine where I can put html files... and occasionally I've put slightly more complicated things there, but not much and not within the last several generations of web programming technology. That's where I want to put a hoplon project. If I can put the Getting Started address-book project there then I'm confident I can build it out to do what I want... but I don't see how to take that Getting Started project the final step to the web.
prod
is not a default boot task rather a "local" task set in your `build.boot file
yes, I'm testing right now
we need to hack around the prod task
Great -- thanks. BTW why isn't this what everybody wants to do? What do people do instead?
I go with heroku because I can control server side (like routes, etc.) too
The following prod
task (creates target dir and) outputs html files to /target
(deftask prod
"Build address-book for production deployment."
[]
(comp
(hoplon)
(cljs :optimizations :advanced)
(target :dir #{"target"})))
hope that works for you
@alandipert: I also got a Skipping prerender: phantomjs not found on path.
message when running boot prod for address-book
tutorial
I suggest we add a section in the wiki covering deployment with static files
And that we fix boot prod
task (or have an additional task for this use case)
in the hoplon template
Would you have a better approach then
(comp
(hoplon)
(cljs :optimizations :advanced)
(target :dir #{"target"}))
?Thanks. Going to sleep
@Ispector ^^^
@leontalbot: Yes! That works beautifully for me. If I copy the resulting target
directory to my server then I can indeed browse it there and the code runs. I should be in business. Thanks!
Those suggestions re: documenting deployment and changing the template sound good to me (from my position of very limited knowledge).
I'm still curious, though, what others do, such that this step wasn't the natural conclusion to the Getting Started address-book tutorial. Do people deploy in some completely different way?
@lspector: this is my current heroku builder task
(deftask build-heroku
"Builds a standalone jar."
[]
(comp (aot :namespace #{'app.main})
(hoplon)
(cljs :optimizations :advanced)
(prerender)
(uber)
(jar :main 'app.main)
(sift :include #{#"\.jar$"})
(target :dir #{"target_prod"})))
to deploy i just
boot prod;
heroku deploy:jar --jar target_prod/project.jar --app my-app;
but that’s actually more complicated than you might need it
because i’m handling the web server in my app
you can use heroku’s deploy:war
too, and just
(deftask build-heroku-war
"Build a war for deployment"
[]
(comp
(hoplon)
(cljs :optimizations :advanced)
(prerender)
(uber :as-jars true)
(web :serve 'app.handler/app)
(war)
(target :dir #{"target_prod"})))
@thedavidmeister: Thanks. So when most people use hoplon they do something like this maybe?
dunno about “most people"
but this works fine on heroku
i didn’t need to use anything more than the second example until i wanted to do something custom with websockets and had to stop using jetty
@lspector: please put any feedback you have about documentation up as/on issues for hoplon
hoplon is very cool, but the learning curve could be mitigated a bit with good feedback on the docs 🙂
Thanks. FWIW to me all of this deployment stuff, even the "simpler" versions, is non-obvious. I do think it'd be great to have some version of this stuff at the end of the Getting Started page and/or in templates.
i started learning hoplon, java, clojure/script and heroku all at the same time, i feel your pain 😉
@lspector: it will get easier if we make an effort to move the summaries of chat back into the wiki/readme/tutorials
@thedavidmeister thanks for sharing your jar task. Would you mind sharing what is in your procfile? I will update hoplon-castra template readme accordingly. Thanks!
@leontalbot: i don’t think i have a procfile, i think the heroku cli tool just does it for me
ok, excellent!
@leontalbot: just test it on a free dyno
@alandipert: To deploy hoplon-template do I use my personal login pass?
@leontalbot: correct
@thedavidmeister: testing...
i like the idea of concluding the tutorial with deployment instructions a lot
excellent, here: https://github.com/hoplon/hoplon/wiki/Get-Started#build-for-production
@Ispector ^^^
The only thing is I can't deploy to clojar right now, I have a passphrase issue
feel free to do it this time (again)...
I changed a bit the prod task
(as mentioned above)
awesome
i can do the push for now
awesome, hoplon-template 3.2.2 is deployed. thanks!
Excellent! Thanks!
@lspector: thank you for your feed back
the tutorial has now been updated
@lspector How did you find hoplon?
@thedavidmeister: weird, I'm at adding uberjar entries and it takes forever...
Skipping prerender: phantomjs not found on path.
Adding uberjar entries...
I'll remove prerender and try again...
@thedavidmeister: so there is no main fn by defaut in hoplon-castra template
could we change (aot :namespace #{'app.main})
to make it work?
if so, how? Thanks!
you do need a main fn for it to work @leontalbot
otherwise, use the war approach
is there a need to use a jar? because the war worked fine for me and is easier to setup
Actually it was more to add use cases to the doc. Why does one need a jar?
i need one because i’m using sente instead of castra
so, kind of irrelevant in a castra tutorial 😛
basically, sente needs http-kit
but the default is jetty
that’s all
Http-kit seems to have more and more traction
Why do you need Sente over Castra?
um, castra didn’t easily support my custom defrecords
also, i’m sending dozens of small data points down the wire and it’s important the send order is preserved
websockets makes sure the order of things being sent is preserved
as soon as sente returns me info, i just stick it in a cell
@leontalbot: the deployment instructions look great to me, assuming the new template works (I haven't tried it from scratch yet).
@leontalbot: I found hoplon via the clojure google group, in William La Forge's reply to my query here: https://groups.google.com/forum/#!topic/clojure/xAnl5UR4V1E. The other replies looked promising but once I dug in it turned out I needed more of a general javascript/web programming tutorial than I have time for right now. Hoplon gets me much further with just my Clojure knowledge, and with the deployment instructions worked out may get me as far as I need to get for my current project, unless I end up needing something fancier than I anticipate.
Great to hear!