This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-05
Channels
- # admin-announcements (183)
- # aws (30)
- # beginners (22)
- # boot (301)
- # cider (19)
- # cljs-dev (3)
- # cljsrn (23)
- # clojars (15)
- # clojure (136)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-russia (19)
- # clojured (10)
- # clojurescript (134)
- # component (48)
- # cursive (7)
- # datavis (4)
- # datomic (50)
- # devcards (6)
- # events (9)
- # jobs (1)
- # ldnclj (10)
- # lein-figwheel (19)
- # leiningen (1)
- # luminus (16)
- # off-topic (5)
- # om (151)
- # proton (60)
- # re-frame (10)
- # reagent (25)
- # remote-jobs (1)
- # slack-help (3)
- # spacemacs (1)
- # vim (1)
@fappy: syntax error, sent you a PR with the fix
http://jakemccrary.com/blog/2012/03/28/working-on-multiple-clojure-projects-at-once/
@danielsz probably a better doc link for it, but this should help: https://github.com/boot-clj/boot/issues/154
Awesome. Thanks @crisptrutski
My team all came back from their holiday vacations today, and had their first exposure to Boot and our new build system. It went pretty well overall
@seancorfield: great!
Here's a textbook Boot task that should exist (if it doesn't exist already): compress all png's in the fileset with zopfli. https://github.com/google/zopfli
@micha: is this still accurate for 2.6.0-SNAPSHOT; https://github.com/boot-clj/boot/issues/154
hi, I’m looking for an example of a full-stack app which would comprise backend, , SASS stylesheets, live REPL and a way to deploy all these goodies to production
my current knowledge of tooling, esp. boot, doesn’t allow me to come up with my own solution yet
https://github.com/stuartsierra/component is a short intro
that starts my serve task on port 3000, starts a repl server on port 1337, and then waits forever
ok thanks @micha and @jethroksy, reading boot docs now
@micha: what does your Dockerfile look like? looks like I have the chance now to deploy to docker with boot
like getting credentials from the environment to configure external services like datadog
{
"AWSEBDockerrunVersion": "1",
"Ports": [
{
"ContainerPort": "80"
}
],
"Volumes": [],
"Logging": "/var/log/nginx"
}
FROM adzerk/boot-clj:2.2.0
# Datadog
RUN apt-get update && apt-get install -y adduser
RUN echo 'deb stable main' > /etc/apt/sources.list.d/datadog.list
RUN apt-key adv --recv-keys --keyserver C7A7DA52
RUN apt-get update && apt-get install -y datadog-agent
# Application
RUN mkdir /app /app/src app/resources /m2
WORKDIR /app
# next line is for dev
# ADD m2 /m2
ENV BUILT_AT 2015-09-01:15:44:00 # Image checkpoint
ADD src/backend /app/src/backend
ADD resources/config /app/resources/config
ADD start.sh /app/start.sh
ADD src/boot /app/src/boot
COPY build.boot /app/build.boot
COPY boot.properties /app/boot.properties
ENV BOOT_LOCAL_REPO /m2
RUN boot -C serve-proxy # download dependencies
EXPOSE 3000
ENTRYPOINT ["/app/start.sh"]
I can offer this for reference - https://gitlab.com/jaen/panda5/tree/master
With Ruby I used custom scripting that called capistrano + vagrant for controlling docker and it worked quite well, but it would have been to much overhead if you basically only need the jar. So I decided to try out docker compose instead.
Yeah, it's a bit of overhead, some of that comes from being able to actually develop inside the container.
my next app is just gonna be one that accepts a single post request so i was hoping it would be simpler
I wrote it that way because only me and a girl from the project were running on Linux in the project, the rest three guys were on Windows and I thought it would be easier for them to just run docker image instead of figuring out how to set-up boot.
for something like that you can juse base your docker image on adzerk/boot-clj and use that dockerrun file i pasted
@jethroksy: yeah, in that case I can agree it's a bit too much. You can basically just create the jar and ADD
it to the image.
There's also heroku or openshift where you can just throw jars at them and they will run it.
If you're heading to university you could probably snag the $50 Digital Ocean credit from Github as well.
@micha: yeah, last time I tried boot on Windows was circa summer, on a friend's tablet running Windows 10 and for the longest time we couldn't figure how to get boot.exe
to work.
Hah, I've barely dodged that bullet, the year before mine was the last that was conscripted in Poland.
Well, you can at least be sure the university won't make you a bad programmer, if you already know a sensible progtamming language before heading there : V
Hmm, why didn't java -jar
just work in your case? You had to run more processes than just one? Or just not using standalone webserver?
I used it in the repo I linked and as you can see running the app was basically a java -jar
plus bunch of Java opts.
@micha: mind taking a look at https://github.com/adzerk-oss/bootlaces/issues/3#issuecomment-168854386?
oh sure @crisptrutski no problem
Yeah, so you basically can just have some (start-webserver!)
function you can call from -main
and from REPL that runs immutant - something like`(defn start-webserver! [](immutant/webrun your-handler {:port 4242}))`.
wondering if task-options!
shouldn’t just get some CLI-set-ability in boot itself though
via an -o
task or env vars
for setting options on tasks called indirectly
As for universities - NUS can just as well be a good university. I'm probably a bit too soured by having only Pascal, C, C++ and Java on mine and professors mistaking structural programming for FP, because it has you know, functions '
in boot-cljs-test i end up passing a lot of options on to boot-cljs, would be nice if those knobs were “free"
But not having any FP on a university? It is a shame. Good thing you took care of that by yourself though ;' )
I've got saved from being imperatively rotten to the core by a friend who knew Haskell (in his first semester, no less).
If you want to learn Haskell http://haskellbook.com is awesome. And I don't think language hopping is all that bad either - you get to learn more perspectives on programming.
And to be more ono-topic: one thing you could look into (when you start doing more complex things) is using some sort of components - libs like component/mount/bounce.
Developing applications with reloadable workflow using https://github.com/danielsz/system is pretty cool.
Though I'm not sure I like how component pushes you in a more OO-way of writing code, but I didn't yet have chance to try mount or bounce.
Well, writing a component for immutant is about ~15 lines of code, so it doesn't buy you much.
The best thing of that is the system
boot task, which gets you this whole reloadable workflow.
Mount or bounce seem to be an answer to that concern, so I hope to be able to try them in the future.
Well, I don't really like OO because IMO most of the problems it solves are problems that arise from mutability an imperativeness and they can be resolved differently, without requiring objects.
Either you have to write all your code inside defrecord
which makes you basically write an awkward lispy Java or write free-standign functions, but have to pass the system around and destructure it all the time.
Mount and bounce seems to be better in that regard since they don't force you to use records.
If you're interested in looking at it later - https://github.com/jarohen/bounce
It grew out of his previous library, which was monadic, but handling monads in Clojure is considerably more awkward than in Haskell, so he decided to simplify it IIRC.
you can run your pipeline in a future so it's in the background and bring it back to the foreground by derefing
But how would that work exactly? Would I write a database
task that creates a database connection and an application
task that creates the application that depends on the database?
Hm, I must say I can't really wrap my head around how this could work. But this could be an interesting example of how flexible boot is.
my task is defined as follows:
(deftask run []
(comp
(with-pre-wrap fileset
(edubot.core/-main)
fileset)
(wait)))
and I have the barebones immutant stuff up:
(ns edubot.core
(:gen-class)
(:require [immutant.web :as web]))
(defn app [request]
{:status 200
:body "Hello world!"})
(defn -main []
(web/run app))
clojure.lang.ExceptionInfo: edubot.core
data: {:file
"/var/folders/z2/tkdntvps3z9fyvhxq34gdhkw0000gn/T/boot.user5287752172357405327.clj",
:line 7}
java.lang.ClassNotFoundException: edubot.core
...
boot.main/-main/fn main.clj: 169
boot.main/-main main.clj: 169
...
boot.App.runBoot App.java: 361
boot.App.main App.java: 441
...
boot.Loader.main Loader.java: 253
No problem, though won't that break when the pipeline re-runs? You don't seem to stop the server so the port will be taken.
Interesting. I thought it would contend on the port if you used watch
in pipeline or something.
BTW if you're not using component or something right now, you might be interested in run-dmc
- http://immutant.org/documentation/current/apidoc/immutant.web.html#var-run-dmc - it gets you some semblance of reloadability
@micha - you mean this - https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L166-L171?
https://github.com/tailrecursion/boot-jetty/blob/master/src/tailrecursion/boot_jetty.clj#L39-L42
it's useful because they have control over the classpath transactionally too, via the fileset
pods are destroyed and recreated with a fresh clojure runtime when you start the pipeline again
that boot-jetty task is a little unusual in that the pod is created inside the with-pre-wrap
scope
micha: what does https://github.com/boot-clj/boot-bin/blob/master/src/head.sh supposed to return?
if i replace the exec with echo, I get something like java -Dboot.app.path=/home/ben/rpm/rpm2/scripts/head.sh -jar ./head.sh
, where the ben/rpm/ blah blah is the path where i put the file
(also, wrt. bash, I have it with /usr/bin/env bash
, it's just that nixos doesn't put anything in /bin apart from sh
. Everything goes in its own sha hashed path)
@socksy: head.sh
gets appended to boot.jar during build
boot.sh is mostly a jar, with that at the front. it's a jar that can exec itself
it returns 0 on success, 1 on error - do you mean something else by return?
btw i believe @onetom is a heavy nix user who might be able to help