Fork me on GitHub
#clojure
<
2015-07-21
>
danielcompton00:07:09

@voxdolo: the pedantic answer is “it depends”, the useful answer is “anything you do to improve boot time locally should translate to faster Heroku boot times too"

danielcompton00:07:23

@voxdolo: but if you need zero downtime then I’d look at preboot as well

voxdolo01:07:02

Fair enough :) thanks for all the input @danielcompton!

arohner01:07:55

@voxdolo: I’ve never tried to get a serious app into production, but even for simple apps, I needed to AOT to make it boot in < 60s

arohner01:07:12

serious app into production in heroku

voxdolo02:07:08

@arohner: this is my first stab at a serious production clojure app on heroku... It's not intended to be long term, but it's pretty darned convenient for now, provided we can get past the deploy timeouts. That said, we may be trying to pull off a quick switch to EBS or some such if we can't.

voxdolo02:07:28

Thanks for chiming in :)

arohner02:07:13

@voxdolo: I found elasticbeanstalk w/ docker containers fairly convenient

arohner02:07:19

not quite as nice as heroku, but it works

arohner02:07:26

and much better hardware

voxdolo02:07:04

@arohner: I need to get familiar with docker. Spent just a little time today looking at the official Clojure Dockerfile, trying to figure out what was going into it. If nothing else, I'd like to have a Dockerfile teed up and ready to go in case the the poo hits the proverbial fan.

voxdolo02:07:28

We've been in build-build-build mode and are now in ship-ship-ship mode... Probably a good time to be looking at it.

teslanick03:07:56

I just wrote a little thing about using Figwheel with Docker earlier this evening: http://blog.nickol.us/2015/07/20/using-figwheel-with-docker/

teslanick03:07:12

We use Docker (but not Clojure) where I work.

chancerussell03:07:02

@teslanick: Something that’s been helping me when using Figwheel with Docker is to define a local location for my Maven repo, then starting the docker image with that directory mounted

chancerussell03:07:31

That way I can pull the lein deps stuff out of the Dockerfile

teslanick03:07:34

That would be really handy, any time I have to rebuild my docker image it's kinda painful

teslanick03:07:54

Especially because I'm using a mac, so docker arrives through docker-machine. [i.e. the network is horribly slow because vms]

chancerussell03:07:05

I have a Makefile target for running the image “clean” (copies all the files at runtime), one with the src directory mounted on top for live coding, and one that’s the same plus the local maven dir is mounted

chancerussell03:07:36

So it’s easy to drop back to having it built from scratch, but just as easy to “cache” some things so you can tweak things a little faster

teslanick03:07:40

I would be interested in seeing the details of that setup -- I'm still very much a docker neophyte.

teslanick03:07:19

One annoying thing (which I've patched around locally) is that the shared file system (whether this is docker-machine or just docker) has funny behavior around file changes, which throws figwheel into a tizzy when CSS files change.

chancerussell03:07:01

It’s not anything fancy, just extra -v options depending on which task I run

chancerussell03:07:15

I guarantee you have more Docker knowledge than I do!

podviaznikov05:07:25

@voxdolo: I recently discovered https://www.tutum.co/. It uses Docker. I was able to deploy few Clojure apps quite easily. Also it’s possible to have auto-deploy workflow when Docker build automatically after push to GitHub

voxdolo05:07:55

@podviaznikov: cool, I'll check it out. Cheers!

borkdude11:07:47

is it possible to dynamically create a docstring when defining a function? (defn foo (str ...) [x] ...)? simple_smile

mpenet11:07:01

(defn ^{:doc (str "foo")} foo [y])

mpenet11:07:07

should work I think

borkdude11:07:45

brilliant, thanks @mpenet

denik17:07:28

@tbaldridge: are there public gists or tutorials around using pixie-lang for shell scripting?

denik17:07:44

@tbaldridge: for example: how does a curl / http request look in pixie?

greywolve19:07:50

pixie-lang looks interesting

coyotespike20:07:04

@teslanick: I've been considering Docker to mitigate niggling differences when I deploy from Mac to DigitalOcean/Ubuntu. I like the idea of getting an environment set up that can ship easily. Your guide to Figwheel with Docker looks really helpful - but you don't sound that enthusiastic! Do you think it's worth the trouble?

tmulvaney20:07:46

@denik There are currently some very basic functions for dealing with filesystems like listing files and dirs in pixie.fs There are some good examples of making calls to curl in https://github.com/pixie-lang/dust/blob/master/src/dust/deps.pxi

teslanick20:07:54

@coyotespike: I'm not terribly enthusiastic about it. I find docker containers to be really opaque about their state and happiness level. It's also a big pain to set up in OS X right now. I think that will get better with time.

teslanick20:07:38

I also find devops/system management a really boring topic, but that's my own biases showing through.

coyotespike20:07:05

Thanks for that feedback - my time might be better spent elsewhere then. Sad, it's meant to be so cool 😉

teslanick20:07:35

It will get better fast -- I started using Docker seriously in January, and it's gone from being a big daily pain to an intermittent annoyance.

roberto20:07:37

I use docker but mostly to setup things like the database and message queues, etc...

mccraigmccraig20:07:15

i've been using docker for a while to deploy to mesos/marathon : it's great for that situation... lein-uberimage makes it easy to create images from lein projects too

coyotespike20:07:35

Have you found yourself configuring fewer things on the host/target?

coyotespike20:07:26

Without any Docker experience, I'm assuming its benefit is getting the process environment set, and then being able to ship without doing it all over again.

teslanick20:07:46

Yeah, that's the big win with Docker. I don't experience [the benefit of] it directly, but the development stack I use at work looks a lot like the production stack. We can actually "deploy" production to a local machine (or a personal remote docker cluster), which is pretty cool.

mccraigmccraig20:07:37

coyotespike: mesos/marathon takes a fair bit of setup, but once it's configured (you really need a config mgmt tool like pallet or ansible) you can deploy docker images with a POST then scale straightforwardly across your cluster, and mesos/marathon looks after failover, restart, inter-layer routing, simple monitoring, and rolling upgrades

wei20:07:54

is there a shortcut to add a namespace to a keyword? :a => :my-ns/a

mccraigmccraig20:07:40

i have the docker images set up to read environment, like a 12-factor app, so testing is easy on my dev machine

coyotespike20:07:22

@teslanick @mccraigmccraig Man, that is pretty cool. Consistency from dev to production would be awesome.

wei20:07:04

@roberto thanks.. or rather, an arbitrary ns

mccraigmccraig20:07:57

@coyotespike: environment vars are your friend : environ is a good clj lib for reading from them and other sources

wei20:07:35

(defn add-ns [kw ns]
  (keyword (str (name ns) "/" (name kw))))

Lambda/Sierra21:07:20

@wei: You don't need to add the /, there's a 2-argument form of keyword.

wei21:07:12

@stuartsierra: ahh. glad I asked, thanks

jballanc21:07:11

Has anyone had recent issues with lein not resolving transitive dependencies?

jballanc21:07:24

the only bug reports I’ve found are a couple years old

coyotespike21:07:18

@mccraigmccraig: Good point! otoh, I'm just now provisioning the DigitalOcean Ubuntu, so I kinda have to set the environment as well...

akiel21:07:13

is there a performant alternative to some over a map? (some identity {:a 1}) is 5x slower than (some identity '([:a 1]))

bronsa21:07:14

@akiel: it will be a bit a bit noisier but reduce-kv should be more performant

bronsa21:07:54

@akiel e.g. (some f map) becomes (reduce-kv (fn [_ k v] (when-let [ret (f k v)] (reduced ret))) map)

akiel21:07:59

@bronsa: yes but than I have to terminate it after the first truthy value - which is possible with (reduced x) but it’s not so nice

roberto21:07:03

contains? ?

akiel21:07:27

contains? works only over sets?

roberto21:07:49

for maps too

roberto21:07:58

sets and maps

bronsa21:07:01

@akiel do you actually need some f or just some identity?

akiel21:07:30

no I need some f

bronsa21:07:43

then contains? won't do it

bronsa21:07:54

but @roberto is right, it works for maps too

akiel21:07:22

ok contains? works on the key of a map - right. But I need it on the [k v] pair of a map

akiel21:07:10

some over a map works over the [k v] pairs - I need the same

bronsa21:07:34

@akiel there are no higher-order functions for maps equivalent to the ones for seqs in core

bronsa21:07:12

if you actually need the extra performance of avoiding the seq conversion, you'll need to use something like reduce-kv

akiel21:07:55

@bronsa: you are right - I just wonder - after all the transducers stuff - that some was left behind

bronsa21:07:16

yeah a some transducer would help

akiel21:07:46

or better a some transducer endpoint

akiel21:07:08

something like into

akiel21:07:30

or even a transducer first

akiel21:07:38

the reduce-kv version is still 2x - 2.5x slower than some over a seq

rauh21:07:52

@akiel: Maps do NOT have an order unless you have a sorted-map so you shouldn't use some with a map.

rauh21:07:15

You'll have undefined (or inconsistent) behavior

rauh21:07:45

also: some would be like a drop-while tranducer and then a first

akiel21:07:59

@rauh: good point - my use case are bidi routes were the key is a matcher and the value is a match - and you are right - what if two matchers would match

akiel21:07:33

I profiled bidi route matching and this some was quite on top - so I liked to optimize it

rauh21:07:33

State your original problem.

rauh21:07:46

Oh I see.

akiel21:07:10

but there is maybe a deeper problem to the way bidi routes are defined - as always

akiel21:07:11

ok: >The patterns for the remaining path can be specified in a map (or vector of pairs, if order is important).

akiel21:07:15

they should say: or a seq of pairs if performance is important simple_smile