> For the complete documentation index, see [llms.txt](https://docs.valohai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valohai.com/installation-and-setup/oracle-cloud-infrastructure/hybrid-deployment.md).

# Hybrid Deployment

Deploy Valohai workers and storage to your Oracle Cloud Infrastructure (OCI) tenancy while Valohai manages the application layer at app.valohai.com.

### What Gets Deployed

The Compute and Data Layer of Valohai can be deployed to your OCI tenancy. This enables you to:

* Use your own Compute instances to run machine learning jobs
* Use your own OCI storage for training artifacts (trained models, preprocessed datasets, visualizations)
* Access databases and data warehouses directly from workers inside your network

Valohai doesn't have direct access to the compute instances that execute machine learning jobs. Instead, it communicates with a Redis queue in your tenancy that's responsible for storing the job queue, job states, and short-term logs.

### Prerequisites

**From Valohai:**

* (Optional) `queue_address` - DNS name for your queue (e.g., `something.vqueue.net`)

**From your OCI account:**

* Admin access to your OCI tenancy
* A user for programmatic (API) access
* Region selected (consider Compute and GPU availability)
* Ability to run a small Compute instance for the Redis queue (set up in Step 1)

### Step 1: Set Up the Redis Queue

Valohai uses a Redis queue in your tenancy for job distribution. At a high level, you'll start an instance, open the required ports in your VCN security list, fix Ubuntu's software firewall, and start the Redis service.

**1. Create the instance**

Create a Compute instance on OCI using a standard Ubuntu image (version 22.04 or newer recommended).

**2. Open ports in the VCN**

Make sure the VCN's security list accepts ingress connections on ports `63790` (Redis) and `80` (Let's Encrypt HTTP challenge).

**3. Connect to the instance**

Use SSH to connect to the instance.

**4. Configure the software firewall**

Open the Redis port `63790` and port `80` for the ACME certbot challenge by adding the following lines to `/etc/iptables/rules.v4`, after the existing SSH rule (`-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT`):

```
-A INPUT -p tcp -m state --state NEW -m tcp --dport 63790 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
```

Apply the changes:

```shell
sudo iptables-restore < /etc/iptables/rules.v4
```

**5. Start Redis as a service**

Run the helper script, replacing `<redis_password>` and `<subdomain>` with your own values:

```bash
export PASSWORD=<redis_password>
export QUEUE=<subdomain>.vqueue.net
curl https://raw.githubusercontent.com/valohai/worker-queue/main/host/setup.sh | sudo QUEUE_ADDRESS=$QUEUE REDIS_PASSWORD=$PASSWORD bash
```

**Note:** Keep the subdomain and password — the resulting queue URL is the **Queue URL** you'll provide in [Step 3](https://claude.ai/chat/a7418587-161f-4bcd-a26a-f86cb9cbc571#step-3-define-compute-configuration).

> :bulb:Using the \<subdomain>.vqueue.net DNS name provided by Valohai is optional. You can also use your own one. In this case, make sure to let your Valohai contact know which one you used.

**6. Check the service status**

```shell
sudo systemctl status worker-queue
```

#### Test the Setup

> :bulb: If you used the vqueue.net DNS name provided by Valohai, before testing make sure to inform your contact about the public IP of the queue machine.

From your local machine, connect to the queue and send a `PING`:

```shell
redis-cli -u rediss://default:<redis_password>@<subdomain>.vqueue.net:63790
PING
```

A `PONG` response confirms the queue is reachable.

### Step 2: Prepare Your OCI Credentials

Collect the following details for the user Valohai will use to connect to and scale your OCI compute.

For detailed instructions on how to find these values, refer to [OCI's documentation on required keys and OCIDs](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#Required_Keys_and_OCIDs).

* **User OCID** – The OCID of the user that will make API calls (starts with `ocid1.user.oc1..`).
* **Fingerprint** – The fingerprint of the public key associated with the user.
* **Private Key** – The private key file or its contents.
* **Passphrase** – The passphrase for the private key, if it is encrypted.
* **Tenancy OCID** – The OCID of your tenancy (starts with `ocid1.tenancy.oc1..`).
* **Region** – Your OCI region, for example `eu-stockholm-1`. See [OCI Regions](https://docs.oracle.com/iaas/Content/General/Concepts/regions.htm) for reference.

**Important:** The private key and its passphrase are sensitive credentials. Share them with your Valohai contact using your organization's secure communication method (for example, a password-protected document or encrypted email) — never in plain text.

### Step 3: Define Compute Configuration

Specify the compute environment you want to use with Valohai. Provide the following details for each environment.

#### Required Settings

* **Compartment OCID** – The compartment under which instances will be created.
* **Shapes** – The instance types you want to use. For flexible shapes, also include the desired CPU and memory configuration.
* **Disk Size** – Size of the root volume in GB.
* **Queue URL** – A Redis queue URL used for job distribution, format:

```
rediss://:<redis_password>@<subdomain>.vqueue.net:63790
```

* **Subnet OCID** – The subnet the instances should connect to.

#### Optional Settings

* **Freeform Tags** – Any additional tags you'd like to attach to the instances.
* **Image** – Either the OCID of a custom image or the desired OS and version. By default, Valohai uses the latest supported Ubuntu image.
* **SSH Public Key** – A public key for optional SSH access.
* **Disable Public IP** – Indicate if a public IP should not be assigned. By default, one is assigned.

### Summary

Collect the following information to send to Valohai.

**Credentials:**

* User OCID: `____________`
* Fingerprint: `____________`
* Private Key: `____________`
* Passphrase (if encrypted): `____________`
* Tenancy OCID: `____________`
* Region: `____________`

**Compute Configuration:**

* Compartment OCID: `____________`
* Shapes (and CPU/memory for flexible shapes): `____________`
* Disk Size (GB): `____________`
* Queue URL: `____________`
* Subnet OCID: `____________`

**Optional:**

* Freeform Tags: `____________`
* Image (OCID or OS/version): `____________`
* SSH Public Key: `____________`
* Disable Public IP (yes/no): `____________`

Share this information with your Valohai contact using your organization's secure communication method.

### Next Steps

After Valohai confirms your environment is configured:

**1. Verify the setup**

* Log in to app.valohai.com
* Check that OCI environments appear in your organization
* Run a simple execution to verify workers launch correctly

**2. Configure additional resources**

* Add existing [OCI storage as data stores](/data/configure-data-stores/oracle-bucket-storage.md)
* Set up [private Docker registries](/docker-in-valohai/private-docker-registries.md)
* Configure access to your databases

### Getting Help

**Valohai Support:** <support@valohai.com>

**Include in support requests:**

* Tenancy OCID
* Region
* Error messages or logs
* Steps already attempted


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.valohai.com/installation-and-setup/oracle-cloud-infrastructure/hybrid-deployment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
