Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions docs-source/site/docs/deploy/buildapp.md

This file was deleted.

70 changes: 70 additions & 0 deletions docs-source/site/docs/deploy/buildpushapp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: Build and Push the application
sidebar_position: 3
---
## Build and Push the application

:::important
This content is TBD
:::

This section explains how to build and push the container image for deployment on OBaaS. The following are required:

- Access to a container image repository (e.g., OCIR or another approved registry)
- Docker running locally (and authenticated to your registry)

## Add JKube to the `pom.xml`

The image will be built using JKube and Maven. Add the following plugin into the `pom.xml` for the application.

The following needs to be updated to reflect your environment:

- Image configuration, a mandatory, unique docker repository name. This can include registry and tag parts, but also placeholder parameters. example below has the following value `region/tenancy/repository/phonebook:${project.version}`
- The base image which should be used for this image. In this example `ghcr.io/oracle/openjdk-image-obaas:21` is used.
- assembly, mode how the assembled files should be collected. In this example files are simple copied, `dir`
- cmd, A command to execute by default. in the example below `java -jar /deployments/${project.artifactId}-${project.version}.jar` will be executed.

Refer to the [documentation for JKube](https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/) for more configuration options.

```xml
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.18.1</version>
<configuration>
<images>
<image>
<name>sjc.ocir.io/maacloud/repository/phonebook:${project.version}</name>
<build>
<from>ghcr.io/oracle/openjdk-image-obaas:21</from>
<assembly>
<mode>dir</mode>
<targetDir>/deployments</targetDir>
</assembly>
<cmd>java -jar /deployments/${project.artifactId}-${project.version}.jar</cmd>
</build>
</image>
</images>
</configuration>
</plugin>
```

## Build and push the application

To build and push the application execute the following command:

```shell
mvn clean package k8s:build k8s:push
```

If the build and push is successful then you shuould get a message similar to this:

```log
[INFO] k8s: Pushed sjc.ocir.io/maacloud/phonebook/phonebook:0.0.1-SNAPSHOT in 4 minutes and 2 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:07 min
[INFO] Finished at: 2025-09-24T12:18:53-05:00
[INFO] ------------------------------------------------------------------------
```
175 changes: 175 additions & 0 deletions docs-source/site/docs/deploy/dbaccess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
title: Application Database Access
sidebar_position: 2
---
## Application Database Access

:::note
This step is only necessary if your application is connecting to a database.
:::

If your application needs database access, first obtain the database user credentials. Then create a Kubernetes secret containing those credentials. The secret is referenced in your application deployment.

### Create the secret for the application

Create a secret with database access information. This secret is used by the application configuration and is injected during deployment.

For example if you have the following information:

- name: `Your database name`. For example `helmdb`
- username: `Your database user name`. For example `phonebook`
- password: `Your database user password`. For example `Welcome-12345`
- service: `Your servicename`. For example `helmdb_tp`

Create a Kubernetes secret (in this example, `phonebook-db-secrets` in the `obaas-dev` namespace):

```bash
kubectl -n obaas-dev create secret generic phonebook-db-secrets \
--from-literal=name=helmdb \
--from-literal=username=phonebook \
--from-literal=password=Welcome-12345 \
--from-literal=service=helmdb_tp
```

You can verify the values by running the following command (this is for the `username` value):

```bash
kubectl -n obaas-dev get secret phonebook-sb-secrets -o jsonpath='{.data.username}' | base64 -d
```

### Create database user using `sqljob.yaml` k8s job

Use this job to run SQL statements against the database with the credentials stored in the secret above.

Set the namespace to where the `obaas-db-secret` secret resides (example uses `obaas-dev`):

```yaml
metadata:
generateName: sqlcl-runner-job-
namespace: obaas-dev
```

Update the `args:` section with your SQL:

```yaml
args:
- |
export TNS_ADMIN=/etc/oracle/wallet

# Create the SQL script inline
cat > /tmp/run.sql << 'EOF'
SET SERVEROUTPUT ON;
WHENEVER SQLERROR EXIT SQL.SQLCODE;

<<SQL STATEMENTS>>

EXIT;
EOF

# Execute the SQL script
sql $(DB_USER)/$(DB_PASSWORD)@$(TNS_ALIAS) @/tmp/run.sql
```

Update the `env:` section to reference the correct secret and keys (here using `obaas-db-secrets`):

```yaml
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.password
- name: TNS_ALIAS
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.service
```

Set the TNS Admin wallet secret name to match your OBaaS installation:

```yaml
volumes:
- name: db-wallet-volume
secret:
secretName: obaas-adb-tns-admin-1
```

Execute `kubectl create -f sqljob.yaml` to create the kubernetes job.

```log
job.batch/sqlcl-runner-job-2vcrq created
```

You can verify that the Job ran successfully by checking its logs.

#### Example `sqljob.yaml`

This is an example of a kubernetes job that creates a `phonebook` user and assigns roles to the user.

```yaml
# The Job to run the SQLcl container with embedded SQL
apiVersion: batch/v1
kind: Job
metadata:
generateName: sqlcl-runner-job-
namespace: obaas-dev
spec:
backoffLimit: 2
template:
spec:
restartPolicy: Never
containers:
- name: sqlcl-container
image: container-registry.oracle.com/database/sqlcl:latest
command: ["/bin/sh", "-c"]
args:
- |
export TNS_ADMIN=/etc/oracle/wallet

# Create the SQL script inline
cat > /tmp/run.sql << 'EOF'
SET SERVEROUTPUT ON;
WHENEVER SQLERROR EXIT SQL.SQLCODE;

create user if not exists phonebook identified by "Welcome-12345";
grant db_developer_role to phonebook;
grant unlimited tablespace to phonebook;
commit;

/
EXIT;
EOF

# Execute the SQL script
sql $(DB_USER)/$(DB_PASSWORD)@$(TNS_ALIAS) @/tmp/run.sql
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.username
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.password
- name: TNS_ALIAS
valueFrom:
secretKeyRef:
name: obaas-db-secret
key: db.service
volumeMounts:
- name: db-wallet-volume
mountPath: /etc/oracle/wallet
readOnly: true
volumes:
- name: db-wallet-volume
secret:
secretName: obaas-adb-tns-admin-1
```
61 changes: 61 additions & 0 deletions docs-source/site/docs/deploy/deployapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,64 @@ sidebar_position: 4
:::important
This content is TBD
:::

## Modify the `Chart.yaml`

Modify the `Chart.yaml` file to reflect your application.

```yaml
apiVersion: v2
name: <your application name> # Replace with your application name
```

## Modify the `values.yaml`

Modify the `values.yaml` file to match your application’s requirements—for example, set image.repository and pullPolicy, configure a service account, enable ingress, define resources and autoscaling, and specify volumes and volumeMounts etc.

The `obaas` section is unique for Oracle Backed for Microservices and AI. It has the following settings:

```yaml
obaas:

# Framework selection: SPRING_BOOT or HELIDON
framework: SPRING_BOOT

namespace: obaas-dev
database:
credentialsSecret: phonebook-db-secrets
walletSecret: obaas-adb-tns-admin-1

# Opentelemetry monitoring
otel:
enabled: true

# MicroProfile LRA
mp_lra:
enabled: false

# Spring Boot applications
springboot:
enabled: true

# Eureka discovery
eureka:
enabled: true
```

- OBaaS supports both `SPRING_BOOT` or `HELIDON`. This is set via the `obaas.framework` parameter.
- When `otel.enabled` is true, the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable is set to the appropriate value and injected into the deployment for application use. This is the URL of the OpenTelemetry (OTLP protocol) collector which can be used by your application to send observability data to the the SigNoz platform.
- When `mp_lra.enabled` is true, the following environment variables are set to the appropriate value and injected into the deployment for application usee:
- `MP_LRA_COORDINATOR_URL` This is the URL for the *transaction manager* which is required when using Eclipse Microprofile Long Running Actions in your application.
- `MP_LRA_PARTICIPANT_URL` This is the *participant* URL which is required when using Eclipse Microprofile Long Running Actions in your application.
- When `springboot.enabled` is true, the following environment variables are set to the appropriate value and injected into the deployment for application use:
- `SPRING_PROFILES_ACTIVE` This sets the Spring profiles that will be active in the application. The default value is `default`.
- `SPRING_DATASOURCE_URL` This sets the data source URL for your application to use to connect to the database, for example `jdbc:oracle:thin:@$(DB_SERVICE)?TNS_ADMIN=/oracle/tnsadmin`.
- `SPRING_DATASOURCE_USERNAME` Set to the value of the key `username` in secret you may have created for your application.
- `SPRING_DATASOURCE_PASSWORD` Set to the value of the key `password` in secret you may have created for your application.
- `DB_SERVICE` Set to the value of the key `service` in secret you may have created for your application.
- When `eureka.enabled` is true, the following environment variables are set to the appropriate value and injected into the deployment for the application and the application will register with Eureka.
- `EUREKA_INSTANCE_PREFER_IP_ADDRESS`
- `EUREKA_CLIENT_REGISTER_WITH_EUREKA`
- `EUREKA_CLIENT_FETCH_REGISTRY`
- `EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE`
- `EUREKA_INSTANCE_HOSTNAME`
19 changes: 10 additions & 9 deletions docs-source/site/docs/deploy/introflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ sidebar_position: 1
This content is TBD
:::

This guide explains how to deploy an application to OBaaS using Eclipse [Eclipse JKube](https://eclipse.dev/jkube/) to build and push a container image, and Helm to install and configure the application on a Kubernetes cluster.
This guide explains how to deploy an application to OBaaS using Eclipse [Eclipse JKube](https://eclipse.dev/jkube/) to build and push a container image, and using Helm to install and configure the application on a Kubernetes cluster.

### Prerequisites

- Access to a container image repository (e.g., OCIR or another approved registry).
- Docker running locally (and authenticated to your registry)
- Kubernetes cluster access with the correct context set.
- Helm installed locally.
- Maven build configured for your project.

### High Level Installation Flow

Too deploy an application to OBaaS, you will follow this high-level flow:
To deploy an application to OBaaS, follow this high-level workflow:

- Obtain Image Repository metadata or Create the repository needed for the deployment.
- Add [Eclipse JKube](https://eclipse.dev/jkube/) to the pom.xml file.
- Build the Application using Maven.
- Obtain the deployment Helm chart.
- If you're using a database, create a secret with database credentials etc.
- Create the database application user using the 'sqljob.yaml' file. **Add to Helm dir with 'if' statement**
- Edit the `Chart.yaml` file to reflect the application name.
- Obtain image repository metadata or create the required repository.
- Configure database access and run the SQL job, if needed.
- Add Eclipse JKube to the pom.xml.
- Build and push the application with Maven.
- Retrieve the deployment Helm chart.
- Update Chart.yaml with the application name.
- Update values.yaml to match your configuration.
- Install the Helm chart.
23 changes: 0 additions & 23 deletions docs-source/site/docs/deploy/sqljob.md

This file was deleted.

Loading