I am getting an error (`org.postgresql.util.PSQLException: SSL error: Remote host terminated the handshake` ) when deploying to http://fly.io using postgres. What could I be missing?
{:store {:backend :jdbc :dbtype "postgresql" :jdbcUrl "β¦."}}
deps are io.replikativ/datahike-jdbc {:mvn/version "0.3.47"} , org.postgresql/postgresql {:mvn/version "42.7.3"} , com.github.seancorfield/next.jdbc {:mvn/version "1.3.925"}
Things where working fine when using in-memory.
the build also logs Reflection warning, konserve_jdbc/core.clj:317:3 - reference to field close can't be resolved. is that the issue?
Thanks in advance
@timok @alekcz360 do you know a way of using a connection pool like HikariDataSource with datahike-jdbc ?
http://fly.io seems to only support sslmode=disabled. adding a connection-pool without ssl might solve the problem, unless I misunderstand where the ssl error comes from.
Looking at the error there it seems to use c3p0 as connection pool and in datahike-jdbc it is a dependency: https://github.com/replikativ/konserve-jdbc/blob/main/deps.edn#L8
@timok yes good catch. thanks.
konserve-jdbc uses connection/uri->db-spec internally which seems to ignore ?sslmode=disable from the :jdbcUrl. Canβt see how to propagate down this setting to disable ssl
@merklefabian lemme look into it. And cut you a new release
@alekcz360 amazing, thanks. please let me know what you find. happy to help.
Do you have a temporary db I could test against?
I attached the standard postgres in my http://fly.io app during fly launch . Do you mean that?
Yeah. Could you send me the simplest setup to get that started. I tried yesterday and I didn't see a click to deploy postgres
Do I have to install their tool?
yes their cli. then fly auth signup and fly launch and they set you up, then fly deploy. you can then do (System/getenv "DATABASE_URL") to get the :jdbcUrl
https://fly.io/docs/hands-on/install-flyctl/
Cool cool. Give me an hour
If needed I can send you my Dockerfile and build.clj, but no special magic should be needed.
Could you rather just send me the url to your instance? I went through all the steps but now to deploy I need to give add my cc and pay $5 and it's not pro-rata for my usage
@alekcz360 I message you
@timok here's the pull request when you're back from holiday: https://github.com/replikativ/konserve-jdbc/pull/21
Hey @merklefabian, that looks like an issue with your postgresql libs. You should probably try to connect to the fly.io-postgresql on the repl. This is not an obvious issue with datahike.
@merklefabian sometimes the provider requires SSL and the driver doesn't do so by default. A few years back I had a similar issue with DigitalOcean. Adding ?ssl-mode=REQUIRED to the connection string helped me.
Thanks for your answer @alekcz360. I tried ssl-mode required and sslmode=disable as set by http://fly.io but the same error still occurs.
Calling db-with (or with) sometimes breaks query on fresh db from @conn, such as:
(d/q
'[:find [?e ...]
:where [?e :ts-entity.smith/id]]
@dev/db-conn)
; => [22 28 34 31 23 26 24 33 32 27 30 29 25]
(dh/db-with @dev/db-conn
[{:trade/id
"ts-entity.smith-bill-detail/128790"}])
(d/q
'[:find [?e ...]
:where [?e :ts-entity.smith/id]]
@dev/db-conn)
; => []
The example is from the system I'm working on; I'm still trying to isolate the problem on a fresh REPL but couldn't produce it so far. If I do release and connect new conn the query would work again. Not all tx-data to db-with breaks it... Trying to see if anyone have any clue and can point me somewhere...Hey @itsfah, never seen that problem. Thanks for posting. Maybe someone has an idea...
Thanks for reporting! That is strange and should not happen. Feel free to open an issue @itsfah.
It would be good to be able to reproduce the issue.
These work for some reason...
(d/q
'[:find [?e ...]
:where
[?e ?a]
[?e :ts-entity.smith/id]]
@dev/db-conn)
;; => [22 28 34 31 23 26 24 33 32 27 30 29 25]
(d/q
'[:find [?e ...]
:where
[?e :ts-entity.smith/id]]
(map seq (d/datoms @dev/db-conn :eavt)))
;; => [22 28 34 31 23 26 24 33 32 27 30 29 25]