Quarkus-based Trellis-database container fails to start

36 views
Skip to first unread message

Companjen, B.A.

unread,
May 12, 2020, 5:28:33 PM5/12/20
to trell...@googlegroups.com

Hello,

 

I finally decided to see if Trellis runs on my machine using docker-compose.

I started with the example compose yaml configuration, but changed it to use the Quarkus based database app and, following the list of environment variables, ended up with:

 

version: "3"

services:

  trellis:

    image: trellisldp/trellis-database:latest

    environment:

      # QUARKUS_DATASOURCE_DRIVER: org.postgresql.Driver

      QUARKUS_DATASOURCE_URL: "jdbc:postgresql://trellisdb:5432/trellisdb"

      QUARKUS_DATASOURCE_USERNAME: trellis

      QUARKUS_DATASOURCE_PASSWORD: changeme

      QUARKUS_FLYWAY_MIGRATE_AT_START: "true"

    ports:

      - 8088:8080

    depends_on:

      - trellisdb

    volumes:

      - /Users/companjenba/trellis/data:/opt/trellis/data

      - /Users/companjenba/trellis/log:/opt/trellis/log

      # Please see note below about the ./etc directory

      - /Users/companjenba/trellis/conf:/opt/trellis/etc

  trellisdb:

    image: postgres

    environment:

      POSTGRES_DB: trellisdb

      POSTGRES_PASSWORD: changeme

      POSTGRES_USER: trellis

      PGDATA: /var/lib/postgresql/data/pgdata/mydata

    volumes:

      - /Users/companjenba/trellis/database:/var/lib/postgresql/data/pgdata/mydata

 

I put the default config.yml in the directory mounted to /opt/trellis/etc, decided that the config looked okay and ran `docker-compose up -d`.

 

However, the trellis service fails with the message: Driver does not support the provided URL: jdbc:postgresql://trellisdb:5432/trellisdb

https://github.com/agroal/agroal/blob/master/agroal-pool/src/main/java/io/agroal/pool/ConnectionFactory.java#L215 is the line that throws the exception.

It looks like the connection is null, but I'm not sure why. Incorrect credentials? I checked.

Does this situation look familiar to anyone? What am I missing?

 

Thanks for all the hard work!

 

Regards,

 

Ben

 

Ben Companjen

Digital Scholarship Librarian

Centre for Digital Scholarship

Leiden University Libraries (UBL)

Web https://www.universiteitleiden.nl/en/staffmembers/ben-companjen

Aaron Coburn

unread,
May 13, 2020, 10:19:45 AM5/13/20
to trell...@googlegroups.com
Hi Ben,
the default configured driver for the Quarkus-based system is H2, so if you plan to use PostgreSQL, you'll need this ENV variable:

QUARKUS_DATASOURCE_DRIVER: org.postgresql.Driver

Generally, that documentation you're using is set up for the Dropwizard-based platform (I need to update it). There are also a few other ENV variables that might be useful here:

TRELLIS_FILE_MEMENTO_PATH: /opt/trellis/data/mementos
TRELLIS_FILE_BINARY_PATH: /opt/trellis/data/binaries

This is also a good nudge for me to update those docs and add in Kubernetes examples (which is what I tend to use).

Hope that helps,
Aaron

--
You received this message because you are subscribed to the Google Groups "Trellis LDP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trellis-ldp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trellis-ldp/4A82197E-B74D-4E9E-ABE1-A930424779EA%40library.leidenuniv.nl.

Companjen, B.A.

unread,
May 13, 2020, 12:10:46 PM5/13/20
to trell...@googlegroups.com

Hi Aaron,

 

Thanks for your help, but it didn't solve it. In fact, I did have the environment variable set before.

I put the Compose file and the log of trying to start in a Gist: https://gist.github.com/bencomp/d31c3bf0f3b81aabab1d98d847245686

According to the JDBC API, a Driver should indeed return null when it doesn't understand the JDBC URL, even though the URL I use should be supported by the PostgreSQL JDBC driver.

 

I would love more examples of running Trellis. I am very impressed by the build quality of the project, but have been struggling a bit to understand how to configure what components (and in which locations) to run the application. If I can help with documentation, please let me know.

 

Regards,

 

Ben

Aaron Coburn

unread,
May 13, 2020, 4:54:51 PM5/13/20
to trell...@googlegroups.com
Hi Ben,
It looks like Quarkus changed its database configuration format in a recent release. This should work better (note the _JDBC_ in the name and the introduction of the *_DB_KIND variable -- now the *_DRIVER variable doesn't seem to be necessary):

    environment:
      QUARKUS_DATASOURCE_DB_KIND: postgresql
      QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://trellisdb:5432/trellisdb

Cheers,
Aaron

Aaron Coburn

unread,
May 13, 2020, 6:25:37 PM5/13/20
to trell...@googlegroups.com
Hi Ben,
it looks like I spoke too soon. The Quarkus JDBC driver configuration is actually set at build time, which means H2 (an embedded database) is used, since that's the default. This is part of the ahead-of-time compilation strategy of Quarkus: unused classes are dropped at build time, so alternative database drivers are removed; this is actually really great for performance, but it means less flexibility in other contexts. I'll sort this out for the next release.

Cheers, Aaron

Companjen, B.A.

unread,
May 14, 2020, 2:19:48 AM5/14/20
to trell...@googlegroups.com

Hi Aaron,

 

After trying your suggestions I went looking for the configuration as well and came to the same conclusion (but had to sleep first). Thanks for your help in figuring this out!

Aaron Coburn

unread,
May 21, 2020, 8:17:06 PM5/21/20
to trell...@googlegroups.com
Hi, Ben,
To circle back on this issue, we now have the fix for this merged into master, and it will be part of the 0.12.0 release (scheduled for next week). One item to note is that the docker image is going to be renamed from trellis-database to the more accurate trellis-postgres, which will be available on both docker hub and as a GitHub package on the trellis-ldp/trellis repository.

This will also coincide with the move of the JDBC-based code in the extension repo into the main Trellis repository.

Cheers,
Aaron

Companjen, B.A.

unread,
May 25, 2020, 3:16:05 AM5/25/20
to trell...@googlegroups.com

Hi Aaron,

That is great! I will try it out then.

 

Looking at the repository and PR 860 in particular, I think you meant to say the new image name will be trellis-postgresql, not trellis-postgres, didn't you?

I wanted to ask if you could update the Dockerized Trellis wiki page, as the main README mentions the databasepostgresql image and refers to the wiki page, but the wiki page only builds on the trellis-ext-db image. I am not in a hurry and can create an issue for it as well if you like.

 

Groeten van Ben

Aaron Coburn

unread,
May 25, 2020, 11:05:54 AM5/25/20
to trell...@googlegroups.com
Hi Ben,
Naming can be tricky, and when I got to actually changing the name of the Docker container, it seemed that "postgresql" was more common than just "postgres". So the new image is, in fact, trellis-postgresql.

I cut the 0.12 release yesterday but haven't written a formal announcement yet -- there is some documentation that needs to be updated (including the wiki page you referred to), though the released bits are all now available, including at Docker hub. I also have docker compose files for the various environments that run weekly tests on the docker containers at https://github.com/trellis-ldp/trellis-docker-tests, so feel free to use those as example configurations. In the context of your earlier question, this would be the file that you'd probably be most interested in: https://github.com/trellis-ldp/trellis-docker-tests/blob/master/trellis-quarkus-postgresql-compose.yml (though you should pull from either the `latest` or `0.12.0` tags, not `develop`).

Cheers,
Aaron






Reply all
Reply to author
Forward
0 new messages