Skip to content

Commit

Permalink
chore(global): cook things up with DNS related chores
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Jiroh Halili <[email protected]>
  • Loading branch information
ajhalili2006 committed Jan 29, 2025
1 parent 2b43848 commit babde1b
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ DOTENV_KEYS_LOADED=1
DOTENV_PUBLIC_KEY="020c13c2e7b3510fe62231d2968375be7f35972e0f8c7a6691110133f72274a2b5"

# .env
CLOUDFLARE_API_TOKEN="encrypted:BKv61BfHcaxS9Z9RnXsXP9YgcugK4Ai1UyYk/tlSOyECeQ1qwFsLvltrxbGOo5lqQ/jzma/Q5o3MgznaWx2/5joeJTAqI+wJkkVfu89bqv1LQzoS0g+MbKiTWDNr0WsQEpxDal+7EMIk9w9vCLc1IQgUYC2Z7cbNDE+GTLizf94JdPqSDTNW2Co="
CLOUDFLARE_TOKEN="encrypted:BKv61BfHcaxS9Z9RnXsXP9YgcugK4Ai1UyYk/tlSOyECeQ1qwFsLvltrxbGOo5lqQ/jzma/Q5o3MgznaWx2/5joeJTAqI+wJkkVfu89bqv1LQzoS0g+MbKiTWDNr0WsQEpxDal+7EMIk9w9vCLc1IQgUYC2Z7cbNDE+GTLizf94JdPqSDTNW2Co="
CLOUDFLARE_TOKEN="encrypted:BOjtLj9PLOmryNosK1a/N/4IJ/bU7QRytKSEn6dmwh9xQKsezo4peUjp5BZVQz02DsPcjbFN1AARVDBUfuOxAuJiLrGhgVBbyaZ9RzeqEtItjFEwboCmGDa/2fks4Fdn6mOFGgdsTYPOp32xmEPnomZ6HaDIaTKrZPzcktnptIDyFdhlZ4LwCsE="
CLOUDFLARE_API_TOKEN="$CLOUDFLARE_TOKEN"
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ octodns-cloudflare = "*"
python_version = "3.12"

[scripts]
dns-export = "octodns-dump --config-file=octodns-config.yml --output-dir dns"
dns-dryrun = "octodns-sync --config-file=./dns/octodns-config.yml"
dns-apply = "octodns-sync --config-file=./dns/octodns-config.yml --doit"
28 changes: 14 additions & 14 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 19 additions & 30 deletions dns/andreijiroh.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,6 @@
ttl: 300
type: A
value: 127.0.0.1
'*.stellapent.tailnet':
- ttl: 300
type: A
value: 100.87.227.94
- ttl: 300
type: AAAA
value: fd7a:115c:a1e0::a401:e35e
'*.wplabs':
octodns:
cloudflare:
auto-ttl: true
comment: tailnet-only WordPress lab
ttl: 300
type: CNAME
value: wp.stellapent.tailnet.andreijiroh.dev.
_acme-challenge.api:
octodns:
cloudflare:
Expand Down Expand Up @@ -252,13 +237,25 @@ status:
ttl: 300
type: CNAME
value: andreijiroh-dev.github.io.
stellapent.tailnet:
- ttl: 300
type: A
value: 100.87.227.94
- ttl: 300
type: AAAA
value: fd7a:115c:a1e0::a401:e35e
tailnet:
- octodns:
cloudflare:
auto-ttl: true
ttl: 300
type: DS
value:
algorithm: 13
digest: CC4238C1416F65932CE32BA56214DE0FD888CBDD042E881ED367EF3BC1C5E52C
digest_type: 2
key_tag: 64753
- octodns:
cloudflare:
auto-ttl: true
ttl: 300
type: NS
values:
- ns1.desec.io.
- ns2.desec.org.
tommy2heliohost._domainkey:
octodns:
cloudflare:
Expand Down Expand Up @@ -305,14 +302,6 @@ wikilab:
ttl: 300
type: CNAME
value: nyc.domcloud.co.
wplabs:
octodns:
cloudflare:
auto-ttl: true
comment: tailnet-only WordPress lab
ttl: 300
type: CNAME
value: wp.stellapent.tailnet.andreijiroh.dev.
www:
octodns:
cloudflare:
Expand Down
31 changes: 31 additions & 0 deletions dns/andreijiroh.is-a.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
? ''
: octodns:
cloudflare:
auto-ttl: true
proxied: true
ttl: 300
type: ALIAS
value: ajhalili2006.pages.dev.
_discord:
octodns:
cloudflare:
auto-ttl: true
comment: Discord domain verification
ttl: 300
type: TXT
value: dh=3e418355487305cc4560b0611ba783271ccc066d
git.infraops:
octodns:
cloudflare:
auto-ttl: true
ttl: 300
type: A
value: 69.30.249.53
uptimekuma:
octodns:
cloudflare:
auto-ttl: true
ttl: 300
type: A
value: 69.30.249.53
11 changes: 7 additions & 4 deletions octodns-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ zones:
andreijiroh.dev.:
sources: [config]
targets: [cf]
andreijiroh.xyz.:
andreijiroh.is-a.dev.:
sources: [config]
targets: [cf]
#andreijiroh.xyz.:
# sources: [config]
# targets: [cf]
andreijiroh.eu.org.:
sources: [config]
targets: [cf]
andreijiroh.uk.eu.org.:
sources: [config]
targets: [cf]
#andreijiroh.uk.eu.org.:
# sources: [config]
# targets: [cf]
andreijiroh.pp.ua.:
sources: [config]
targets: [cf]
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"tool:dns-records": "./script/dns-records"
},
"dependencies": {
"@dotenvx/dotenvx": "^1.32.1"
"@dotenvx/dotenvx": "^1.34.0"
}
}
4 changes: 2 additions & 2 deletions script/dns-records
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ if [[ "$PWD" != "$GIT_ROOT" ]]; then
fi

if [ -z "${CI}" ]; then
dotenvx run -f .env.ci -- deno run -A "$GIT_ROOT/utils/dns-records.ts" "$@"
dotenvx run -f "$GIT_ROOT/.env.ci" -- deno run -A "$GIT_ROOT/utils/dns-records.ts" "$@"
else
dotenvx run -f .env -- deno run -A "$GIT_ROOT/utils/dns-records.ts" "$@"
dotenvx run -f "$GIT_ROOT/.env" -- deno run -A "$GIT_ROOT/utils/dns-records.ts" "$@"
fi
exitcode=$?

Expand Down
11 changes: 3 additions & 8 deletions utils/dns-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ program.command("import")
}
const args = [
"run",
"--",
"octodns-dump",
"--config-file",
configFile,
"--output-dir",
dnsRecordsYamlDir
"dns-export"
]
args.push(addTrailingDot(domain),`${provider || "cf"}`)
console.log(`trying to exec ${whereCli} ${args.join(" ")}`)
Expand Down Expand Up @@ -76,7 +71,7 @@ program.command("plan")
if (Deno.env.get("CLOUDFLARE_TOKEN") == undefined) {
throw new Error("Cloudflare API token missing, maybe forgot to set DOTENV_PRIVATE_KEY?")
}
const args = ["run", "--", "octodns-sync", "--config-file", configFile]
const args = ["run", "dns-dryrun"]
console.log(`trying to exec ${whereCli} ${args.join(" ")}`)
const ops = new Deno.Command(whereCli, {
args,
Expand Down Expand Up @@ -118,7 +113,7 @@ program.command("apply")
throw new Error("Cloudflare API token missing, maybe forgot to set DOTENV_PRIVATE_KEY?")
}

const args = ["run", "--", "octodns-sync", "--config-file", configFile, "--doit"]
const args = ["run", "dns-apply"]

if (opts.forceApply == true) {
args.push("--force")
Expand Down

0 comments on commit babde1b

Please sign in to comment.