Skip to content

Guide-V/quarkus-todo-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TODO Application

Development Mode

  • Navigate to directory todo or todo-reactive

  • Database container is configured automatically with Zero Config Setup (DevService). Check application.properties that there is no database URL, user and password specified in default and ve profile.

    mvn quarkus:dev

    Output

    ...
    11:42:17 INFO  [or.te.DockerClientFactory] (build-37) Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
    11:42:17 INFO  [or.te.DockerClientFactory] (build-37) Checking the system...
    11:42:17 INFO  [or.te.DockerClientFactory] (build-37) ✔︎ Docker server version should be at least 1.6.0
    11:42:18 INFO  [or.te.DockerClientFactory] (build-37) ✔︎ Docker environment should have more than 2GB free disk space
    11:42:18 INFO  [🐳.2]] (build-37) Creating container for image: postgres:13.2
    11:42:18 INFO  [🐳.2]] (build-37) Starting container with ID: 0040a40f1bbe0f583455d047ba3abf6e0cd7d9718fec342f9bb0a3fdf46bc315
    11:42:19 INFO  [🐳.2]] (build-37) Container postgres:13.2 is starting: 0040a40f1bbe0f583455d047ba3abf6e0cd7d9718fec342f9bb0a3fdf46bc315
    11:42:22 INFO  [🐳.2]] (build-37) Container postgres:13.2 started in PT4.512469S
    ...
  • Open URL http://localhost:8080 with your browser

  • Test RESTful API

    • Create new todo item

       curl -H "Content-type: application/json" \
       --data "@sample.json" -v \
        http://localhost:8080/api
    • List all todo items

       curl -v localhost:8080/api
    • Delete todo number 1

      curl -v -X DELETE http://localhost:8080/api/1

Build and Deploy with OpenShift

Build and Deploy

Dev Console

  • Deploy PostgreSQL Database. Add->Database, Select PostgreSQL

      | Parameter                      | Value        | 
      |--------------------------------|--------------|
      | Database Service Name          | todo-db      | 
      | PostgreSQL Connection Username | todo         | 
      | PostgreSQL Connection Password | todoPassword |  
    
  • Build and deploy todo app from Git

    • Add->From Git

    • Git Repository: https://github.com/voraviz/quarkus-todo-app and select Show Advanced Git Option

      | Parameter                      | Value        | 
      |--------------------------------|--------------|
      | Context dir        | todo      | 
      | Application Name | todo-app         | 
      | Name| todo | 
      
      • Select Route option

      • Select Build Configuration to add environment variables

        Environment variables (build and runtime) Value
        QUARKUS_PACKAGE_TYPE uber-jar

CLI

  • PostgreSQL Database

    oc create -f kustomize/base/todo-db.yaml
  • Todo App

    oc new-app --name todo \
    ubi8-openjdk-11:1.3~https://github.com/voraviz/quarkus-todo-app \
    --context-dir=todo --build-env=QUARKUS_PACKAGE_TYPE=uber-jar \
    --labels=app=todo --allow-missing-images
    oc logs -f buildconfig/todo
    oc expose svc todo

    or build by YAML

    oc create -f etc/todo-build.yaml
    oc logs -f bc/todo
    oc new-app --name=todo --image-stream=todo:latest --labels=app=todo
    oc expose svc/todo

Kustomize

  • Deploy with Kustomize

    oc create -k kustomize/overlays/dev
    watch oc get pods

User Workload Monitor

  • Enable User Workload Monitor
  • Create service monitor to monitor todo app
    • Create Service Monitor

      oc apply -f etc/deploy/service-monitor.yaml 
    • Scale todo to 2 pods

      oc scale deployment/todo --replicas=2
    • Run following command to gererate workload to getAll method

      siege -c 5 -t 5m -d 1 http://$(oc get route/todo -o jsonpath='{.spec.host}')/api
    • Developer Console, Monitoring->Metrics->Custom Query and select checkbox Stacked

      rate(application_io_quarkus_sample_TodoResource_countGetAll_total[1m])

GitOps with ArgoCD

WIP

About

Implementation of todo backend and use vuejs as frontend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 61.4%
  • JavaScript 19.7%
  • HTML 10.2%
  • Shell 8.7%