Git Product home page Git Product logo

xpense-quarkus's Introduction

XPENSES

Why ?

This application allows several users to track and share their expenses.

Please notice the first version can manage up to 2 users, as the next versions will be available to more users.

Some configuration files are deliberately missing.

Creating a native executable

You can create a native executable using:

mvnci -Pnative

Or, if you don't have GraalVM installed, you can run the native executable build in a container using:

Note : quarkus.native.native-image-xmx args must be set for macos and Windows in order to allocate enough memory when building the image.

mvnci -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=4g

Running the image

docker run -i --rm -p 8080:8080 quarkus/xpenses-quarkus  

Native executable code

https://quarkus.io/guides/writing-native-applications-tips

The following dependency must be added for serialization

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
  • Entities must be annotated by @RegisterForReflection to be included in the native executable.
  • Entities must contain at least a default constructor and a constructor with all parameters.
  • Entities constructors cannot be generated from Lombok annotations.

Kubernetes Kafka setup

https://strimzi.io/quickstarts

YAML :

Run everything

# Increase memory to support kafka cluster
minikube start --memory=4096 

# Create namespace
kubectl create ns kafka

# Enable storage to minikube for built images
eval $(minikube -p minikube docker-env)

cd service
mvn package
docker build -f src/main/docker/Dockerfile.jvm . -t xpenses-quarkus

# Set up Kafka cluster https://strimzi.io/quickstarts
kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka
kubectl apply -f https://strimzi.io/examples/latest/kafka/kafka-persistent-single.yaml -n kafka
kubectl wait kafka/my-cluster --for=condition=Ready --timeout=300s -n kafka

# Set up environment
kubectl create -f src/main/kubernetes/all-in-one.yaml

# Get minikube tunnel info to use the service
minikube service -n kafka xpenses-quarkus-service

# Use the localhost ip to connect to the application

Kamel Kafka

Create a Kamel application to listen from the given kafka topic and performs actions following the Enterprise Integration Patterns.

Install the Kamel CLI to deploy the application in K8s

MacOs

# Install the CLI
brew install kamel

# Add the CLI to the cluster and given namespace
kamel install -n kafka

# Deploy the application to the namespace
kamel run kamel/src/main/java/org/thoms/ExpensesKamel.java -n kafka --dev

### OPTIONAL
# Reset if any errors occurred
kamel reset -n kafka

# You may need to run this after reset
kamel run kamel/src/main/java/org/thoms/ExpensesKamel.java -n kafka

Useful links

xpense-quarkus's People

Stargazers

 avatar

Watchers

 avatar

xpense-quarkus's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.