HUB
Sign inSign up
dnsapi logo

dalbodeule/dnsapi

By dalbodeule

•Updated about 1 month ago

Image
Networking
API management
0

564

dalbodeule/dnsapi repository overview

⁠Cloudflare compatible PowerDNS API Server

Discord

A Kotlin and Spring Boot API that exposes Cloudflare-style zone and DNS record endpoints backed by PowerDNS and MariaDB. API requests use Authorization: Bearer <API_KEY>.

⁠Build and run

Use JDK 25. The Gradle wrapper selects the Java 25 toolchain for compilation.

./gradlew test bootJar
./gradlew bootRun

bootRun activates the dev profile. Supply the environment variables below before starting the app. Tests use an in-memory H2 database and do not require MariaDB or PowerDNS.

VariableDescription
DB_HOSTMariaDB host
DB_PORTMariaDB port, usually 3306
DB_NAMEDatabase name
DB_USERDatabase user
DB_PASSWORDDatabase password
PDNS_API_KEYPowerDNS HTTP API key
PDNS_API_URLPowerDNS HTTP API base URL, for example http://pdns:8081
PDNS_NSComma-separated nameservers, for example ns1.example.com,ns2.example.com

⁠Publish AMD64 and ARM64 images

The script builds a Linux native image for each architecture with Paketo Buildpacks, pushes the architecture-specific tags with Docker CLI credentials, then publishes a multi-platform manifest. Docker, Buildx, and a registry login with push access to the target repository are required. On a host with a different architecture, Docker must support emulation for the target platform.

./scripts/build-multiarch-image.sh 1.0.0

The default repository is ${DOCKER_USERNAME:-dalbodeule}/dnsapi. Set IMAGE_REPOSITORY to use another repository, such as git.mori.space/dalbodeule/dnsapi. The script publishes :1.0.0-amd64, :1.0.0-arm64, :1.0.0, and :latest; set PUBLISH_LATEST=0 to leave :latest unchanged. Review the commands without publishing by setting DRY_RUN=1.

If a previous run built an architecture image locally but failed while pushing, log in to the registry and rerun with RESUME=1. The script checks the local image architecture and skips its costly rebuild.

docker login --username dalbodeule
RESUME=1 ./scripts/build-multiarch-image.sh 1.0.0

⁠Update API documentation

./gradlew updateDocs

This task starts the app in a test context, writes the current OpenAPI 3.1 specification to openapi.json⁠, and refreshes the generated API section below. generateOpenApi and updateReadme are also available separately. The documentation task uses H2 and does not contact PowerDNS.

⁠API reference

Generated from openapi.json⁠. Do not edit this section by hand.

⁠Endpoints
MethodPathSummaryRequest bodySuccess response
GET/zonesGet all domains—200: ApiResponseDTOListDomainResponseDTO⁠
POST/zonesCreate domainDomainRequestDTO⁠200: ApiResponseDTODomainResponseDTO⁠
GET/zones/{cfid}Get domain—200: ApiResponseDTODomainResponseDTO⁠
DELETE/zones/{domain_id}Delete domain—200: ApiResponseDTODeleteResponseWithId⁠
GET/zones/{zone_id}/dns_recordsGet all records—200: ApiResponseDTOListRecordResponseDTO⁠
POST/zones/{zone_id}/dns_recordsAdd Record by IDRecordRequestDTO⁠200: ApiResponseDTORecordResponseDTO⁠
GET/zones/{zone_id}/dns_records/{dns_record_id}Get Record by ID—200: ApiResponseDTORecordResponseDTO⁠
PUT/zones/{zone_id}/dns_records/{dns_record_id}Update Record by IDRecordRequestDTO⁠200: ApiResponseDTORecordResponseDTO⁠
DELETE/zones/{zone_id}/dns_records/{dns_record_id}Remove Record by ID—200: ApiResponseDTODeleteResponseWithId⁠
⁠Schemas
⁠ApiResponseDTO
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
result—No—
⁠ApiResponseDTODeleteResponseWithId
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
resultDeleteResponseWithId⁠ or nullNo—
⁠ApiResponseDTODomainResponseDTO
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
resultDomainResponseDTO⁠ or nullNo—
⁠ApiResponseDTOListDomainResponseDTO
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
resultarray of DomainResponseDTO⁠ or nullNo—
⁠ApiResponseDTOListRecordResponseDTO
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
resultarray of RecordResponseDTO⁠ or nullNo—
⁠ApiResponseDTORecordResponseDTO
FieldTypeRequiredDescription
successbooleanNo—
errorsarray of ErrorOrMessage⁠No—
messagesarray of ErrorOrMessage⁠No—
resultRecordResponseDTO⁠ or nullNo—
⁠DeleteResponseWithId
FieldTypeRequiredDescription
idstringNo—
⁠DomainRequestDTO

Request DTO for Domain

FieldTypeRequiredDescription
namestringNoDomain name(TLD)
⁠DomainResponseDTO

Response DTO for Domain

FieldTypeRequiredDescription
idstringNoDomain CFID
namestringNoDomain name(TLD)
⁠ErrorOrMessage
FieldTypeRequiredDescription
codeintegerNo—
messagestringNo—
⁠RecordRequestDTO

Request DTO for Record

FieldTypeRequiredDescription
typestringNoRecord type
namestringNoHost name
valuestringNoRecord data
ttlintegerNoTTL (Time to Live)
priorityinteger or nullNoPriority
proxiedbooleanNoProxied: cloudflare api compatibility
commentstringNocomment
⁠RecordResponseDTO

Response DTO for Record

FieldTypeRequiredDescription
idstringNoRecord ID
typestringNoRecord type
namestringNoRecord name
contentstringNoRecord content
zoneIdstringNoZone(TLD) ID
zoneNamestringNoZone name(TLD)
createdOnstringNoRecord creation time
modifiedOnstringNoRecord modification time
priorityinteger or nullNoRecord priority
proxiablebooleanNois proxyable: must false
proxiedbooleanNois proxied: must false
ttlintegerNoRecord TTL
lockedbooleanNoRecord is locked: must false
commentstring or nullNoRecord comments
Tag summary
Recent tags
Content type
Image
Digest
sha256:8f97e4cd0…
Size
98.9 MB
Last updated
about 1 month ago
docker pull dalbodeule/dnsapi:latest