Skip to content

GraalVM Cloud Native (GCN) Micronaut sample project with REST API and single page web app and AutonomousDB

License

Notifications You must be signed in to change notification settings

mikarinneoracle/gcn-micronaut-atp-price-spa

Repository files navigation

GCN Micronaut "Price" page SPA with ATP - powered by Graal Cloud Native

GraalVM Cloud Native (GCN) Micronaut sample project with REST API and single page web app and AutonomousDB.

The intention of this sample project is to demonstrate the VS Code GCN extensions & tooling. The database classes and interfaces were generated with the GCN extension from the database schema that is a very handy tool for developers.

Instructions

  1. Create a sample ATP database instance with schema and data and public access https://github.com/mikarinneoracle/atp-ords-liquibase-demo (Choose the part #2 to use Resource Manager/Terraform).
  2. Create the VS Code project by cloning this repo locally. After cloning remove the git directory from project root by rm -rf .git in the project terminal.
  3. Edit application-dev.yaml line 12 by placing the OCID of the ATP instance created in the first step.
  4. Edit application-oraclecloud.yaml line 12 by placing the OCID of the ATP instance created in the first step.
  5. Build and run the app locally in VS Code by navigating to Application.java under oci/src/main/java/com/example/ directory and clicking the Run Java button ( ▷ ).
    This will work locally since I'm configuring the environment dev by default in Application.java line 31 (in the GCN generated project the default environment is oraclecloud).
  6. Create DevOps project from VS Code and build and deploy the JVM container to OKE using the extension tooling.
    Tip: I've modified the GCN generated build pipeline a bit so that I've added a new step to end of it to trigger the OKE deployment pipeline automatically after the build. Also, for automatic builds when committing code I've added a trigger to OCI DevOps project to kick-off the deployment pipeline (and hence also the deployment pipeline) automatically. This works for both JVM and GraalVM Native builds.
  7. Create OCI load balancer with kubectl to access the the application from browser:
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: gcn-micronaut-atp-price-spa-lb
spec:
  selector:
    app:  gcn-micronaut-atp-price-spa
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: LoadBalancer
EOF
  1. Access the OCI load balancer url from browser e.g.
kubectl get svc
NAME                         TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)             AGE
gcn-micronaut-atp-price-lb   LoadBalancer   10.96.100.164   138.2.167.156     80:30258/TCP        8s

Micronaut 4.0.3 Documentation


Feature data-jdbc documentation

Feature flyway documentation

Feature http-client documentation

Feature jdbc-hikari documentation

Feature oracle-cloud-atp documentation

Feature oracle-cloud-sdk documentation

Feature serialization-jackson documentation

Feature test-resources documentation

Feature validation documentation

About

GraalVM Cloud Native (GCN) Micronaut sample project with REST API and single page web app and AutonomousDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published