# Getting started

# Getting started

Bring Drillmark up with Docker Compose, point it at one DMARC mailbox, and see the first parsed report in the dashboard.

## Prerequisites

- Docker 24+ with Compose v2.
- A Postgres-ready host. Drillmark ships its own Postgres 17 container in `compose.yml`; you can also point `DATABASE_URL` at an existing cluster.
- A Bunyip / mokosh-server OIDC provider you can register Drillmark against. Drillmark will not boot without it.
- An IMAP mailbox that already receives DMARC aggregate reports (usually a `dmarc@yourdomain` address with a published `_dmarc.yourdomain TXT "v=DMARC1; p=none; rua=mailto:dmarc@yourdomain"` record).
- A reverse proxy in front that terminates TLS and forwards to the api (port 8080) and the frontend (served by Caddy). The sample `compose.yml` uses Traefik.

## 1. Clone and copy env

```
git clone https://dev.a8n.run/psa-systems/drillmark.git
cd drillmark
cp .env.example .env
```

## 2. Fill in the minimum .env

Four blocks need values before the api will boot. Everything else has a safe default.

- Database: set `DATABASE_URL` and the `POSTGRES_PASSWORD` the sample `compose.yml` reads.
- Security: generate `ENCRYPTION_KEY` with `openssl rand -base64 32`. This key encrypts IMAP passwords and OAuth refresh tokens at rest. There is no online rotation: changing it invalidates every stored credential.
- Alert SMTP: fill `SMTP_HOST`, `SMTP_PORT`, `SMTP_SECURITY`, `SMTP_USERNAME`, `SMTP_PASSWORD`, `SMTP_FROM_ADDRESS`, `ADMIN_EMAIL` so detected alerts can be delivered.
- OIDC: all five `OIDC_ISSUER`, `OIDC_AUDIENCE`, `OIDC_CLIENT_ID`, `OIDC_SCOPES`, and either `OIDC_JWKS_URL` or the default derived from the issuer. Register Drillmark at your Bunyip instance as a public PKCE client first; see the inline comment in `.env.example` for the required `oauth_clients` row shape.

## 3. Bring the stack up

```
docker compose up --detach
docker compose logs --follow api
```

The api runs SeaORM migrations at startup. A migration failure is a boot failure; see [troubleshooting](/docs/drillmark/troubleshooting).

## 4. Add a data source

Sign in through the frontend at `https://${DOMAIN}/`. The sign-in link bounces to your Bunyip provider, back to Drillmark, and lands on the dashboard.

Open Settings, add a data source, and provide:

- A label (free text).
- The IMAP host, port, and SSL mode.
- The inbox credentials. The password is encrypted with `ENCRYPTION_KEY` before it reaches the database.
- The folder names Drillmark should use. See [data sources](/docs/drillmark/data-sources) for the folder layout.

## 5. Watch the first run

The incoming-queue job polls on `SCHEDULE_INCOMING_QUEUE` (default every 12 hours). To force a run without waiting, use the job runs screen in Settings, or bump the schedule to `0 */5 * * * * *` for the first run and revert once reports land.

A successful run writes one row per report to the jobs table and moves the email into the processed folder. Analytics in the main dashboard update as parsed records accumulate.
