Quarkus with Gradle and Postgres per lane
A Quarkus app in dev mode, run through the Gradle Wrapper, that keeps notes in its lane’s own Postgres container and renders them with Qute. Each lane also gets its own debugger port, so a second lane does not lose debugging to the first.
Requirements
Section titled “Requirements”- devlanes, with
devlanes setuprun once - JDK 21 or later; the Gradle Wrapper downloads Gradle itself
- Docker with Compose 2.24.4 or newer, which
per_laneneeds
Run it
Section titled “Run it”cd frameworks-quarkus-gradledevlanes startdevlanes start --no-ui prints the start as text:
✓ infra✓ setup✓ services readyexample-quarkus-gradle@0 · main✓ services 1 of 1 ready ✓ web https://example-quarkus-gradle.localhostOpen https://example-quarkus-gradle.localhost. The page shows lane 0 of example-quarkus-gradle, the lane’s Postgres container with its notes, and the port to attach a debugger to. “Add a note” inserts a row.
During a start
Section titled “During a start”- Infra. Postgres starts in the lane’s own Compose project,
example-quarkus-gradle-lane<N>, on a port from the lane’s block, with its ownpgdatavolume. infra.setup.schemaruns once per lane and feedsinfra/schema.sqltopsql, which creates thenotestable and its first row.webruns./gradlew quarkusDev. devlanes adds--no-daemon, so the Gradle build and the app it forks belong to the service and stop with it. The first start downloads Gradle and the dependencies, so the ready check allows 5 minutes.preset: quarkussetsQUARKUS_HTTP_PORT,QUARKUS_HTTP_HOST=127.0.0.1andQUARKUS_HTTP_TEST_PORT=0, plusQUARKUS_HTTP_HOST_VALIDATION_ALLOWED_HOSTSwith the service’s hostname, since Quarkus bound to127.0.0.1otherwise rejects requests from the proxy. It also passes-Ddebug=<port>with adebugport of the lane’s own.DEBUG_PORT: ${{ self.ports.debug }}hands the same number to the page.- Quarkus reads
QUARKUS_DATASOURCE_JDBC_URL, built from${{ infra.postgres.port }}. Dev Services is off inapplication.properties, so Quarkus does not start a database of its own. - The ready check waits for
/healthz.
Try next
Section titled “Try next”- Start a second lane:
git worktree add ../examples-checkout -b feat/checkout, thencd ../examples-checkout/frameworks-quarkus-gradle && devlanes start. https://example-quarkus-gradle1.localhost says lane 1, showsexample-quarkus-gradle-lane1-postgres-1with only the first row, and a debug port different from lane 0’s. - Attach a debugger to the port the page shows: in IntelliJ IDEA a “Remote JVM Debug” configuration on
127.0.0.1and that port, or from a terminaljdb -connect com.sun.jdi.SocketAttach:hostname=127.0.0.1,port=<port>. A breakpoint inHomeResource.indexstops on the next page load. - Change the lede in
src/main/resources/templates/HomeResource/index.htmland reload the page. Quarkus dev mode sees the change on that request and reloads the app inside the same process, anddevlanes logs web --tail 20showsRestarting quarkus due to changes in index.html. devlanes lane clean 1 --yesremoves lane 1’s Postgres container and its volume; lane 0 keeps its notes.
devlanes.yaml:infra.per_lane, the schema setup entry and thewebservice withrun_scriptonbuild.gradle.ktsandpreset: quarkus.build.gradle.ktsandgradle.properties: the Quarkus extensions and the one place the Quarkus version is written.src/main/resources/application.properties: Dev Services off.src/main/java/com/acme/notes/:config/Settings.javareads every variable,notes/holds the queries and the API,pages/renders the page.src/main/resources/templates/: the Qute layout, the lane card tag and the page.