Oracle Cloud Assets
Oracle Cloud Assets simplifies managing Oracle Cloud Infrastructure (OCI) resources for GDK and Micronaut applications. Enabling developers to easily integrate OCI-based resources—such as databases, Object Storage buckets, vaults, and more—allows your application to be quickly configured and operational, significantly reducing setup time.
Oracle Cloud Assets can also add target execution environments such as Compute Instances or Oracle Kubernetes Engine (OKE) clusters to your applications. Based on the knowledge of the target environment and selected resources, it generates the necessary OCI policies for your application, uploads them, and deploys the application to the target environment.
By managing resource provisioning, configuration management, and application deployment, Oracle Cloud Assets suits beginners and experienced developers.
Beginners benefit by learning best practices for configuring and deploying applications, making it easier to get started without in-depth knowledge of the cloud infrastructure.
Experienced developers save time by offloading the manual work related to application configuration, allowing them to focus on more complex development tasks.
Supported Java Projects #
- Micronaut® framework
- Graal Development Kit for Micronaut (GDK)
Installation and Usage #
The Oracle Cloud Assets feature is part of the Graal Development Kit for Micronaut Extension Pack. Once you install the extension pack, Oracle Cloud Assets will become available.
Prerequisites #
- A Java Development Kit (JDK 17 or later).
- A Docker-API compatible container runtime such as Rancher Desktop or Docker.
To start using the feature, configure access to OCI (if you have not yet):
- Create an Oracle Cloud account (free tier is supported)
- Create an .oci/config cloud access configuration file
- Install the OCI CLI (needed for the OKE local access)
Having configured access to OCI, open a Micronaut or GDK project in the VS Code window.
The Oracle Cloud Assets panel becomes visible in the explorer.
Adding Resources to the Project #
Once you open a Micronaut or GDK project in VS Code, Oracle Cloud Assets scans the application dependencies and detects the types of resources needed to run in OCI. Suggestions for all detected resource types are displayed in the Oracle Cloud Assets window. A suggestion to select the execution environment—either a Compute Instance or a Kubernetes Cluster and Container Repository—is always shown because it is a required configuration step for all projects. If your application uses an Oracle Autonomous Database and you add it as a resource, its password is stored separately in a secure store.
For example, if your application stores files in OCI Object Storage, the option “Select Object Storage Bucket” is shown. Hover over it and click add. A new dialogue opens, prepopulated with the values, asking to select the cloud compartment and the required bucket name.
Next, you decide on the deployment environment and add a Compute Instance or a Kubernetes Cluster as a resource. In each case, you need to select a Container Repository in OCI where to push a container image for your application. Once you click “Select Container Repository” and select the target compartment, Oracle Cloud Assets offers you to <create new>:
When the required resources are assigned, Oracle Cloud Assets is ready to generate the application.properties and bootstrap.properties files.
Before the application runs locally, these properties files are created and passed to the application as temporary files using the MICRONAUT_CONFIG_FILES
environment variable.
This eliminates the need to set values for the missing datasources manually in the properties file and/or on the command line!
Note: You can preview the generated properties by invoking -> Open a preview of the config in the editor action.
Named Resource Binding #
In the Oracle Cloud Assets window, Database and Object Storage Bucket resources can be assigned names, which are then available through code completion in the @JdbcRepository
and @Named
annotations within VS Code.
Running Locally #
After all the required resources are added to Oracle Cloud Assets, the application is now ready to run on a local computer. It can be started using the Code Lens in the Application class, through the menu command Run ‑> Start Debugging, or in the Micronaut Tools activity panel. Configuration files, such as application.properties and bootstrap.properties, are created before the application is executed.
Uploading Policies #
Before deploying your application to OCI, it is necessary to create policies that allow access from the execution environment (such as a Compute Instance or Kubernetes Cluster) to other resources, for example, an Object Storage Bucket. Oracle Cloud Assets automatically generates the required policies and you can upload them to the cloud compartment, while also providing a preview of the generated policies. You can access this feature by clicking the button. The policies can either be uploaded directly to OCI or viewed as a preview.
Building a Container Image #
The next step towards deploying to the cloud is building a container image, which will be then used to run the application on both a Compute Instance and Oracle Kubernetes Engine (OKE). Click the icon on the Container Repository line.
A prompt to enter an image tag will appear, pre-filled with the project version. You can modify it as needed. The container is then built and pushed to the repository. Alternatively, you can build a native image version of the container by invoking Build and Push Native Image container image from the container repository context menu.
It is also possible to delete the image tags or versions from within the Oracle Cloud Assets window (hover over the image name and click the delete icon). There is no need to do it manually from the OCI console.
Running the Application in the Cloud #
To deploy and run your application in the cloud, use the Run command located at the container image line. Click the icon next to the selected version. This action deploys the application to the selected execution environment.
Compute Instance #
When deployment to the Compute Instance is invoked, the configuration files are generated and uploaded to the remote host. If a previously running container exists, it is stopped before starting the new one in the background, using the updated configuration. The Output window displays the application’s output, enabling you to monitor its status.
Note that the CPU architectures of the remote host and your local machine should match.
A container runtime such as Rancher Desktop or Docker should be also installed and enabled on a remote host.
Oracle Kubernetes Engine (OKE) #
For deployments to the Oracle Kubernetes Engine (OKE), the configuration is first uploaded to the ConfigMap
resource.
Then, a new deployment with the same name as the application is created or updated, if it already exists.
Note that the Kubernetes configuration is retrieved from OCI, so there is no need to set it up locally.
Frequently Asked Questions #
What is the difference between using the Oracle Cloud Assets and OCI DevOps?
When using Oracle Cloud Assets, a project is developed and built on a local machine and deployed to the cloud. Unlike using OCI DevOps, when a project is built and deployed in the cloud.
Using Oracle Cloud Assets, the container image is built locally, so there is no need to commit and push changes to the source code repository. In contrast, OCI DevOps tools use a Build Pipeline, which pulls the code from the source code repository. This process requires the changes to be committed and pushed, adding a bit of extra time before your application is live in the cloud.
To summarize, Oracle Cloud Assets are recommended for development and testing purposes, while OCI DevOps tools are recommended for continuous integration and continuous deployment (CI/CD).