Skip to content

Commit 7812907

Browse files
Merge branch 'main' into dependabot/pip/cloud-infrastructure/ai-infra-gpu/ai-infrastructure/rag-langchain-vllm-mistral/files/transformers-4.48.0
2 parents f6ac97c + 234a475 commit 7812907

File tree

122 files changed

+3875
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+3875
-244
lines changed

app-dev/devops-and-containers/devops/ansible-jenkins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ can eventually be modified or forked.
1818

1919
Although these limitations might not fit every use case, the code can be used as a reference and there are ways to lift them.
2020

21-
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/raw/main/app-dev/devops/ansible-jenkins/ansible-jenkins-rm.zip)
21+
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/raw/main/app-dev/devops-and-containers/devops/ansible-jenkins/ansible-jenkins-rm.zip)
2222

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
SOFTWARE.
3737
-->
3838

39-
# Terraform Stack to be used in OCI Resource Manager to create OCI DevOps pipelines for OCI Functions
39+
# OCI Resource Manager Terraform Stack to create OCI DevOps CI/CD pipelines for OCI Functions
4040

4141
Reviewed: 11.2.2025
4242

@@ -50,24 +50,45 @@ The DevOps project is not specific to any programming language but includes <a h
5050

5151
# How to use this asset?
5252

53-
Clone this repo locally. In OCI Console click <code>Create Stack</code> under <code>Resource Manager</code> in your project compartment. Drag-n-drop the <a href="./files">files -folder</a> to <code>Stack Configuration</code> (<b>folder type</b>).
53+
Clone this repo locally. In OCI Console click <code>Create Stack</code> under <code>Resource Manager</code> in your project compartment. Drag-n-drop the <a href="./files">files</a> -folder to <code>Stack Configuration</code> (<b>folder type</b>) or click this button below to create the stack on your OCI tenancy:
54+
55+
<p>
56+
57+
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/latest/devops-tf-stack.zip)
58+
59+
<p>
60+
Note! OCI DevOps <code>IAM Policies</code> are not part of the stack, please refer to <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/devops_iampolicies.htm">docs</a> how to create them before running the devops project pipelines.
61+
<p>
62+
63+
### Stack settings
64+
65+
Creating the stack in OCI Resource Manger fill in the vars:
66+
67+
![Stack](./files/stack.jpg)
68+
69+
<ul>
70+
<li><i>initial_image</i> that is used to create the OCI Function as target environment for the OCI DevOps deployment pipeline.
71+
By default it is loaded from Dockerhub, but you can use any X86 arch image if want to replace this</li>
72+
<li><i>docker_user</i> is your OCIR Docker user to push the initial image (above) to OCIR repo for the Function. Replace &lt;namespace&gt; with your <code>tenancy namespace</code>. <code>oracleidentitycloudservice</code> is only used for federated domains/users, not local</li>
73+
<li><i>docker_password</i> is an <code>auth token</code> in your OCI user profile, <i>create one for this</i></li>
74+
</ul>
75+
76+
Docker credentials are only used during the DevOps project creation to push the initial Function image and the DevOps project won't need them after it's been created by Terraform. <i>Hence, you can delete the auth token from your profile after the stack has been run.</i>
5477
<p>
55-
OCI DevOps IAM Policies are not part of the stack, please refer to <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/devops_iampolicies.htm">docs</a> how to create them first.
78+
79+
After creation run Stacks's Apply to create the OCI DevOps project.
80+
<p>
81+
The Stack creates only a <i>private subnet</i> in the VCN and hence the Function cannot be called outside the tenancy by default after the build and deploy.
5682
<p>
57-
Important! Before running the stack it is manadatory to create the OCI Registry repository for the OCI Function container and upload a dummy X86 architecture container to it. The <b>name</b> of the OCIR repo needs to match to the <code>image_name</code> of the Stack variables e.g. <b>helloworldai-java</b>. The image tag must be '<b>1</b>'.
58-
<br>
59-
This can by done by doing the following in OCI Cloud Shell (assuming the image name is 'helloworldai-java'):
83+
However, the Function invocation can be done from <code>OCI Cloud Shell</code> either by connecting to the <b>VCN private subnet</b> or to <b>OCI Service Network</b>, both options will work. The invocation can be done as follows using the Stack <code>project_name</code> e.g. :
6084
<pre>
61-
oci artifacts container repository create --display-name helloworldai-java --compartment-id ocid1.compartment.oc1.....gq
62-
docker pull hello-world
63-
docker tag hello-world fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/helloworldai-java:1
64-
docker push fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/helloworldai-java:1
85+
fn invoke helloworldai-java helloworldai-java
6586
</pre>
66-
Unless doing this the Stack will run into an error:
87+
88+
Since the stack creates the DevOps project with a target Function with the intial image it should already run and return:
6789
<pre>
68-
Error: 400-InvalidParameter, Invalid Image fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/&lt;image_name&gt:1 does not exist or you do not have access to use it
90+
Hello, world!
6991
</pre>
70-
After doing this the Stack can be run to create the OCI DevOps project. After the project creation the build pipelines can be run to build and deploy the OCI Function with real Function code.
7192

7293
# Useful Links
7394

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/artifacts.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
resource oci_artifacts_container_configuration export_container_configuration {
44
compartment_id = var.compartment_ocid
5-
is_repository_created_on_first_push = "true"
5+
is_repository_created_on_first_push = "false"
66
}
77

88
resource oci_artifacts_container_repository export_project {
99
compartment_id = oci_artifacts_container_configuration.export_container_configuration.compartment_id
1010

11-
display_name = "${var.project_name}-image"
11+
display_name = "${var.image_name}"
1212
freeform_tags = {
1313
}
1414
is_immutable = "false"
1515
is_public = "false"
16+
provisioner "local-exec" {
17+
command = "docker login ${var.registry} -u '${var.docker_user}' -p '${var.docker_pwd}' && docker pull ${var.initial_image} && docker tag ${var.initial_image} ${var.registry}/${data.oci_objectstorage_namespace.tenancy_namespace.namespace}/${var.image_name}:1 && docker push ${var.registry}/${data.oci_objectstorage_namespace.tenancy_namespace.namespace}/${var.image_name}:1"
18+
}
1619
}

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/build_pipeline_specs/build_spec_native.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ steps:
1212
echo "Build ID: $buildId"
1313
- type: Command
1414
command: |
15-
# This replaces the default open-jdk
16-
export GRAALVM_VERSION="21"
17-
export JAVA_VERSION="17"
18-
yum -y install graalvm${GRAALVM_VERSION}-ee-${JAVA_VERSION}-jdk;
19-
export JAVA_HOME=/usr/lib64/graalvm/graalvm${GRAALVM_VERSION}-ee-java${JAVA_VERSION};
20-
java -version
21-
22-
mvn clean install
23-
2415
docker build -f Dockerfile.native -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME} .
2516
docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:$buildId
2617
outputArtifacts:

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/devops.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ resource oci_devops_build_pipeline_stage export_build {
402402
build_pipeline_stage_type = "BUILD"
403403
build_runner_shape_config {
404404
build_runner_type = "CUSTOM"
405-
memory_in_gbs = "512"
406-
ocpus = "8"
405+
memory_in_gbs = "8"
406+
ocpus = "2"
407407
}
408408
build_source_collection {
409409
items {

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/functions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ resource oci_functions_function export_project_2 {
4040
trace_config {
4141
is_enabled = "false"
4242
}
43+
depends_on = [oci_artifacts_container_repository.export_project]
4344
}
44-
124 KB
Loading

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/vars.tf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ variable region { default = "eu-frankfurt-1" }
22
variable registry { default = "fra.ocir.io" }
33
variable compartment_ocid { }
44
variable project_name {
5-
default = "helloworldai-java-project"
5+
default = "helloworldai-java"
66
description = "Name of the OCI DevOps project and related resources"
77
}
88
variable image_name {
9-
default = "helloworldai-java"
10-
description = "Name of the Docker image in OCIR. Important! Create/Push this into the OCIR repo for this before running this Stack, otherwise the stack will fail due to empty image in the function definition You can do this in OCI Cloud Shell using hello-world image from Docker Hub and then tagging and pushing it accordingly."
9+
default = "helloworldai"
10+
description = "Name of the image that is built by the pipelines and deployed in the target OCI Function"
11+
}
12+
variable docker_user {
13+
description = "Your docker user to login OCIR to create the initial Function image"
14+
}
15+
variable docker_pwd {
16+
description = "Your docker password (auth token) to login OCIR to create the initial Function image"
17+
}
18+
variable initial_image {
19+
default = "docker.io/mikarinneoracle/hello-world-java-graalvm"
20+
description = "Intial native X86 Hello-world public image that is used to deploy the initial OCI Function"
1121
}

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,35 @@ This example is based on the <a href="../java-helloworld-with-local-dev-and-oci-
5353

5454
<p>
5555

56-
To do the OCI SDK authentication and authorization to use the GenAI services the function uses two options:
56+
To do the OCI SDK authentication and authorization to use the GenAI services the function has three options:
5757
<ul>
58-
<li><b>IAM regular user</b> for the local dev and test on mac (lines 79-84 in HelloAIFunction.java)</li>
59-
<li><b>ResourcePrincipal</b> for the OCI Function</li>
58+
<li><b>ResourcePrincipal</b> for the OCI Function to run in OCI. This allows Function to be authorized as part of
59+
a OCI Dynamic Group that has OCI Policies attached to for the Function to do it's job.</li>
60+
<li><b>IAM regular user</b> for the local dev and test on mac and passing the vars in source code (lines 79-84 in HelloAIFunction.java). This works for testing locally but the container should not be distributed!</li>
61+
<li><b>IAM regular user</b> for the local dev and test on mac using OCI CLI config file (usually located in ~/.oci). Again, this works for testing locally but the container should not be distributed!</li>
6062
</ul>
6163

6264
<p>
6365
IAM user option will work on both cases above, as local and as OCI Function. ResourcePrincipal is the default for OCI Function.
66+
<p>
6467

6568
## Build and test
6669

6770
Following the steps of the <a href="../java-helloworld-with-local-dev-and-oci-functions">Hello function example </a> adjust the <a href="https://github.com/oracle-devrel/technology-engineering/blob/main/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java#76">line 76</a> to match your <code>compartment OCID</code> and the <a href="https://github.com/oracle-devrel/technology-engineering/blob/main/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java#77">line 77</a> to match your <code>GenAI service model OCID</code>.
6871

6972
<p>
7073

74+
To use <code>.oci config</code> for testing locally replace the contents of Dockerfile with the contents from <a href="Dockerfile.local_oci">Dockerfile.local_oci</a>. Then copy your <code>~/.oci</code> -directory under the project root and build the Function with Fn:
75+
76+
<pre>
77+
fn --verbose deploy --app hellofunction --local
78+
fn invoke hellofunction helloaifunc
79+
</pre>
80+
81+
<i>Note! Do not distribute this container since it contains your OCI credentials. Use this only for local testing purposes.</i>
82+
83+
<p>
84+
7185
Testing with curl (or copy-pasting the API Gateway deployment url to a browser):
7286

7387
<p>

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ RUN ["mvn", "package"]
88
FROM fnproject/fn-java-fdk:jre17-1.0.187
99
WORKDIR /function
1010
COPY --from=build-stage /function/target/*.jar /function/app/
11-
CMD ["com.example.HelloAIFunction::handleRequest"]
11+
CMD ["com.example.fn.HelloFunction::handleRequest"]

0 commit comments

Comments
 (0)