datahike

Fabim 2024-03-26T08:44:43.858109Z

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

Fabim 2024-03-27T07:34:54.786809Z

@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.

timo 2024-03-27T08:26:38.962129Z

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

Fabim 2024-03-27T08:33:01.468799Z

@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

alekcz 2024-03-27T08:40:14.525179Z

@merklefabian lemme look into it. And cut you a new release

Fabim 2024-03-27T08:43:45.572989Z

@alekcz360 amazing, thanks. please let me know what you find. happy to help.

alekcz 2024-03-27T08:44:06.279819Z

Do you have a temporary db I could test against?

Fabim 2024-03-27T08:49:10.465629Z

I attached the standard postgres in my http://fly.io app during fly launch . Do you mean that?

alekcz 2024-03-27T08:56:26.411139Z

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

alekcz 2024-03-27T08:56:37.806739Z

Do I have to install their tool?

Fabim 2024-03-27T08:59:21.575579Z

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/

alekcz 2024-03-27T08:59:46.191429Z

Cool cool. Give me an hour

πŸ‘ 1
Fabim 2024-03-27T09:04:22.072139Z

If needed I can send you my Dockerfile and build.clj, but no special magic should be needed.

alekcz 2024-03-27T09:11:41.005849Z

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

alekcz 2024-03-27T09:12:04.489009Z

@merklefabian

Fabim 2024-03-27T09:34:14.022379Z

@alekcz360 I message you

alekcz 2024-03-27T11:42:55.779099Z

@timok here's the pull request when you're back from holiday: https://github.com/replikativ/konserve-jdbc/pull/21

πŸ‘ 2
timo 2024-03-26T08:48:12.946419Z

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.

alekcz 2024-03-26T09:01:24.681389Z

@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.

Fabim 2024-03-26T09:10:22.274539Z

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.

Absolute Negativity 2024-03-26T10:25:48.131569Z

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...

timo 2024-03-27T07:01:31.827759Z

Hey @itsfah, never seen that problem. Thanks for posting. Maybe someone has an idea...

whilo 2024-03-27T19:15:35.735729Z

Thanks for reporting! That is strange and should not happen. Feel free to open an issue @itsfah.

whilo 2024-03-27T19:16:33.351209Z

It would be good to be able to reproduce the issue.

Absolute Negativity 2024-03-26T14:21:45.353149Z

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]