simao / ota-lith

Mozilla Public License 2.0
7 stars 3 forks source link

Mariadb can't connect with sbt -Dconfig.file=$(pwd)/ota-lith-ce.conf #3

Closed Jeredriq closed 2 years ago

Jeredriq commented 2 years ago

For some reason, I can't obtain a connection from mariadb.

`|2021-11-23 08:24:15,511|c.a.tuf.reposerver.ReposerverBoot|Could not run migrations. Fatal error, shutting down
org.flywaydb.core.internal.exception.FlywaySqlException: 

Unable to obtain connection from database (jdbc:mariadb://db:3306/tuf_repo) for user 'tuf_repo': Could not connect to address=(host=db)(port=3306)(type=master) : Socket fail to connect to host:db, port:3306. db

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State  : 08000
Error Code : -1
Message    : Could not connect to address=(host=db)(port=3306)(type=master) : Socket fail to connect to host:db, port:3306. db

Then it givesorg.apache.kafka.common.KafkaException: Failed to construct kafka producer erroras can be expected. I've started my MariaDB and can see it running: LISTEN 0 80 127.0.0.1:3306 0.0.0.0:* users:(("mysqld",pid=76075,fd=21)) `

It may be something related to configuration so I am also putting it (ota-lith-ce.conf) here: Note that I have not changed anything, just downloaded the repo and did the steps following Readme file. I don't have treehub.storage.local.path = "/var/lib/ota-lith" as it says, its on desktop sp that may be causing it but I am not sure. I just assumed it will move it there when it runs correctly.

include "application"

ats {
  ota-lith = {
    db.default_host = "db"
    http.default_client_host = "ota-lith"
  }

  database {
    encryption {
      salt = "QyHon03eqkw="
      password = "kxHUuCWMLjUcEvsgaf3EfArToM79psmKsAJRMesApwEK9bdVdFNMpfcL7tKJkups"
    }
  }

  reposerver.storage.type = "local"
  reposerver.storage.localStorageRoot = "/var/lib/ota-lith/tuf-objects"
  treehub.storage.type = "local"
  # treehub.storage.local.path = "/var/lib/ota-lith/treehub-objects"
  treehub.storage.local.path = "/var/lib/ota-lith"

  messaging {
    mode = "kafka"
    kafka.host = "kafka:9092"
  }
}
Jeredriq commented 2 years ago

I am on webapp branch by the way

simao commented 2 years ago

Hi,

I just tested this from scratch and it is working for me.

I just ran

docker-compose -f ota-ce.yaml up

And services started properly.

Make sure mariadb and kafka are started properly, if not you might need to stop all containers (docker-compose -f ota-ce.yaml down) and try again.

Jeredriq commented 2 years ago

Hi Simao,

Thanks a lot for answering so fast to my questions. I was following the Readme file with sbt. And it may be a really dumb question but docker-compose -f ota-ce.yaml up gives the ERROR: manifest for uptane/ota-lith:latest not found: manifest unknown: manifest unknown. Why could it be?

simao commented 2 years ago

Hi,

It seems uptane/ota-lith:latest was not built properly.

Can you show the output of sbt docker:publishLocal ?

You should see something like:

[info] Successfully built 66bfaeed0e3d
[info] Successfully tagged uptane/ota-lith:bb7ceca775c4b659ba421ab47a413d0f6546b532
[info] Successfully tagged uptane/ota-lith:latest
[info] Built image uptane/ota-lith with tags [bb7ceca775c4b659ba421ab47a413d0f6546b532, latest, bb7ceca775c4b659ba421ab47a413d0f6546b532]
[success] Total time: 128 s (02:08), completed 24 Nov 2021, 10:36:56
Jeredriq commented 2 years ago

It was my bad, it worked with sbt docker:publishLocal then docker-compose -f ota-ce.yaml up Thanks!