Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/piomin/sample-quarkus-microservice
Quarkus demo app illustrating how to implement and test a REST-based, simple microservice
https://github.com/piomin/sample-quarkus-microservice
postgresql quarkus quarkus-resteasy
Last synced: 3 months ago
JSON representation
Quarkus demo app illustrating how to implement and test a REST-based, simple microservice
- Host: GitHub
- URL: https://github.com/piomin/sample-quarkus-microservice
- Owner: piomin
- Created: 2023-01-20T21:50:37.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-30T13:29:33.000Z (9 months ago)
- Last Synced: 2024-05-01T13:54:29.519Z (9 months ago)
- Topics: postgresql, quarkus, quarkus-resteasy
- Language: HTML
- Homepage:
- Size: 253 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Quarkus Microservice Demo Project [![Twitter](https://img.shields.io/twitter/follow/piotr_minkowski.svg?style=social&logo=twitter&label=Follow%20Me)](https://twitter.com/piotr_minkowski)
[![CircleCI](https://circleci.com/gh/piomin/sample-quarkus-microservice.svg?style=svg)](https://circleci.com/gh/piomin/sample-quarkus-microservice)
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-black.svg)](https://sonarcloud.io/dashboard?id=piomin_sample-quarkus-microservice)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-quarkus-microservice&metric=bugs)](https://sonarcloud.io/dashboard?id=piomin_sample-quarkus-microservice)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-quarkus-microservice&metric=coverage)](https://sonarcloud.io/dashboard?id=piomin_sample-quarkus-microservice)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=piomin_sample-quarkus-microservice&metric=ncloc)](https://sonarcloud.io/dashboard?id=piomin_sample-quarkus-microservice)This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .## Running the application in dev mode
First run your Docker Daemon. The following command should be succeeded:
```shell
docker ps
```You can run your application in dev mode that enables live coding using:
```shell script
mvn 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
The application can be packaged using:
```shell script
mvn clean 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.The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
If you want to build an _über-jar_, execute the following command:
```shell script
./mvnw package -Dquarkus.package.type=uber-jar
```The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
## Creating a native executable
You can create a native executable using:
```shell script
mvn package -Pnative
```Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
```shell script
mvn package -Pnative -Dquarkus.native.container-build=true
```You can then execute your native executable with: `./target/sample-quarkus-microservice-1.0.0-SNAPSHOT-runner`
## Running on Kubernetes
First, you need to install Postgres on Kubernetes, e.g. with Helm:
```shell
$ helm install person-db bitnami/postgresql -n sample-quarkus --set auth.username=quarkus --set auth.database=quarkus --set fullnameOverride=person-db --create-namespace
```Then, you can build and deploy the app within one step with Maven by activating the `kubernetes` profile:
```shell
$ QUARKUS_JIB_BASE_JVM_IMAGE=registry.access.redhat.com/ubi8/openjdk-17-runtime:latest mvn clean package -DskipTests -Pkubernetes
```Or, with the `minikube` profile for running on Minikube.
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.
## Related Guides
- OpenShift ([guide](https://quarkus.io/guides/deploying-to-openshift)): Generate OpenShift resources from annotations
- Micrometer Registry Prometheus ([guide](https://quarkus.io/guides/micrometer)): Enable Prometheus support for Micrometer
- SmallRye OpenAPI ([guide](https://quarkus.io/guides/openapi-swaggerui)): Document your REST APIs with OpenAPI - comes with Swagger UI
- Hibernate ORM with Panache ([guide](https://quarkus.io/guides/hibernate-orm-panache)): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
- SmallRye Health ([guide](https://quarkus.io/guides/microprofile-health)): Monitor service health
- JDBC Driver - PostgreSQL ([guide](https://quarkus.io/guides/datasource)): Connect to the PostgreSQL database via JDBC## Provided Code
### RESTEasy JAX-RS
Easily start your RESTful Web Services
[Related guide section...](https://quarkus.io/guides/getting-started#the-jax-rs-resources)
### SmallRye Health
Monitor your application's health using SmallRye Health
[Related guide section...](https://quarkus.io/guides/smallrye-health)