Skip to content

Commit 3f7cd57

Browse files
Oracle Backend for Spring Boot and Microservices - Docs (#762)
* Oracle Backend for Spring Boot and Microservices: VS Code docs update * obaas-cli update with graalvm commands * fix to obass-cli docs * fixed after reviewed * last fixes * Rhonda fixes * More Rhonda fixes * Rhonda fixes * Rhonda fixes * Rhonda fixes amn lower case microservice --------- Co-authored-by: Andy Tael <andy.tael@yahoo.com>
1 parent c8770ef commit 3f7cd57

File tree

1 file changed

+194
-17
lines changed
  • docs-source/spring/content/development/cli

1 file changed

+194
-17
lines changed

docs-source/spring/content/development/cli/_index.md

Lines changed: 194 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ Service Commands
6161
deploy: Deploy a service.
6262
```
6363

64-
An application is a namespace encompassing related Microservices. For example, a "cloudbank" application may have "banktransfer" and
65-
"frauddetection" Microservices deployed within it.
64+
An application is a namespace encompassing related microservices. For example, a "cloudbank" application may have "banktransfer" and
65+
"frauddetection" microservices deployed within it.
6666

67-
The `create` command results in the creation of an application namespace (Kubernetes *namespace*). The application namespace provides a mechanism for isolating groups of resources, especially the Microservices.
67+
The `create` command results in the creation of an application namespace (Kubernetes *namespace*). The application namespace provides a mechanism for isolating groups of resources, especially the microservices.
6868

69-
The `delete` command results in the delete of an application namespace (Kubernetes *namespace*) completely or a specific Microservice. <ins>**Be carefully**</ins> because it is not possible rollback the components deleted.
69+
The `delete` command results in the complete deletion of an application namespace (Kubernetes *namespace*) or for a specific microservice. Ensure that you want to completely delete the application namespace. You cannot rollback the components once deleted.
7070

7171
The `bind` command results in the automatic creation of a database schema for a given service or user and binds the information for that schema or
72-
database in the environment of the Microservice. The option of a prefix for the bound environment properties is also returned. For example, most
73-
Spring Boot Microservices use `spring.datasource`.
72+
database in the environment of the microservice. The option of a prefix for the bound environment properties is also returned. For example, most
73+
Spring Boot microservices use `spring.datasource`.
7474

7575
The `deploy` command takes `service-name`, `app-name`, and `artifact-path` as the main arguments (`image-version` and `java-version` options are
76-
also provided). When the `deploy` command is issued, the Microservice JAR file is uploaded to the backend and a container image is created for
77-
the JAR or Microservice, and various Kubernetes resources such as **Deployment** and **Service** are also created. This is all done
78-
automatically to simplify the development process and the management of the Microservices by the backend.
76+
also provided). When the `deploy` command is issued, the microservice JAR file is uploaded to the backend and a container image is created for
77+
the JAR or microservice, and various Kubernetes resources such as **Deployment** and **Service** are also created. This is all done
78+
automatically to simplify the development process and the management of the microservices by the backend.
7979

80-
The `list` command shows the details of the deployed Microservice.
80+
The `list` command shows the details of the deployed microservices.
8181

8282
The `config` command can also be used to add, view, update, and delete configurations managed by the Spring Cloud Config server.
8383

@@ -113,7 +113,7 @@ The following is an example development workflow using the CLI:
113113
obaas-cli: Successful connected.
114114
```
115115

116-
2. Use the `create` command to create an application namespace (Kubernetes *namespace*). The application namespace provides a mechanism for isolating groups of resources, especially the Microservices. Names of resources need to be unique within a application namespace, but not across application namespaces.
116+
2. Use the `create` command to create an application namespace (Kubernetes *namespace*). The application namespace provides a mechanism for isolating groups of resources, especially the microservices. Names of resources need to be unique within a application namespace, but not across application namespaces.
117117

118118
```cmd
119119
oractl:>help create
@@ -141,10 +141,9 @@ The following is an example development workflow using the CLI:
141141
application/namespace created successfully and image pull secret (registry-auth) created successfully and database TNSAdmin/wallet secret created successfully
142142
```
143143

144+
3. Use the `delete` command to delete an application namespace (Kubernetes *namespace*) completely or a specific microservice inside an application namespace.
144145

145-
3. Use the `delete` command to delete an application namespace (Kubernetes *namespace*) completely or a specific Microservice inside an application namespace.
146-
147-
> ATTENTION: <ins>**Be carefully**</ins> because it is not possible rollback the components deleted.
146+
> ATTENTION: Ensure that you want to completely delete the application namespace. You cannot rollback the components once deleted.
148147
149148
```cmd
150149
oractl:>help delete
@@ -236,8 +235,8 @@ The following is an example development workflow using the CLI:
236235
Schema {myserv} was successfully updated and Kubernetes Secret {myapp/myserv} was successfully updated.
237236
```
238237
239-
5. Use the `deploy` command to create, build, and push an image for the Microservice and create the necessary deployment, service,
240-
and secret Kubernetes resources for the Microservice.
238+
5. Use the `deploy` command to create, build, and push an image for the microservice and create the necessary deployment, service,
239+
and secret Kubernetes resources for the microservice.
241240
242241
```cmd
243242
oractl:>help deploy
@@ -315,7 +314,7 @@ The following is an example development workflow using the CLI:
315314
creating deployment and service... successfully deployed
316315
```
317316

318-
6. Use the `list` command to show details of the Microservice deployed in the previous step. For example:
317+
6. Use the `list` command to show details of the microservice deployed in the previous step. For example:
319318

320319
```cmd
321320
oractl:>help list
@@ -560,3 +559,181 @@ The following is an example development workflow using the CLI:
560559
oractl:>config list --service-name myserv --service-profile obaas --service-label 0.1 --property-key ktest2
561560
400 : "Couldn't find any property for submitted query."
562561
```
562+
563+
8. Use the `GraalVM Compile Commands` to:
564+
565+
* Upload a **.jar** file to the Oracle Backend for Spring Boot and microservices and its GraalVM compiler service.
566+
* Start a compilation of your microservice to produce an executable native **.exec** file.
567+
* Retrieve the last logs available regarding a compilation in progress or terminated.
568+
* Download the **.exec** file to deploy on the backend.
569+
* Purge the files remaining after a compilation on the remote GraalVM compiler service.
570+
571+
The GraalVM Compile Commands are the following:
572+
573+
```cmd
574+
oractl:>help
575+
576+
GraalVM Compile Commands
577+
compile-download: Download the compiled executable file.
578+
compile: Compile a service with GraalVM.
579+
compile-purge: Delete a launched job.
580+
compile-logs: Compilation progress.
581+
```
582+
583+
1. Use the `compile` command to upload and automatically start compilation using the following command:
584+
585+
```cmd
586+
oractl:>help compile
587+
NAME
588+
compile - Compile a service with GraalVM.
589+
590+
SYNOPSIS
591+
compile [--artifact-path String] --help
592+
593+
OPTIONS
594+
--artifact-path String
595+
Service jar to compile location
596+
[Mandatory]
597+
598+
--help or -h
599+
help for compile
600+
[Optional]
601+
```
602+
603+
Because the compilation of a **.jar** file using the tool `native-image` does not support cross-compilation, it must be on the same platform where the application will run. This service guarantees a compilation in the same operating system and CPU type where the service will be executed on the Kubernetes cluster.
604+
605+
The Spring Boot application **pom.xml** with the plugin:
606+
607+
```xml
608+
<plugin>
609+
<groupId>org.graalvm.buildtools</groupId>
610+
<artifactId>native-maven-plugin</artifactId>
611+
</plugin>
612+
```
613+
614+
The project should be compiled on the developer desktop with GraalVM version 22.3 or later using an **mvn** command. For example:
615+
616+
```cmd
617+
mvn -Pnative native:compile -Dmaven.test.skip=true
618+
```
619+
620+
This pre-compilation on your desktop checks if there are any issues on the libraries used in your Spring Boot microservice. In addition, your executable **.jar** file must include ahead-of-time (AOT) generated assets such as generated classes and JSON hint files. For additional information, see [Converting Spring Boot Executable Jar](https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.advanced.converting-executable-jars).
621+
622+
The following is an example of the command output:
623+
624+
```cmd
625+
oractl:>compile --artifact-path /Users/cdebari/demo-0.0.1-SNAPSHOT.jar
626+
uploading: /Users/cdebari/demo-0.0.1-SNAPSHOT.jar
627+
filename: demo-0.0.1-SNAPSHOT.jar
628+
return: demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b
629+
return: Shell script execution started on: demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b
630+
successfully start compilation of: demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b
631+
oractl:>
632+
```
633+
634+
The following example shows the generated batch ID that must be used to retrieve the log files, download the compiled file, and purge the service instance:
635+
636+
**demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b**
637+
638+
If omitted, then the last batch is considered by default.
639+
640+
2. Use the `compile-logs` command to retrieve the logs that show the compilation progress. For example:
641+
642+
```cmd
643+
oractl:>help compile-logs
644+
NAME
645+
compile-logs - Compilation progress.
646+
647+
SYNOPSIS
648+
compile-logs --batch String --help
649+
650+
OPTIONS
651+
--batch String
652+
File ID returned from the compile command. If not provided by default, then the last file compiled.
653+
[Optional]
654+
655+
--help or -h
656+
help for compile-logs
657+
[Optional]
658+
```
659+
660+
As previously mentioned, if the batch ID is not provided, then the logs of the most recently executed compilation are returned. For example:
661+
662+
```cmd
663+
oractl:>compile-logs
664+
665+
extracted: BOOT-INF/lib/spring-jcl-6.0.11.jar
666+
extracted: BOOT-INF/lib/spring-boot-jarmode-layertools-3.1.2.jar
667+
inflated: BOOT-INF/classpath.idx
668+
inflated: BOOT-INF/layers.idx
669+
========================================================================================================================
670+
GraalVM Native Image: Generating 'demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b.exec' (executable)...
671+
========================================================================================================================
672+
For detailed information and explanations on the build output, visit:
673+
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
674+
------------------------------------------------------------------------------------------------------------------------
675+
```
676+
677+
If the `compile-logs` commands returns a **Finished generating** message, then download the **.exec** file. For example:
678+
679+
```cmd
680+
CPU: Enable more CPU features with '-march=native' for improved performance.
681+
QBM: Use the quick build mode ('-Ob') to speed up builds during development.
682+
------------------------------------------------------------------------------------------------------------------------
683+
155.3s (8.2% of total time) in 169 GCs | Peak RSS: 5.34GB | CPU load: 0.70
684+
------------------------------------------------------------------------------------------------------------------------
685+
Produced artifacts:
686+
/uploads/demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b.temp/demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b.exec (executable)
687+
========================================================================================================================
688+
Finished generating 'demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b.exec' in 31m 30s.
689+
Compiling Complete.
690+
```
691+
692+
3. Use the `compile-download` command to download the generated **.exec** file. For example:
693+
694+
```cmd
695+
oractl:>help compile-download
696+
NAME
697+
compile-download - Download the compiled executable file.
698+
699+
SYNOPSIS
700+
compile-download --batch String --help
701+
702+
OPTIONS
703+
--batch String
704+
File ID to download as the executable file. If not provided by default, then the last file compiled.
705+
[Optional]
706+
707+
--help or -h
708+
help for compile-download
709+
[Optional]
710+
```
711+
712+
You can choose to use the batch ID if you need the last file compiled. The following example specifies the batch ID:
713+
714+
```cmd
715+
oractl:>compile-download --batch demo-0.0.1-SNAPSHOT.jar_24428206-7d71-423f-8ef5-7d779977535b
716+
717+
File downloaded successfully to:
718+
/Users/cdebari/demo-0.0.1-SNAPSHOT.jar.exec
719+
```
720+
721+
4. Use the `compile-purge` command to delete all of the artifacts generated on the GraalVM compiler service after downloading the **.exec** file:
722+
723+
```cmd
724+
oractl:>help compile-purge
725+
NAME
726+
compile-purge - Delete a launched job.
727+
728+
SYNOPSIS
729+
compile-purge --batch String --help
730+
731+
OPTIONS
732+
--batch String
733+
File ID returned from compile command. If not provided by default, then the last file compiled.
734+
[Optional]
735+
736+
--help or -h
737+
help for compile-purge
738+
[Optional]
739+
```

0 commit comments

Comments
 (0)