From 4d6642c14415ad2dd2d5d7398be69f21c413235e Mon Sep 17 00:00:00 2001 From: mbremer Date: Mon, 5 Jul 2021 17:19:17 +0200 Subject: [PATCH] Readme, docker.io-config, docker-compose.yml --- README.md | 30 ++++---------- docker-compose.yml | 39 +++++++++++++++++++ pom.xml | 6 ++- .../resources/META-INF/resources/error.html | 2 +- .../resources/META-INF/resources/login.html | 2 +- src/main/resources/application.properties | 11 ++++-- 6 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 17e1b9f..0d3ac94 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -# buerokalender Project +# buerokalender -This project uses Quarkus, the Supersonic Subatomic Java Framework. - -If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . +Eine kleine Webapp um die Belegung eines Büroarbeitsplatzes ohne Kollision zu buchen. ## Running the application in dev mode @@ -11,16 +9,13 @@ You can run your application in dev mode that enables live coding using: ./mvnw compile quarkus:dev ``` -> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. - -## Packaging and running the application +## Packaging and deployment The application can be packaged using: ```shell script ./mvnw package ``` It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. -Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. If you want to build an _über-jar_, execute the following command: ```shell script @@ -29,7 +24,7 @@ If you want to build an _über-jar_, execute the following command: The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. -## Creating a native executable +### Creating a native executable You can create a native executable using: ```shell script @@ -43,16 +38,7 @@ Or, if you don't have GraalVM installed, you can run the native executable build You can then execute your native executable with: `./target/buerokalender-0.1.0-SNAPSHOT-runner` -If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html. - -## Related Guides - -- RESTEasy JAX-RS ([guide](https://quarkus.io/guides/rest-json)): REST endpoint framework implementing JAX-RS and more - -## Provided Code - -### RESTEasy JAX-RS - -Easily start your RESTful Web Services - -[Related guide section...](https://quarkus.io/guides/getting-started#the-jax-rs-resources) +Push to docker.io: +```shell script +./mvnw clean package -DskipTests -Dquarkus.container-image.push=true +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7bf3680 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +version: "2.3" + +services: + app: + image: mattbremer/buerokalender:1 + environment: + - POSTGRES_USER=buerokalender + - POSTGRES_PASSWORD=buerokalender + - POSTGRES_PORT=5432 + restart: always + networks: + - buerokalender + ports: + - "3004:8080" + depends_on: + db: + condition: service_healthy + + db: + image: "postgres:13" + mem_limit: 128m + environment: + - POSTGRES_USER=buerokalender + - POSTGRES_PASSWORD=buerokalender + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U buerokalender" ] + interval: 5s + timeout: 5s + retries: 6 +# ports: +# - "5432:5432" + networks: + - buerokalender + volumes: + - ./postgres:/var/lib/postgresql/data + +networks: + buerokalender: + external: false \ No newline at end of file diff --git a/pom.xml b/pom.xml index f8134b0..138a28d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 de.mbremer buerokalender - 0.1.0-SNAPSHOT + 1.0.0 3.8.1 true @@ -69,6 +69,10 @@ io.quarkus quarkus-hibernate-validator + + io.quarkus + quarkus-container-image-docker + io.quarkus quarkus-junit5 diff --git a/src/main/resources/META-INF/resources/error.html b/src/main/resources/META-INF/resources/error.html index d9cb439..c64651a 100644 --- a/src/main/resources/META-INF/resources/error.html +++ b/src/main/resources/META-INF/resources/error.html @@ -1,5 +1,5 @@ - + diff --git a/src/main/resources/META-INF/resources/login.html b/src/main/resources/META-INF/resources/login.html index 3c2e58c..6d08fe7 100644 --- a/src/main/resources/META-INF/resources/login.html +++ b/src/main/resources/META-INF/resources/login.html @@ -1,5 +1,5 @@ - + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ef46f07..ffef7be 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ # Database -%prod.quarkus.datasource.jdbc.url = jdbc:postgresql://db:5432/buerokalender -%prod.quarkus.datasource.username = buerokalender -%prod.quarkus.datasource.password = buerokalender +%prod.quarkus.datasource.jdbc.url = jdbc:postgresql://db:${POSTGRES_PORT:5432}/buerokalender +%prod.quarkus.datasource.username = ${POSTGRES_USER:buerokalender} +%prod.quarkus.datasource.password = ${POSTGRES_PASSWORD:buerokalender} %prod.quarkus.datasource.jdbc.max-size=16 quarkus.datasource.db-kind=postgresql @@ -14,3 +14,8 @@ quarkus.http.auth.form.enabled=true #quarkus.http.auth.session.encryption-key=zHId14V+uiyxmbzhEPCyi7VvbaI80UeEO5yu0H/hVLs= # 24h quarkus.http.auth.form.timeout=86400 + +# Deployment +quarkus.container-image.additional-tags= 1 +quarkus.container-image.group = mattbremer +quarkus.container-image.name = buerokalender \ No newline at end of file