Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
21 changes: 11 additions & 10 deletions .github/workflows/pr_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ permissions:

# If you are using Method 3 (see below), this is where you will
# set your env variables.
# env:
# MYCF_ACCOUNTID: "${{ secrets.MYCF_ACCOUNTID }}"
# MYCF_TOKEN: "${{ secrets.MYCF_TOKEN }}"
#
env:
GANDI_MAIN_SHARING_ID: "${{ secrets.GANDI_MAIN_SHARING_ID }}"
GANDI_MAIN_TOKEN: "${{ secrets.GANDI_MAIN_TOKEN }}"


jobs:
preview:
Expand All @@ -33,6 +33,8 @@ jobs:
-
name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false

#
# Method 1: creds.json stored as a secret
Expand All @@ -44,13 +46,12 @@ jobs:
# Settings -> Secrets and variables -> Actions
# i.e. https://github.com/YOUR_ORG/REPO_NAME/settings/secrets/actions
#

-
# Extract the secret and write it to the file.
name: Prepare creds_file
run: printf '%s' '${{secrets.CREDS_JSON}}' > creds.json

#
# -
# # Extract the secret and write it to the file.
# name: Prepare creds_file
# run: printf '%s' '${{secrets.CREDS_JSON}}' > creds.json

# Method 2: Dynamic creds.json file
#
# Store the individual credentials as github secrets, and dynamically generate
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ permissions:
pull-requests: write

# If you are using Method 3 (see below), this is where you will
# set your env variables.
# env:
# MYCF_ACCOUNTID: "${{ secrets.MYCF_ACCOUNTID }}"
# MYCF_TOKEN: "${{ secrets.MYCF_TOKEN }}"
#
# set your env variables. Add one line here for each env variable
# mentioned in creds.json.
env:
GANDI_MAIN_SHARING_ID: "${{ secrets.GANDI_MAIN_SHARING_ID }}"
GANDI_MAIN_TOKEN: "${{ secrets.GANDI_MAIN_TOKEN }}"

jobs:
push:
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ This repo stores our DNS Domains and records as "infrastructure as code" for our
organization. The Github actions allow full "gitops" updates for our DNS
infrastructure. All updates are done via PR.

## Steal this repo!

## Clone this repo!

Clone this repo as a starting point for your own organization's DNS-as-Code use.

1. Clone this repo. Give it a name appropriate for your organization (`dns-config` is suggested).
2. Update `.github/workflows/pr_preview.yml` and `.github/workflows/pr_push.yml` to use the credentials based on whether you use Method 1, 2 or 3 (see https://github.com/DNSControl/dnscontrol-action/blob/main/README.md)
3. Update `dnsconfig.js` to include example.com and one of your domains (start with a non-production domain).
4. Submit a PR, debug any auth issues.
5. Add other domains. See https://docs.dnscontrol.org/getting-started/getting-started for tips.
6. Update `README.md` to suit your organization. Delete this section.


## Updates

To add/change/delete DNS records:
Expand Down Expand Up @@ -43,3 +52,7 @@ Use your organization's approval process to review and approve the PR.
**Step 5: Merge it!**

On merger, a Github Action will run `dnscontrol push` to make the change.

## How to get help

FILL IN.
7 changes: 7 additions & 0 deletions creds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"gandi_main": {
"TYPE": "GANDI_V5",
"sharing_id": "$GANDI_MAIN_SHARING_ID",
"token": "$GANDI_MAIN_TOKEN"
}
}
8 changes: 4 additions & 4 deletions dnsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

// To update types-dnscontrol.d.ts run: dnscontrol write-types

var REG_GANDI_TAL = NewRegistrar("gandi_v5_PLTS");
var DNS_GANDI_TAL = NewDnsProvider("gandi_v5_PLTS");
var REG_GANDI_TAL = NewRegistrar("gandi_main");
var DNS_GANDI_TAL = NewDnsProvider("gandi_main");

var SPF_MXONLY = [TXT("@", "v=spf1 mx -all", TTL(3600))];

D("best-spaghetti-sauce-ever.com", REG_GANDI_TAL,
DnsProvider(DNS_GANDI_TAL),
SPF_MXONLY,

A("@", 142.93.29.52),
AAAA("@", 2604:a880:2:d1:0:1:2907:8001),
A("@", "142.93.29.52"),
AAAA("@", "2604:a880:2:d1:0:1:2907:8001"),
MX("@", 1, "jj2.whatexit.org."),

CNAME("www", "@"),
Expand Down
Loading