Files

31 lines
1.5 KiB
Markdown

# coredns-powerdns-api-wrapper Deployment
PowerDNS Authoritative API subset used by acme.sh `dns_pdns`, backed by the records table of the CoreDNS `mysql` plugin: [source/coredns-powerdns-api-wrapper](https://git.bjphoster.com/source/coredns-powerdns-api-wrapper).
Every `/api/v1` call requires `X-API-Key`. `/healthz` is an unauthenticated check that pings MySQL; `/version` reports the running version. The binary starts as root and drops to `PUID`/`PGID` itself, so the compose sets no `user:`. It keeps no local state and needs no volume.
## Requirements
- MySQL or MariaDB holding the plugin's `<prefix>records` table. The application never creates or alters it. `CPAW_TABLE_PREFIX` must match the plugin's `table_prefix`.
- A dedicated database user limited to the statements the service runs (`SELECT`, plus `DELETE` and `INSERT` inside one transaction per PATCH):
```sql
CREATE USER 'corednsapi'@'%' IDENTIFIED BY '<password>';
GRANT SELECT, INSERT, DELETE ON `coredns`.`coredns_records` TO 'corednsapi'@'%';
```
## Usage
```sh
cp env.example .env
# edit .env
docker compose up -d
```
`MYSQL_DSN` is built from the `CPAW_DB_*` variables. Wrap `CPAW_DB_PASSWORD` in single quotes in `.env` if it contains `$`, otherwise Compose interpolates it.
acme.sh connects with `PDNS_Url=https://pdnsapi.example.com`, `PDNS_ServerId` set to `CPAW_PDNS_SERVER_ID` and `PDNS_Token` set to `CPAW_PDNS_API_KEY`.
## Update
Set `CPAW_VERSION` in `.env`, then:
```sh
docker compose pull
docker compose up -d
```