Fork me on GitHub
#datomic
<
2022-11-09
>
Setzer2219:11:23

Hi! 👋 I'm trying to set up datomic with Postgres, and I believe I set up everything correctly, but when I start my system datomic fails with the following error:

Terminating process - Lifecycle thread failed
java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: ERROR: relation "datomic_kvs" does not exist
  Position: 31
       at java.util.concurrent.FutureTask.report(FutureTask.java:122)
       at java.util.concurrent.FutureTask.get(FutureTask.java:192)
       at clojure.core$deref_future.invokeStatic(core.clj:2304)
       at clojure.core$future_call$reify__8477.deref(core.clj:6976)
       at clojure.core$deref.invokeStatic(core.clj:2324)
       at clojure.core$deref.invoke(core.clj:2310)
       at datomic.lifecycle_ext$standby_loop.invokeStatic(lifecycle_ext.clj:42)
       at datomic.lifecycle_ext$standby_loop.invoke(lifecycle_ext.clj:40)
       at clojure.lang.Var.invoke(Var.java:384)
       at datomic.lifecycle$start$fn__3330.invoke(lifecycle.clj:73)
       at clojure.lang.AFn.run(AFn.java:22)
       at java.lang.Thread.run(Thread.java:750)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "datomic_kvs" does not exist
That's really strange, because I made sure to initialize my database with the provided scripts, and the table does seem to exist when I check via psql:
postgres@629dc6959e77:/$ psql
psql (15.0 (Debian 15.0-1.pgdg110+1))
Type "help" for help.

postgres=# SELECT * FROM datomic_kvs
postgres-# \dt
            List of relations
 Schema |    Name     | Type  |  Owner   
--------+-------------+-------+----------
 public | datomic_kvs | table | postgres
(1 row)
Any idea what could be going on?

ghadi19:11:32

doublecheck your connection string

Setzer2220:11:29

Seems to be correct :thinking_face: But after investigating a bit more, I realized psql doesn't show the table when I run with the datomic user, so the problem seems to be there.

ghadi20:11:53

there you go

1
Setzer2220:11:37

Yes, but, I don't know what extra permissions I'm supposed to give it. I'm just running the provided init scripts which seem to grant the right access on the tables.

Setzer2220:11:58

I'm not sure if there's a recommended postgresql version to use with datomic, I have the feeling picking latest (15.0) may not have been the best choice here

Setzer2221:11:58

Looks like I was able to get some progress. The table was not being created inside the datomic database due to how I was running the initialization scripts. Unfortunately, there are more issues 😩

Setzer2221:11:51

I set up my code to use the following uri to connect to datomic: datomic:<POSTGRES-HOST>:5432/datomic?user=datomic&password=<PASSWORD> (where <POSTGRES-HOST> and <PASSWORD> are redacted for obvious reasons, but have correct values). When doing that, I'm getting this error: > ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]

Setzer2221:11:33

does that ring any bells?

Ivar Refsdal17:11:47

Did you set alt-host? It's mentioned in the docs somewhere... I have a working docker-compose setup here: https://github.com/ivarref/spa-monkey/blob/main/docker-compose.yml (requires the folder datomic from that repo as well.) It has an init script that creates datomic_kvs...: https://github.com/ivarref/spa-monkey/blob/main/datomic/init (I agree that setting up datomic is way harder than it should be IMHO)

Ivar Refsdal17:11:22

Note that in this setup I am not persisting any postgres data to an actual volume, so you will loose all work/changes when docker exits...