# Native Postgres

For PostgreSQL installed directly on a server rather than in a container or a managed service, run
the collector as a container alongside it and add `node_exporter` on each database host.

This page assumes you have already created the database login and written `collector.toml` as
described in [Collector Installation](./overview.md).

## Running the collector

On a Docker host, with the config file in the current directory. `:latest` is convenient while you
are trying this out; for anything you intend to keep running, pin a release tag or a digest so a
restart cannot silently change the running version:

```bash
docker run --rm \
  -v "$PWD/collector.toml:/etc/dbg-collector/collector.toml:ro" \
  -e DBG_SERVER_SECRET="<secret from above>" \
  -e DB_PASSWORD="<your database password>" \
  dbgorillapublic.azurecr.io/dbg-collector:latest \   # pin a release tag in production
  --config-file /etc/dbg-collector/collector.toml
```

Because it is an ordinary container, it also runs under Docker Compose, or in Kubernetes. For
Kubernetes there is an official Helm chart at
`oci://dbgorillapublic.azurecr.io/charts/dbg-collector`, which takes the same `collector.toml` and
requires Kubernetes 1.25 or newer:

```bash
helm install dbg-collector oci://dbgorillapublic.azurecr.io/charts/dbg-collector \
  --namespace dbg-collector --create-namespace \
  --set-file config.inline=./collector.toml \
  --set secrets.serverSecret="<secret from above>" \
  --set-string secrets.databasePasswords.DB_PASSWORD="<your database password>"
```

The chart creates only core Kubernetes objects, with no operator and no custom resources, and its pod
meets the `restricted` Pod Security Standard, so it installs into a namespace that enforces it. The
container runs as non-root with a read-only root filesystem.

The requirements are the same everywhere: mount the configuration file, supply the variables it
references, and allow network access to your databases and their hosts plus egress to DBGorilla
over 443.

## node_exporter

`node_exporter` is an open-source Prometheus exporter that the collector reads host metrics from.
The collector discovers exporters automatically on the default port 9100 on your database hosts.
Where port 9100 is not exposed, set `mode = "disabled"` under `[component.provider.node_exporter]`
so the probe does not stall discovery.

It is owned by the Prometheus project and free to download from
[github.com/prometheus/node_exporter](https://github.com/prometheus/node_exporter). It is packaged
in EPEL for RHEL-based distributions, and runs under Docker with:

```bash
docker run -d \
  --net="host" \
  --pid="host" \
  -v "/:/host:ro,rslave" \
  quay.io/prometheus/node-exporter:latest \
  --path.rootfs=/host
```

With metrics flowing, DBGorilla is usable from the dashboard. To bring your team in, see
[Organization Management](../organization-management.md).