jungaretti / bacon Goto Github PK
View Code? Open in Web Editor NEWDeploy your DNS records from YAML config files to Porkbun
License: GNU General Public License v3.0
Deploy your DNS records from YAML config files to Porkbun
License: GNU General Public License v3.0
Deploy should read records from a config, diff them with existing records, create new records, and delete old records
bacon deploy
's output is messy. It should list records more clearly.
Bacon needs to offer the option to ignore records based on their type or name. Porkbun recently updated their API to return NS
nameserver records. Furthermore, they rotate _acme-challenge.example.com
records regularly.
Output of bacon deploy
Would delete 6 records:
- {263350200 jungaretti.com NS curitiba.porkbun.com 86400 }
- {263350203 jungaretti.com NS fortaleza.porkbun.com 86400 }
- {263350205 jungaretti.com NS maceio.porkbun.com 86400 }
- {263350206 jungaretti.com NS salvador.porkbun.com 86400 }
- {263350208 _acme-challenge.jungaretti.com TXT nStUIY7ccq-47CEgzHa8rBnfirueLxVRaLjpXcdinSg 600 }
- {263350209 _acme-challenge.jungaretti.com TXT XN05LMcknvIkobS1q3GF4m11zL2dtVT7T043K_zxAyc 600 }
Would create 2 records:
- { _acme-challenge.jungaretti.com TXT Kb6-nJirHoqvIqzbzKklBaXrbmqxbLav77qO0o1BFPY 600 }
- { _acme-challenge.jungaretti.com TXT J4Qs_IAv-pH5RMFZ64pI50SL-t21Tq6WHkycp6BExjc 600 }
Mock deployment complete
This is bad. Bacon wants to delete the 4 NS
records and revert the _acme-challenge.jungaretti.com
records.
I'd like to add an end-to-end test for Porkbun that uses bacon ping
, bacon deploy
, and bacon deploy -c -d
to deploy some DNS records. This test would ensure that those scenarios are working properly. It would also verify that Porkbun's API is behaving as-expected.
The test should be idempotent. It can run every night with a cron-triggered action.
Client code should use common types and interfaces to enable more DNS providers in the future
Bacon clients are responsible for communicating with their DNS provider.
Ping
checks authentication configGetRecords(domain)
gets all recordsCreateRecord(domain, record)
DeleteRecord(domain, record)
Bacon records describe a DNS record in a provider-agnostic manner. All clients understand Bacon records.
Type
Host
(e.g., www.borkbork.buzz
)Content
TTL
Priority
Any plans to support the print option from generic DNS API providers so that this could be used as a DNS migration tool?
Something like:
GET: https://networkcalc.com/api/dns/lookup/example.com
and print out the entries in the YAML format. Then that YAML could be used to deploy those DNS entries into Porkbun and this would be a great DNS migration tool!
It makes sense to store TTL and priority values as numbers in config files, but this means we unmarshal a value of 0
when they aren't specified. We should treat 0
, "0"
, and ""
the same way when comparing records. We should only include a numerical value for TTL and priority in requests to Porkbun if their value is above 0.
If bacon ping
fails, it should suggest that the user check their environment variables.
๐ I was using this script to migrate a domain but ran into this error mid-way:
Error: couldn't create record: unmarshaling JSON body: invalid character '<' looking for beginning of value Usage:
When checking in the Porkbun admin it seemed to be a faulty MX record that got created but had priority 0. After manually changing the priority from PB admin panel the script could proceed.
Here is a snippet from my yaml:
- type: MX
host: "x.domain.com"
content: mxa.eu.mailgun.org.
ttl: 600
priority: 10
As an aside, for some reason Bacon can't seem to detect that this particular DNS entry is already created:
- type: TXT
host: "bun-verify.khromov.se"
content: "127d8e80396db8b58b2f236991f5e715c5431df0763ccaef0d2edd516220308a"
ttl: 300
Every time i re-run it it says:
./bacon deploy khromov.se.yaml --delete --create
Deleting 1 records...
- {344101976 bun-verify.khromov.se TXT 127d8e80396db8b58b2f236991f5e715c5431df0763ccaef0d2edd516220308a 600 0 }
Creating 1 records...
- {bun-verify.khromov.se TXT 0xc0000b9450 127d8e80396db8b58b2f236991f5e715c5431df0763ccaef0d2edd516220308a}
Deployment complete!
Thanks for a great tool!
If a config file doesn't specify ttl
or priority
, Bacon tries to deploy the default int
value of 0
.
Screenshot from: https://github.com/jungaretti/jungaretti.com/runs/6332547664?check_suite_focus=true
README.md
should (briefly) mention Bacon's unit tests and system tests:
test-pr.yml
test-integration.yml
It would be extremely useful if Bacon could also export records into the YAML format, making it possible to migrate records between porkbun domains! ๐ท
A new dump
command would make it much easier to create config files for domains that already have many DNS records. The dump
command should simply print existing records for a domain in YAML format.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.