Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems starting newest docker image with docker compose #247

Closed
bakhtizin opened this issue Jul 16, 2020 · 5 comments
Closed

Problems starting newest docker image with docker compose #247

bakhtizin opened this issue Jul 16, 2020 · 5 comments

Comments

@bakhtizin
Copy link

Dear Team,

when trying to start the server with latest docker image (digest: a1c02b3544cf), there's an exception being thrown indicating that database connection is failing. The persistence_autoUpdateDatabase enviroment variable was set to false, to ensure that FROST is not trying to update the database on startup before the database is ready. Then triggering an update at http://localhost:8080/FROST-Server/DatabaseStatus results in:

web_1       | 10:33:55.190 [http-nio-8080-exec-4] INFO    d.f.i.i.f.h.c.DatabaseStatus - DatabaseStatus Servlet called.
web_1       | 10:33:55.858 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Setting persistence.db.url has value 'jdbc:postgresql://database:5432/sensorthings'.
web_1       | 10:33:55.858 [http-nio-8080-exec-4] INFO   d.f.i.i.f.p.p.ConnectionUtils - Setting up BasicDataSource for database connections.
web_1       | 10:33:55.858 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Setting persistence.db.driver has value 'org.postgresql.Driver'.
web_1       | 10:33:56.287 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Setting persistence.db.url has value 'jdbc:postgresql://database:5432/sensorthings'.
web_1       | 10:33:56.287 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Setting persistence.db.username has value 'sensorthings'.
web_1       | 10:33:56.287 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Setting persistence.db.password has value 'ChangeMe'.
web_1       | 10:33:56.287 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Not set persistence.db.conn.idle.max, using default value '8'.
web_1       | 10:33:56.288 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Not set persistence.db.conn.max, using default value '8'.
web_1       | 10:33:56.288 [http-nio-8080-exec-4] INFO     d.f.i.i.f.settings.Settings - Not set persistence.db.conn.idle.min, using default value '0'.
web_1       | 10:33:57.602 [http-nio-8080-exec-4] WARN      l.database.DatabaseFactory - Unknown database: PostgreSQL
web_1       | 10:33:58.342 [http-nio-8080-exec-4] INFO    l.d.core.UnsupportedDatabase - Error getting default schema
web_1       | liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.UnexpectedLiquibaseException: Cannot find Executor for jdbc
web_1       | 	at liquibase.executor.ExecutorService.lambda$getExecutor$0(ExecutorService.java:99)
web_1       | 	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1133)
web_1       | 	at liquibase.executor.ExecutorService.getExecutor(ExecutorService.java:93)
web_1       | 	at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:359)
web_1       | 	at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:324)
web_1       | 	at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:61)
web_1       | 	at liquibase.Liquibase.<init>(Liquibase.java:109)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.LiquibaseHelper.runLiquibaseCheck(LiquibaseHelper.java:72)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.LiquibaseHelper.checkForUpgrades(LiquibaseHelper.java:53)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.persistence.pgjooq.PostgresPersistenceManager.checkForUpgrades(PostgresPersistenceManager.java:327)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.http.common.DatabaseStatus.checkForUpgrades(DatabaseStatus.java:127)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.http.common.DatabaseStatus.processGetRequest(DatabaseStatus.java:80)
web_1       | 	at de.fraunhofer.iosb.ilt.frostserver.http.common.DatabaseStatus.doGet(DatabaseStatus.java:154)

As a consequence GET requests to any URL under http://localhost:8080/FROST-Server/v1.1/* or http://localhost:8080/FROST-Server/v1.0/* result in 500 Server Error with message Failed to execute query.

@phertweck
Copy link
Contributor

To run the FROST-Server you need a PostgreSQL database. Did you directly run the server-Docker image or did you use the docker-compose.yml?

If you just started the server image, you need to make sure to have a database available (it's not included in the server image). Therefore your recommendation is to use the provided docker-compose.yaml. Please have a look at the documentation for more information.

@bakhtizin
Copy link
Author

bakhtizin commented Jul 16, 2020

I used the docker-compose.yaml:

version: '2'

services:
  web:
    image: fraunhoferiosb/frost-server:latest
    environment:
      - serviceRootUrl=http://localhost:8080/FROST-Server
      - http_cors_enable=true
      - http_cors_allowed.origins=*
      - persistence_db_driver=org.postgresql.Driver
      - persistence_db_url=jdbc:postgresql://database:5432/sensorthings
      - persistence_db_username=sensorthings
      - persistence_db_password=ChangeMe
      - persistence_autoUpdateDatabase=false
    ports:
      - 8080:8080
      - 1883:1883
    depends_on:
      - database

  database:
    image: postgis/postgis:11-2.5-alpine
    environment:
      - POSTGRES_DB=sensorthings
      - POSTGRES_USER=sensorthings
      - POSTGRES_PASSWORD=ChangeMe
    volumes:
      - postgis_volume:/var/lib/postgresql/data
volumes:
    postgis_volume:

with - persistence_autoUpdateDatabase=false explicitly set to false.

@hylkevds
Copy link
Member

It looks like the all-in-one image is still broken after tightening the the permissions (#240). I suspect this is the cause, we'll have a look.

@hylkevds
Copy link
Member

It should be fixed once the build is through: https://travis-ci.org/github/FraunhoferIOSB/FROST-Server

@bakhtizin
Copy link
Author

Thank you for such a quick response. Now it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants