that's interesting, what's wrong with pulling in spec @borkdude?
Hi all! I have two stupid questions π
I am playing around with luminus and defined the password column in the users table as TEXT
how do I read the value as string
(I am using H2 database)
because the library retrieves something like this: :pass #object[org.h2.jdbc.JdbcClob 0x3aa10bc8 "clob2: 'bcrypt+sha512$914ff82438d740391603a9771bf05108$12$d06f3f7a38812e86accd15a690d3b4c5b05a34c0b8549431'"
Something very similar is here: https://en.wikibooks.org/wiki/Clojure_Programming/Examples/JDBC_Examples#SELECT
Not really that familiar with Luminus, but which library? clojure.java.jdbc?
maybe calling this method? https://github.com/h2database/h2database/blob/master/h2/src/main/org/h2/jdbc/JdbcClob.java#L92-L95
Thanks! It works. π
The second stupid question would have been: how do drop and re-create the table with VARCHAR type by migrations? I didn't used it ever.
The following worked for me in Postgres - note that h2 seems to use slightly different syntax*
;; REPL
(in-ns 'user)
(create-migration "change-author-type")
;; <timestamp>-change-author-type.up.sql
ALTER TABLE posts
ALTER COLUMN author TYPE VARCHAR (300)
;; <timestamp>-change-author-type.down.sql
ALTER TABLE posts
ALTER COLUMN author TYPE TEXT
;; REPL
(migrate) ; changes to VARCHAR
(rollback) ; rollsback to TEXT
*h2 syntax (untested):`ALTER TABLE tableName ALTER COLUMN columnName SET DATA TYPE dataType`
Btw, I can recommend https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/ for a detailed dive into. Luminus.Thank you very much!
Can someone please recommend or comment on choice between aleph
and http-kit
. I have been trying to avoid asking that question. I have looked at both and both seem nice to use. But I want to know from the perspective of (1) bugs encountered; a few days ago someone mentioned about experiencing deadlocks with aleph
. (2) which one is expected to be around for longer. (3) limitations such as being able to use other libraries with it, available middleware etc. (4) performance in production. Thank you.
@curiouslearn Any reason to prefer either of those over Jetty?
We've run both Jetty and http-kit in production. We started with Jetty but saw occasional, unexplained "thread death" exceptions, so we switched to http-kit and it was fine, but support by monitoring software (New Relic) wasn't great so we switched back to Jetty (a more recent version), and it's been rock-solid in production for years.
aleph
and http-kit
are both special custom things and neither are as widely-used or as well maintained and well supported as Jetty. Last I saw, aleph
was not being maintained and Zach was looking for someone to take it over. http-kit
is in a similar situation, but slightly better maintained.
Jetty is very stable
I d say it's the safe choice right now
I want something that is easy to use with websockets. Also, while I don't understand this well, I think something that is async would be better in terms of the server's capability in terms of number of concurrent connections it can handle on a very basic server, say a $20 per month Digital Ocean instance.
You'd probably be surprised at just how performant Jetty is.
WS is somewhat a hack with most jetty adapters for clojure
Yeah I had jetty take crazy loads
Thank you. Any pointers on which libraries to use for websocket connections with Jetty? Thank you.
We're using netty directly for a WS-based app but that means a fair bit of Java interop (and heavy use of core.async). I wouldn't recommend that approach until you've got some serious production Clojure experience under your belt.
Sorry to jump in, but why not?
@peder.refsnes core.async is pretty hard to use and complex on its own -- I see non-beginner Clojurians running into all sorts of issues when they're learning core.async π -- and netty with interop is also non-trivial on its own. So then you're combining two non-trivial things with asynchronous behavior. It's a lot of stuff to learn and get working, if you're also still struggling with a bunch of Clojure basics.
aha, I see thanks. can confirm the βall sorts of issues with core.asyncβ part π
For ws not sure, we used erlang for that
Netty is quite complex, it's easy to make mistakes if you don't know it well
Yes, I would like to avoid that (using netty directly or erlang). But I need websockets for sure.
What is the option then?
Vertx is a decent solution probably
That is mainly the reason I was drawn to aleph and http-kit.
It's essentially a thin wrapper over netty
@mpenet would you recommend VertX over http-kit and aleph. Thank you.
Both the client and server from http-kit are also available in babashka.
Just for ws yes
Otherwise give a try to jetty
@curiouslearn What is your web socket client? JS and http://Socket.IO, or some custom ClojureScript thing?
Standard JS. I am using Svelte on client side.
Btw, we're using yada + aleph at work and it's been very stable for us
We're using websockets as well
Thank you @borkdude. Did you experience any deadlocks with aleph?
Or other bugs
I can't say that I have. There is a common issue that when you don't consume an inputstream on error, this can cause resource problems, but I believe this is documented somewhere
I see that it is still in alpha
. Do you know anything about whether it will continue to be developed?
I don't know
Okay thanks!
I believe it was funded with Clojurists Together money at some point not long ago
Thank you @seancorfield
It's a shame that some popular projects like http-kit or aleph lean on one or two maintainers and when they change jobs the project is pretty much stalled? But I guess that's how open source software in a smaller ecosystem works...
Thanks!
@hiredman Did we look at Aleph before starting down our own path with Netty/interop? Or did we just go straight to netty-socketio because that was a requirement imposed by our client's needs? I think the latter, but I can't remember how much exposure you've had to Aleph?
Ztellman does seems to intend to ship a 1.0 of aleph as of last week, so the alpha label is probably oversold https://github.com/aleph-io/manifold/issues/187#issuecomment-716048610
Straight to http://netty-socket.io, I haven't used aleph
Given how many Contrib libs used to be 0.x.y or have alpha labels, that aspect would not worry me much in the Clojure ecosystem. Contrib was all moved to 1.0.0 releases purely to address perception, not because of any functionality or stability issues.
Different approach: why not use something like http://pusher.com and let someone else handle the hard parts?
Thanks @hiredman
I did recently come across a contrib lib that wasn't 1.0.0
Well, t.d.a. is 0.x.y but it's definitely alpha.
Thanks everyone. Really appreciate all replies. Pusher is expensive for something that has revenue less than $500 per year :)
And clojure.java.jdbc is stable (no longer maintained) so that's 0.7.x (next.jdbc is the 1.0.0 that c.j.j never got)
It was probably data.xml: https://github.com/clojure/data.xml
We've been riding the free tier for a long time. It's quite generous (unless it changed recently)
and there are alternatives, which compete with pusher on pricing, with the same feature set
Yeah, that maintainer hasn't cleared a 1.0.0 release yet. I think Alex was talking to him about it.
Herwig hasn't updated data.xml
in a year and a half at this point tho'... π
I think they have 100 concurrent connections limit for the free tier.
Depending on your architecture and the application, that's technically 100 concurrent users
https://www.pubnub.com/pricing/ gives you 2x that for free and has friendlier pricing. I have never used them though