Skip to content

Commit 0bd22c2

Browse files
authored
VM IaC Updates (#187)
* Make VM IaC install more robust * VM IaC Doco
1 parent 2a5ffe9 commit 0bd22c2

File tree

21 files changed

+176
-42
lines changed

21 files changed

+176
-42
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,14 @@ To run the application in a container; download the [source](https://github.com/
8585
1. [Configure](https://oracle-samples.github.io/ai-optimizer/client/configuration/index.html) the **AI Optimizer**.
8686

8787
#### Got OCI?
88-
The **AI Optimizer** can be deployed with an Oracle Autonomous Database 23ai using infrastructure as code. Deploy the **AI Optimizer** in Oracle Cloud Infrastructure using OCI Resource Manager:
8988

89+
The **AI Optimizer** can be deployed in Oracle Cloud Infrastructure (OCI) using Infrastructure as Code (IaC).
90+
91+
Choose either a light-weight Virtual Machine or robust Oracle Kubernetes Engine deployment, both with an Oracle Autonomous Database 23ai:
9092
[![Deploy to Oracle Cloud][magic_button]][magic_arch_stack]
9193

94+
For more information, please visit the [IaC Documentation](https://oracle-samples.github.io/ai-optimizer/advanced/iac/index.html).
95+
9296
## Contributing
9397

9498
This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md).

docs/content/advanced/iac.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
+++
2+
title = 'Infrastructure as Code'
3+
weight = 1
4+
+++
5+
6+
<!--
7+
Copyright (c) 2024, 2025, Oracle and/or its affiliates.
8+
Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
9+
10+
spell-checker: ignore opentofu Ollama
11+
-->
12+
13+
The {{< full_app_ref >}} can easily be deployed in Oracle Cloud Infrastructure (**OCI**) using Infrastructure as Code (**IaC**) provided in the source [opentofu](https://github.com/oracle-samples/ai-optimizer/tree/main/opentofu) directory.
14+
15+
Choose between deploying a light-weight [Virtual Machine](#virtual-machine) or robust [Oracle Kubernetes Engine (**OKE**)](#oracle-kubernetes-engine) along with the Oracle Autonomous Database for a fully configured {{< short_app_ref >}} environment, ready to use.
16+
17+
While the **IaC** can be run from a command-line with prior experience, the steps outlined here use [Oracle Cloud Resource Manager](https://docs.oracle.com/en-us/iaas/Content/ResourceManager/Concepts/resourcemanager.htm) to simplify the process. To get started:
18+
19+
{{< imagelink url="https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-samples/ai-optimizer/releases/latest/download/ai-optimizer-stack.zip" src="https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg" alt="Deploy to Oracle Cloud" >}}
20+
21+
## Virtual Machine
22+
23+
The Virtual Machine (VM) deployment provisions both the {{< short_app_ref >}} API Server and GUI Client together in an "All-in-One" configuration for experimentation and development. As part of the deployment, one local Large Language Model and one Embedding Model is made available out-of-the-box. However, as these models will be running on a CPU VM, their performance will be very poor.
24+
25+
### Configure Variables
26+
27+
After clicking the "Deploy to Oracle Cloud" button and authenticating to your tenancy; you will be presented with the {{< short_app_ref >}} stack information.
28+
29+
1. Review the Terms, tick the box to accept (if you do), and click "Next" to Configure Variables
30+
31+
![Stack Information](../images/iac_stack_information.png)
32+
33+
1. Change the Infrastructure to "VM"
34+
35+
![Stack - AI Optimizer](../images/iac_stack_optimizer.png)
36+
37+
#### Access Control
38+
39+
Most of the other configuration options are self-explanatory, but let's highlight those important for the **Security** of your deployment.
40+
41+
* The {{< short_app_ref >}} is often configured with authentication details for your OCI Tenancy, Autonomous Database, and API Keys for AI Models. Since these details are accessible via the Application GUI, access must be restricted to a limited set of CIDR blocks.
42+
43+
* The {{< short_app_ref >}} REST endpoints require API token authentication, providing some protection. However, you should still restrict access to a limited set of CIDR blocks where possible for added security.
44+
45+
* The Oracle Autonomous Database requires mTLS authentication with a wallet, providing strong initial protection. However, it's recommended to further restrict access to a limited set of CIDR blocks.
46+
47+
![Stack - Access Control](../images/iac_stack_access_control.png)
48+
49+
To restrict access, provide a comma-separated list of CIDR blocks, for example: `192.168.1.0/24,10.0.0.0/16,203.0.113.42/32`
50+
51+
In this example:
52+
* `192.168.1.0/24` – Allows access from all IPs in the range 192.168.1.0 to 192.168.1.255 (a typical subnet).
53+
* `10.0.0.0/16` – Allows access from 10.0.0.0 to 10.0.255.255 (a broader range).
54+
* `203.0.113.42/32` – Allows access from a single public IP address only. The /32 denotes a single host.
55+
56+
### Review and Apply
57+
58+
After configuring the variables, click "Next" to review and apply the stack.
59+
60+
![Stack - Review and Apply](../images/iac_stack_review_apply.png)
61+
62+
Tick the Apply box and click "Create".
63+
64+
### Job Details
65+
66+
The next screen will show the progress of the Apply job. Once the job has Succeeded, the {{< short_app_ref >}} has been deployed!
67+
68+
The Application Information tab will provide the URL's to access the {{< short_app_ref >}} GUI and API Server. In the "All-in-One" deployment on the VM, the API Server will only become accessible after visiting the GUI at least once.
69+
70+
![Stack - VM Application Information](../images/iac_stack_vm_info.png)
71+
72+
{{% notice style="code" title="502 Bad Gateway: Communication Breakdown!" icon="fire" %}}
73+
Although the infrastructure is deployed, the {{< short_app_ref >}} may still be initializing, which can result in a 502 Bad Gateway error when accessing the URLs. Please allow up to 10 minutes for the configuration to complete.
74+
{{% /notice %}}
75+
76+
To get a better understanding of how the API Server works and to obtain the API Key for making REST calls, review the [API Server documentation](client/api_server/).
77+
78+
### Cleanup
79+
80+
To destroy the {{< short_app_ref >}} infrastructure, in **OCI** navigate to `Developer Services` -> `Stacks`. Choose the Compartment the {{< short_app_ref >}} was deployed into and select the stack Name. Click on the "Destroy" button.
81+
82+
## Oracle Kubernetes Engine
83+
84+
{{% notice style="code" title="Documentation is Hard!" icon="circle-info" %}}
85+
More information coming soon... 11-June-2025
86+
{{% /notice %}}
67.2 KB
Loading
74.2 KB
Loading
34.9 KB
Loading
59.7 KB
Loading
27.4 KB
Loading
211 KB
Loading

docs/content/client/api_server/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Copyright (c) 2024, 2025, Oracle and/or its affiliates.
77
Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
88
-->
99

10-
The {{< full_app_ref >}} is powered by an API Server to allow for any client to access its features. The API Server can be run as part of the provided {{< short_app_ref >}} GUI client or as a separate, independent process.
10+
The {{< full_app_ref >}} is powered by an API Server to allow for any client to access its features. The API Server can be run as part of the provided {{< short_app_ref >}} GUI client (referred to as the "All-in-One" deployment) or as a separate, independent process.
1111

1212
Each client connected to the API Server, including those from the {{< short_app_ref >}} GUI client, share the same configuration but maintain their own settings. Database, Model, OCI, and Prompt configurations are used across all clients; but which database, models, OCI profile, and prompts set are specific to each client.
1313

14-
When started as part of the {{< short_app_ref >}} client, you can change the Port it listens on and the API Server Key. A restart is required for the changes to take effect.
14+
When started as part of the {{< short_app_ref >}} "All-in-One" deployment, you can change the Port it listens on and the API Server Key. A restart is required for the changes to take effect.
1515

1616
![Server Configuration](images/api_server_config.png)
1717

docs/content/client/configuration/model_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ weight = 10
66
Copyright (c) 2024, 2025, Oracle and/or its affiliates.
77
Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
88
9-
spell-checker:ignore ollama, mxbai, nomic, thenlper, minilm, uniqueid, huggingface, hftei, openai, pplx
9+
spell-checker:ignore ollama, mxbai, nomic, thenlper, minilm, uniqueid, huggingface, hftei, openai, pplx, genai, ocid, configfile
1010
-->
1111

1212
## Supported Models

0 commit comments

Comments
 (0)