Skip to content

Deploy your DNS records from YAML config files to Porkbun

License

Notifications You must be signed in to change notification settings

jungaretti/bacon

Repository files navigation

Bacon 🥓

Bacon deploys your DNS records from YAML config files to Porkbun. You can use Bacon to deploy, backup, and restore your DNS records.

Demo of bacon deploy

Getting Started

You can use Bacon locally or in a GitHub Actions workflow. For local use, download the latest release from GitHub or build it yourself. For GitHub Actions, use the Bacon Deploy Action in your workflow.

Installation

Download the latest release from GitHub.

Status of release assets

Build it Yourself

  1. Install Bacon's prerequisites:
  2. Clone this repo and use make to build bin/bacon
  3. Authenticate with your DNS provider (see below)

Authentication

Sign into Porkbun and generate a new API keyset for your account. Read the "Generating API Keys" section of Porkbun's docs for more detailed instructions. Be sure to enable API access for the domain(s) that you would like to manage with Bacon.

Next, export the PORKBUN_API_KEY and PORKBUN_SECRET_KEY environment variables or add them to an .env file. Bacon uses these environment variables to authenticate with Porkbun. If the current directory contains an .env file, then Bacon will load its contents into environment variables. See .env.example for an example.

You can use bacon ping to check your authentication configuration.

Usage

Bacon offers a few commands to help you deploy and save your DNS records:

  • ping to double-check your API keys (stored in environment variables)
  • deploy <config> to deploy DNS records from a YAML config file
  • print <domain> to print your DNS records in YAML format

Commands

ping

Verifies your API keys by pinging Porkbun.

deploy <config>

Deploys records from a domain's config file by deleting unknown records and creating new records. Defaults to a dry-run mode that doesn't modify your DNS records.

Parameters
  • --delete disable dry-run deletions and delete outdated records
  • --create disable dry-run creations and create new records

print <domain>

Prints records for a domain in YAML format.

Notes

Use > to redirect output to a Bacon config file. For example, bacon print example.com > example.com.yml

Configuration

See config.example.yml for a complete example.

domain: example.com
records:
  - type: A
    host: blog.example.com
    content: 123.456.789.112
    ttl: 600
  - type: A
    host: www.example.com
    content: 123.456.789.112
    ttl: 600
    priority: 20

Schema

Record

  • type
  • host
  • content
  • ttl
  • priority

Config

  • domain
  • records

Development

# Build Bacon
make build

# Run unit tests
make test-unit

# Run system tests (auth required)
make test-system

Built With