Fork me on GitHub
#clojure
<
2019-01-18
>
datran00:01:10

any recommendations for sending email from clojure? I was looking at postal but wanted to check if there was anything else I should consider

tianshu09:01:14

hi folks, I want some help, recently sometimes I can't ssh my server that run a clojure application(the only one). the error is shell request failed on channel 0, after some searching, I think it may because somewhere is leaking process? I'm not sure how to investigate further. any suggestion will be very helpful. thanks!

felixmulder10:01:55

Hello - where can I get help on using the Clojure CLI? It's not picking up the location of .m2/repository properly and I'm not sure why...

felixmulder10:01:03

It's trying to access /var/empty/.m2/repository/ instead of $HOME/.m2/repository

borkdude10:01:03

@felix.mulder try inspecting your environment variables, if they set some alternative location for m2?

felixmulder10:01:08

There are 0 env vars, this is building inside a nix environment

felixmulder10:01:25

Is there an env var that clojure looks at for the location of m2?

borkdude10:01:19

is there a settings.xml in .m2 maybe?

temco10:01:37

env of system could be redirected by export M2_REPO=

temco10:01:35

and if you use lein, the key [:local-repo :repositories] in the profiles.clj also could redirect to other folders

borkdude10:01:53

If I google on var/empty nix maven I find some stuff. maybe it’s the home dir location in the nix shell that’s set to /var/empty

felixmulder10:01:08

HOME=$PWD
export M2_REPO=$HOME/.m2
clojure -A:test
Still has the clojure cli go toward /var/empty/.m2 and HOME is set to a proper non /var/empty/ location 😕

borkdude10:01:13

is M2_REPO a thing? You could try this: https://maven.apache.org/guides/mini/guide-configuring-maven.html Configuring your Local Repository The location of your local repository can be changed in your user configuration. The default value is

${user.home}/.m2/repository/.

<settings>
  ...
  <localRepository>/path/to/local/repo/</localRepository>
  ...
</settings>

felixmulder10:01:44

yeup, it doesn't pick it up - placed the settings file in both $HOME/.m2 and $HOME/.m2/repository just to be safe

felixmulder10:01:56

if I introduce syntax errors in the XML, it complains

felixmulder10:01:03

but doesn't obey the local repo setting

felixmulder10:01:05

Already when doing mvn -X help:effective-settings it's not able to populate due to trying to go against /var/empty

felixmulder10:01:18

so that's at least one positive, it's not a clojure specific thing 🙂

felixmulder10:01:23

ty for the halp!

Alex Miller (Clojure team)13:01:25

clj uses the Java system property user.home to build the maven repo location

Alex Miller (Clojure team)13:01:00

I’m not sure how that would be off but that’s likely why

Alex Miller (Clojure team)13:01:01

You can hardcode in your deps.edn though with :mvn/local-repo attribute at the root

Alex Miller (Clojure team)13:01:19

If that lets you move forward

felixmulder14:01:55

We ended up being able to globally set the user.home property and now everything is gucci

felixmulder14:01:01

thanks for the help folks 👋

hmaurer16:01:33

Hi! Quick request for advice: what would you say is the most “modern”/“well maintained” way of working with a Postgres database in Clojure? HugSQL? Something else? (I lean towards a raw SQL approach over ORM)

tatut16:01:13

I don’t know about “well maintained”, but I forked yesql some years ago and am actively using it in production https://github.com/tatut/jeesql

manutter5116:01:21

I personally like hugsql, but I think different people have different preferences. Seems like a variety of solid choices available.

tatut16:01:22

Also https://github.com/tatut/specql, but that’s not “raw SQL”

hmaurer16:01:31

@U11SJ6Q0K thanks! I’ll check it out

borkdude16:01:44

@U5ZAJ15P0 I’m loving HugSQL. yesql is dead to me 😉

seancorfield16:01:05

If you want your SQL external to your code, use HugSQL. If you want a DSL to builds SQL, use HoneySQL. With both of those, use org.clojure/java.jdbc.

hmaurer16:01:01

Thanks! Do you use HugSQL or HoneySQL yourself? I’m not quite sure which approach to go for

seancorfield16:01:39

We use HoneySQL extensively (and I took over as maintainer recently).

seancorfield16:01:16

My former colleague, Fumiko Hanreich, gave a talk at Clojure/West about our use of HoneySQL (in 2012? 2013? I'll get you the link).

seancorfield16:01:50

I like my SQL in my code where I can see it alongside the code that uses it which is why I don't use HugSQL.

seancorfield16:01:59

Some people love that separation tho'...

hmaurer16:01:10

@U04V70XH6 thanks! I might use HoneySQL then. My use case is fairly basic, but I don’t want it to get in the way of using some postgres-specific features

hmaurer16:01:20

(and I don’t want it to be too smart; just build the queries I expect it to build)

seancorfield16:01:58

https://www.youtube.com/watch?v=alkcjyhesjI -- 30 minute talk from 2015 (I was off by several years)

seancorfield16:01:51

There's a Postgres-specific extension project for HoneySQL you might want then.

seancorfield16:01:41

(if you just want raw SQL strings in your code, you don't need anything beyond the latter)

Daniel Hines20:01:38

Is there a tool to generate a visual graph of my clojure dependencies, a la https://github.com/pahen/madge

Daniel Hines20:01:51

Actually, I know there is, it just escapes me atm.

Daniel Hines21:01:19

I’m sorry, I said dependencies, implying libraries, but I meant namespaces.

borkdude21:01:48

I’m good at googling 😛

borkdude21:01:13

I think I’ve used it in the distant past

Daniel Hines21:01:14

Awesome! Thanks. Because there’s a Lein plug in for everything!

noisesmith21:01:56

also, making a graph of references between namespaces and using it to generate a graphiz input is a fun weekend hack

Lennart Buit21:01:03

GraphViz is a very easy format to generate in general

dangercoder21:01:29

Anyone knows where I can read or have any tips regarding polling and clustering. Lets say I make an api call and create something. I get an ID back and there is another endpoint which I must call every 6 minutes to poll for a status. If I have node A and B and B goes down while executing the polling I want node A to take over. Afaik one can use a MQ for this.

noisesmith21:01:25

yeah - clojure on its own isn't opinionated about IPC, you can use the same libs you would with Java, or in most cases the same lib you would use with NodeJS or Ruby

hiredman21:01:11

I would like at something like aws step functions

👍 10
hiredman21:01:32

in general what you'll want to do is have some kind of shared(between A and B) transactional store, represent the polling as a simple fsm, and keep the state in the store

john22:01:24

And a watchdog service running health checks on the nodes you want watched

hiredman22:01:37

the simplest case would be to, instead of having fail over between A and B, having A and B running concurrently(which is why the transactional store), which would avoid the need for some kind of watchdog and failover check

dangercoder22:01:03

I will have a look at the ☝️ thanks. I will have one node A. When I get more traffic I will pop up another node, and another... and when the traffic goes down I will kill them.

hiredman22:01:09

if you are on aws, I would look at directly using step functions https://docs.aws.amazon.com/step-functions/latest/dg/sample-project-job-poller.html

5