# Your first config

If you followed the [quickstart](https://ampbase.io/docs/quickstart.md), you have an agent connected and reporting healthy. The next thing worth doing is replacing the on-disk config it started with — and watching the live reload happen.

This walkthrough takes about five minutes.

## 1. Open the channel's Configurations page

In the UI, navigate to your channel and click **Configurations**. New channels show an empty state with three step-cards (create → version → deploy); click **New config**.

## 2. Author the config

Pick the agent type that matches your fleet — `otelcol`, `fluent-bit`, `vector` or `telegraf`. Give the configuration a name (e.g. `edge-collector`) and paste in the agent's config body.

Refinery reads a config file and a rules file together, so a Refinery configuration holds both, as two [files](https://ampbase.io/docs/configurations.md) named `refinery_config` and `refinery_rules`. The channel's **Get started** page writes both for you; after that, you edit either on the configuration's page and save them as one version.

For an OpenTelemetry Collector starter:

```yaml
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  batch:
    timeout: 5s
    send_batch_size: 1000

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [debug]
```

Save. Ampbase validates the config against the agent's schema before persisting, so a typo here gets flagged immediately rather than after deploy.

## 3. Deploy this version

Saving creates version 1. The version is **current** but not yet **deployed** — agents are still on whatever they booted with. Click **Deploy this version**.

The deploy sheet offers two ways to ship it. With one agent connected, pick **Broadcast now** and click **Broadcast and set default**: your first configuration becomes the channel default at this version, and every connected agent picks it up on its next OpAMP message.

On a real fleet, leave **Staged rollout** selected instead. Ampbase ships the version to a first stage — `10, 50, 100` percent by default, or through the values of a label such as `env` — and widens to the next stage only once the agents on it report the version applied and healthy. When a version needs build components, it can only judge agents whose supervisor reports theirs; see [Rollouts](https://ampbase.io/docs/rollouts.md), under **What automatic judgement needs from your fleet**.

## 4. Watch the agent reload

Switch back to **Agents**. Within a second or two, your agent's row updates:

- `config_hash` changes to the new version's hash.
- The agent's status stays `HEALTHY` once the supervisor has written the file, sent SIGHUP, and the post-apply health check passes.
- If the agent fails its health check, the supervisor reverts to the previous config and the status flips to `DEGRADED` with the reason shown.

You can verify on the host too. The supervisor logs:

```
INFO  config_apply  hash=01HJK… bytes=412  result=applied
INFO  health_check  status=healthy
```

## 5. Iterate

Edit the configuration again, save — that's version 2. The current pointer moves; the deployed pointer doesn't. Diff the two versions from the UI, deploy when you're ready.

To roll back: open the version list, click **Deploy this version** on an earlier version, choose **Broadcast now**, then click **Broadcast now**: the channel default already follows this configuration, so only its broadcast moves. Same primitive, opposite direction. (A staged rollout that is still in progress has its own **Roll back** button.)

## Going further

- [Rollouts](https://ampbase.io/docs/rollouts.md) — ship the next version in stages, each judged before the next.
- [Routing](https://ampbase.io/docs/routing.md) — keep a region or a team on its own version, or A/B two configs.
- [Configurations](https://ampbase.io/docs/configurations.md) — files, versioning, validation rules.
- [Webhooks](https://ampbase.io/docs/webhooks.md) — notify your incident channel when a deploy lands.
