> ## Documentation Index
> Fetch the complete documentation index at: https://docs.use.observer/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy to Oracle Cloud

> A Resource Manager stack that runs the agent on a small VM in your own Oracle Cloud network.

The stack puts the Observer Agent on a small VM in a subnet you choose,
or in a new network of its own. From there the agent checks what that
subnet can reach, such as private databases, internal APIs and
Prometheus. It only makes outbound calls: the stack adds no inbound
rule. Your cloud's pricing applies to everything the stack creates.

[![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%3A%2F%2Fraw.githubusercontent.com%2Fuseobserver%2Fagent%2Fmain%2Fdeploy%2Foci%2Fobserver-agent-oci-stack.zip)

## What the stack creates

* A VM `observer-agent`: Ubuntu 24.04, shape `VM.Standard.A1.Flex` by
  default. Flex shapes get 1 OCPU and 2 GB of memory. Legacy instance
  metadata endpoints are turned off.
* With no subnet given, a network of its own: the VCN
  `observer-agent-vcn` (`10.250.0.0/24`) with an internet gateway, a
  route table, one public subnet and the security list
  `observer-agent-outbound-only`, which allows no inbound traffic.

At first boot, cloud-init runs the
[install script](https://docs.use.observer/agent/reference/install-script.md), which installs the
agent binary as the `observer-agent` systemd service.

In your own subnet the stack adds no rules: the subnet's security lists
and network security groups apply as they are. The agent opens no port
that needs an inbound rule.

> [!NOTE]
>
> **Where the key is stored**
>
> The key is in the instance metadata (the cloud-init user data). Users
> of your tenancy who can read the instance can read it. Resource
> Manager also keeps it in the stack's variables and Terraform state, so
> limit who can read the stack's compartment.

## Before you start

* Create the agent in Observer: **Agents**, **Add agent**, then
  **Cloud platforms**. Copy the key. Observer shows it once.
* To check private services, find their VCN and a subnet in it with
  outbound internet access: a public subnet with a public IP (the
  default), or a private subnet behind a NAT gateway with the public IP
  turned off.
* For the Always Free shapes, deploy in your tenancy's home region:
  Oracle only offers Always Free compute instances there.

## Form fields

| Field | Default | Notes |
| - | - | - |
| Agent key | | The key from Observer (`obs_live_...`). Required. |
| Observer address | `https://use.observer` | Leave as is. |
| Virtual cloud network (optional) | | The network of the services to check. Empty creates a network for the agent. |
| Subnet (optional) | | Shown once a network is picked. A subnet with outbound internet access. |
| Public IP for outbound traffic | on | Turn it off in a private subnet behind a NAT gateway. Nothing listens on it. |
| Shape | `VM.Standard.A1.Flex` | `VM.Standard.A1.Flex` (1 OCPU, 2 GB) and `VM.Standard.E2.1.Micro` fit the Always Free allowance. `VM.Standard.E5.Flex` does not. |
| Availability domain (optional) | the first one | Pick another when the first has no capacity for the shape. |

## Deploy

**1. Open the stack**

Choose **Deploy to Oracle Cloud** above and sign in. Resource Manager
opens **Create stack** with the template loaded. Check the region in
the console header, accept the Oracle terms of use, choose the
compartment and choose **Next**.

**2. Fill in the form**

Paste the key into **Agent key**. To check private services, pick their
**Virtual cloud network** and **Subnet**; leave both empty for a new
network. Choose a **Shape**, then **Next**.

**3. Create and apply**

On the review page, tick **Run apply** and choose **Create**. Resource
Manager creates the stack and runs an apply job. The job's outputs
show `instance_id` and `logs`.

> [!WARNING]
>
> **Out of host capacity**
>
> Always Free A1 capacity can run out. The apply job then fails with
> an "Out of host capacity" error. Edit the stack (**Edit**, **Edit
> stack**), pick another availability domain or the
> `VM.Standard.E2.1.Micro` shape, save, and run **Apply** again.
> `VM.Standard.E2.1.Micro` is offered in one availability domain per
> region: if the job says the shape is not available, pick another
> availability domain.

## Deploy with Terraform

The stack is plain Terraform. With the Terraform CLI and an OCI CLI
profile in `~/.oci/config`:

```bash theme={null}
git clone --depth 1 https://github.com/useobserver/agent observer-agent
cd observer-agent/deploy/oci
terraform init
terraform apply -var compartment_ocid=ocid1.compartment.oc1..xxxx \
  -var region=eu-frankfurt-1 -var agent_key="obs_live_..."
```

Add `-var subnet_id=...`, `-var assign_public_ip=false`,
`-var shape=VM.Standard.E2.1.Micro` or `-var availability_domain=...`
to change the other fields.

## Check that it connected

A few minutes after the apply job succeeds, the Add agent screen shows
**Connected** and the Agents page marks the agent as **running**. The
VM first boots, then downloads and installs the agent.

If it does not connect, start with the VM's boot output: open the
instance, then **Console history**, **Capture console history**. It
includes the cloud-init output, where the install script prints each
step. The usual cause of a failed install is a subnet without outbound
internet access.

To read the agent's own logs you need a shell on the VM. The stack adds
no SSH key and no inbound rule, so use the access your tenancy already
has, such as the OCI Bastion service or an SSH key with an ingress rule
you add. Then run the stack's `logs` output:

```bash theme={null}
sudo journalctl -u observer-agent -f
```

The agent logs every failed call to Observer with the reason. The most
common cause is a wrong or replaced agent key.

## Add settings and secrets

The agent reads its environment from `/etc/observer-agent/agent.env`.
To add a variable, such as `PROMETHEUS_SERVER_URL` or a secret that a
probe references by name (`connection_string_ref` and the like), edit
the file from a shell on the VM and restart the service:

```bash theme={null}
sudo vi /etc/observer-agent/agent.env
sudo systemctl restart observer-agent
```

After a [key rotation](https://docs.use.observer/agent/guides/rotate-agent-key.md), put the new
key in `AGENT_KEY` in the same file. See
[Environment variables](https://docs.use.observer/agent/reference/environment-variables.md) for
every setting.

## Upgrades

The stack installs the agent binary with the install script. To
upgrade, run the script again from a shell on the VM. It replaces the
binary, restarts the service, and keeps the key and your settings:

```bash theme={null}
curl -fsSL https://use.observer/install.sh | sh
```

To install a given release, add `-s -- --version <X.Y.Z>` after `sh`.

## Remove

In Resource Manager, open the stack and choose **Destroy**, then
confirm. When the destroy job succeeds, choose **More actions**,
**Delete stack**. With Terraform, run `terraform destroy` with the same
variables. Delete the agent in Observer (**Agents**) too if you no
longer need it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.