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.
- 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).
- 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. - Edit
application-dev.yaml line 12
by placing the OCID of the ATP instance created in the first step. - Edit
application-oraclecloud.yaml line 12
by placing the OCID of the ATP instance created in the first step. - 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 environmentdev
by default inApplication.java line 31
(in the GCN generated project the default environment isoraclecloud
). - 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 generatedbuild pipeline
a bit so that I've added a new step to end of it to trigger the OKEdeployment 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. - 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
- 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 Oracle Cloud Autonomous Transaction Processing (ATP) documentation
-
https://www.oracle.com/autonomous-database/autonomous-transaction-processing/