-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 05116e0
Showing
8 changed files
with
446 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
octodns = "*" | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.8" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# g0v.network domains | ||
|
||
For automating management of the `g0v.network` domain via config files. | ||
|
||
Changing or adding DNS records in `main` branach of this repository with update | ||
the actual domain records. | ||
|
||
Inspired by [`g0v/domain`][g0v/domain] | ||
|
||
[g0v/domain]: https://github.com/g0v/domain | ||
|
||
**Note:** Work in progress. Not yet functional. | ||
|
||
## Technologies Used | ||
|
||
- [**octoDNS.**][octodns] | ||
|
||
[octodns]: https://github.com/octodns/octodns | ||
|
||
## Usage | ||
|
||
The intended way to use this repository is via pull request directly on GitHub. | ||
|
||
(You should only need to clone this code locally in order to improve the | ||
automation part of this repository. See Development section.) | ||
|
||
### Create a new subdomain | ||
|
||
Create a new YAML file, and fill it out. For example, to create | ||
`my.example.g0v.network`, you'd create a config file with the full subdomain | ||
name, with a key inside it for `my.example`. Like so (click through the link to | ||
see example): | ||
|
||
[`g0v.network./my.example.g0v.network.yaml`][new-subdomain] | ||
|
||
[new-subdomain]: https://github.com/g0v-network/domains/new/main?filename=g0v.network./my.example.g0v.network.yaml&value=my.example%3A%0A%20%20-%20type%3A%20A%0A%20%20%20%20value%3A%0A%20%20%20%20%20%20-%20123.45.67.89 | ||
|
||
### Delete an existing subdomain | ||
|
||
Delete a file or a specific record type within a file. Our automation will sync this deletion when it runs. | ||
|
||
### Modify an existing subdomain | ||
|
||
Modify an [existing file][existing]. Our automation will sync this change when it runs. | ||
|
||
[existing]: /g0v.network./g0v.network.yaml | ||
|
||
## Development | ||
|
||
To contribute changes to our automation, you'll likely want to be able to run it locally. Here's what you'll need: | ||
|
||
- Python 3 | ||
- Cloudflare account | ||
- Cloudflare site: `g0v.network` (can "fake it", no need to actually have access to it) | ||
- Cloudflare API token (see instructions in `sample.env`) | ||
|
||
``` | ||
git clone https://github.com/g0v-network/domains | ||
cd domains | ||
brew install pipenv | ||
pipenv install | ||
# Copy and modify as needed with API token | ||
cp sample.env .env | ||
# Validate your config locally | ||
pipenv run octodns-validate --config-file config.yaml | ||
# Do a dry run (no changes will be made) | ||
pipenv run octodns-sync --config-file config.yaml | ||
# Do a REAL run (!!!) | ||
# | ||
# WARNING: this is destructive, and will delete any records on a domain that | ||
# are not present in your configuration files. | ||
pipenv run octodns-sync --config-file config.yaml --doit | ||
``` | ||
|
||
## :muscle: Contributing | ||
|
||
Please open an issue or pull request in order to apply for a new subdomain. | ||
|
||
## :copyright: License | ||
|
||
[CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
manager: | ||
max_workers: 2 | ||
|
||
providers: | ||
config-files: | ||
class: octodns.provider.yaml.SplitYamlProvider | ||
directory: . | ||
default_ttl: 120 | ||
enforce_order: false | ||
# Error when dups found | ||
populate_should_replace: false | ||
cloudflare: | ||
class: octodns.provider.cloudflare.CloudflareProvider | ||
token: env/CLOUDFLARE_API_TOKEN | ||
|
||
zones: | ||
g0v.network.: | ||
sources: | ||
- config-files | ||
targets: | ||
- cloudflare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'': | ||
- type: A | ||
value: 162.247.75.222 | ||
octodns: | ||
cloudflare: | ||
proxied: true | ||
metdata: | ||
repository: https://github.com/g0v-network/g0v.network | ||
maintainer: | ||
- patcon | ||
- type: MX | ||
value: | ||
exchange: erica.mayfirst.org. | ||
preference: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
training: | ||
type: CNAME | ||
value: trainingg0vnetwork.netlify.com. | ||
octodns: | ||
cloudflare: | ||
proxied: true | ||
metadata: | ||
repo: https://github.com/g0v-network/training.g0v.network | ||
maintainer: | ||
- patcon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# See: https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys | ||
# Create a token from the template: "Edit zone DNS" | ||
# We advise scoping it only specific domains you wish to manage via this automation. | ||
CLOUDFLARE_API_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |