Fork me on GitHub
#datomic
<
2021-07-12
>
zendevil.eth17:07:44

I’m trying to run Datomic https://github.com/alexanderkiel/datomic-free and my clojure server as two services using docker compose locally, and this is my compose file:

version: '3'
services:
  datomic:
    image: akiel/datomic-free
    environment:
        - ADMIN_PASSWORD="admin"
        - DATOMIC_PASSWORD="datomic"
  web:
    build: .
    ports:
      - "3001:3000"
This was working without docker where I was running the transactor on the machine directly using the local dev instructions on the datomic website, but using docker compose, I get the following error when making a request to my server that involves a database transaction: https://gist.github.com/zendevil/ce069eb7375ede709c2e4ebbd3c2ef3b Relevant code:
(def db-uri "datomic:")

(def *conn
  "Get shared connection."
  (delay (d/connect db-uri)))

(defn install-schema
  "This function expected to be called at system start up.

  Datomic schema migrations or db preinstalled data can be put into 'migrations/schema.edn'
  Every txes will be executed exactly once no matter how many times system restart."
  []
  (prn "installing schema")
  (let [schema-map (read-string (slurp "resources/migrations/schema.edn"))]
    (prn "schema map" schema-map)
    @(d/transact (force *conn) (:creator-schema schema-map))
    @(d/transact (force *conn) (:creation-schema schema-map))
    ))

(defn init-db [_]
  (prn "database created " (d/create-database db-uri))
  (try (install-schema)
       (catch Exception e (prn "installing schema" e)))
  (r/response "ok")
  )
The http request calls init-db

Drew Verlee18:07:30

the error is saying the jdbc client cant reach mysql. So somehow that address is wrong.

Drew Verlee18:07:55

maybe its supposed to be datomic:4335?

Drew Verlee18:07:38

try

(def db-uri "datomic:")
instead

zendevil.eth19:07:16

that gives: Caused by: org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-171]

Drew Verlee19:07:26

well it connected, so the next step is to give it the right username and password.

zendevil.eth19:07:45

do you see anywhere here to give a username or password? https://github.com/alexanderkiel/datomic-free

Drew Verlee21:07:43

it's currently passed in the db-url or at least the password is

Drew Verlee21:07:09

what your passing looks correct in that it matches the grammar of the string on the githubpage

Drew Verlee21:07:40

security is a PITA because it's not specific about whats wrong. e.g password or user (of course it can't know, but it also doesnt want to share)

Drew Verlee21:07:27

(def db-uri "datomic:")
maybe?

jdkealy22:07:29

If I'm using dynamodb in prod, can i also use dynamodb locally? Should I be? Is it seamless to restore a dynamo db into local if the storage engines are different ?

jdkealy23:07:35

Ah i see the dynamodb local storage. I didn't know that was an option. Is that recommended ?

jaret16:07:44

Using Datomic on-prem https://docs.datomic.com/on-prem/operation/backup.html to move across storages is a great feature of backup and restore. However for https://docs.datomic.com/on-prem/operation/backup.html#other-storages we recommend running with all system processes down, run the restore, then start the transactor and peers.