Fork me on GitHub
#clojure
<
2018-07-14
>
valerauko06:07:35

if i have a clojure app running behind an nginx reverse proxy, how can i achieve zero downtime deployments?

dominicm06:07:43

Have you done zero downtime deployments with nginx before?

dominicm07:07:46

I imagine the general process is to start clojure on a new, random port, and once you're happy it's started, to update the nginx config and do a reload.

dominicm07:07:53

but there's probably a more specific guide

dominicm07:07:17

I doubt zero-downtime for clojure w/ nginx looks any different than zero downtime for [lang] with nginx.

valerauko07:07:31

thanks! i'll dive into that!

jgh09:07:04

you could also use e.g. a python script to do port forwarding

joefromct13:07:27

When writing a spec for my rest client How can I have a predicate over a map where the type of one key's value is dependent on another key's value? When ā€œcolorsā€ then string; when ā€œnumbersā€ then Int ....

[
{:favorite ā€œcolorsā€
:data        ā€œBlueā€},
{:favorite ā€œnumbersā€
:data        12}
]

mg13:07:42

@joefromct you could use a multispec

joefromct13:07:22

Ok Iā€™ll reread that section of the guide. Thanks.

mg13:07:48

It's not an ideal situation though since you're reusing the same key to have two quite different meanings. The design of spec is intended to discourage this

mitranim13:07:16

Any Sublime Text users here? A major rework of the Clojure syntax is on its way, we're looking for feedback. Alternatively, just install and enjoy. Pending PR: https://github.com/sublimehq/Packages/pull/1259, available standalone: https://github.com/Mitranim/sublime-clojure

jonahbenton14:07:49

Cool, I'll bite, can I install thru the package manager?

mitranim15:07:08

Nice! Since it's intended to be merged into the built-in packages, it's not on Package Control, so you'll have to clone the repo

jonahbenton15:07:51

thanks, just did that- how exactly do i tell sublime to use this package for clj files?

mitranim15:07:16

Bottom right ā†’ language picker ā†’ open all with current extension as Clj

jonahbenton15:07:18

ah, clj rather than clojure, thanks!

jonahbenton15:07:49

i run sublime on a mix of fedora 27 and fedora 28 vms; fed 28 looks good, bunch of complaints from fed 27, so i'm upgrading those vms

joefromct13:07:46

Yeah unfortunately my client doesnā€™t have any control over the servers data structure. :/

kgofhedgehogs14:07:19

https://pastebin.com/5p2XZ7na What's wrong? I try to receive results of request through httpkit. For other url everything is fine. I send request to https://github.com/shakee93/fonoapi With clj-http all is ok, args are the same, you can see them in the beggining of the snippet

kgofhedgehogs14:07:08

P.S.: sry for pastebin link, I can't upload a code snippet for some reason

valerauko14:07:09

the top one isn't all ok either

valerauko14:07:29

:secure false

valerauko14:07:52

it seems that clj-http doesn't raise if something is wrong with your https

valerauko14:07:55

while http-kit does

valerauko14:07:59

never mind that was the cookie

kgofhedgehogs14:07:53

I can remove :insecure? true from both, I added this line because it was suggested as possible fix here https://github.com/http-kit/http-kit/issues/187

kgofhedgehogs14:07:07

Removing of this line doesnt changes anything btw

denis_krivosheev17:07:32

Hello everybody. Iā€™m very excited about spec library and Iā€™d like to enable instruments for everything that has spec. Is there a good way to do so? Just donā€™t want to write (instrument ā€˜my-fun) for every single function in my app

justinlee17:07:48

@denis_krivosheev according to the api docs if you just call (instrument) it will instrument all instrumentable vars https://clojure.github.io/spec.alpha/clojure.spec.test.alpha-api.html#clojure.spec.test.alpha/instrument

justinlee17:07:52

havenā€™t tried it myself tho

denis_krivosheev17:07:55

Oh, didnā€™t know . Great thanks

dottedmag20:07:18

I have the following task and have no idea how to approach it (the brute-force solution is obvious, but very wordy): I have a list of similarly-shaped maps (with a bunch of special cases and little twists, but, say 80% of the keys are in every map), and I would like to apply a series of transformations on them. Most of the transformations are simple (for every map that has this key, and value of this key is matches that regexp, add the following key), some of them trickier (if we have two maps linked via some attribute, remove one, and add all the information to another). In a nutshell I have a bunch of pattern-matching operations with corresponding reductions, and would like to apply them all until none of the match anymore. Maybe there is a good library for this kind of stuff?

dottedmag20:07:21

It sounds like an optimization phase in a compiler šŸ™‚ In reality it is a normalization of a list of transactions from a bank whose exported data is not very structured.

dpsutton20:07:59

bronsa did this in the passes in the tools.analyzer. you can see how he does it. he keeps a hashmap and keeps applying passes until there was no change

dottedmag20:07:20

Right, now I wonder what's the good way to describe these normalization steps.

spiralganglion22:07:33

Is there any tooling around checking for updated versions of maven deps in deps.edn?

spiralganglion22:07:07

Something like lein ancient, but for the "post-lein" world.