|
| 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 | +  |
| 32 | + |
| 33 | +1. Change the Infrastructure to "VM" |
| 34 | + |
| 35 | +  |
| 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 | + |
| 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 | + |
| 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 | + |
| 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 %}} |
0 commit comments