Skip to content

Commit 05116e0

Browse files
committed
Initial commit.
0 parents  commit 05116e0

File tree

8 files changed

+446
-0
lines changed

8 files changed

+446
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Pipfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
octodns = "*"
8+
9+
[dev-packages]
10+
11+
[requires]
12+
python_version = "3.8"

Pipfile.lock

+295
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# g0v.network domains
2+
3+
For automating management of the `g0v.network` domain via config files.
4+
5+
Changing or adding DNS records in `main` branach of this repository with update
6+
the actual domain records.
7+
8+
Inspired by [`g0v/domain`][g0v/domain]
9+
10+
[g0v/domain]: https://github.com/g0v/domain
11+
12+
**Note:** Work in progress. Not yet functional.
13+
14+
## Technologies Used
15+
16+
- [**octoDNS.**][octodns]
17+
18+
[octodns]: https://github.com/octodns/octodns
19+
20+
## Usage
21+
22+
The intended way to use this repository is via pull request directly on GitHub.
23+
24+
(You should only need to clone this code locally in order to improve the
25+
automation part of this repository. See Development section.)
26+
27+
### Create a new subdomain
28+
29+
Create a new YAML file, and fill it out. For example, to create
30+
`my.example.g0v.network`, you'd create a config file with the full subdomain
31+
name, with a key inside it for `my.example`. Like so (click through the link to
32+
see example):
33+
34+
[`g0v.network./my.example.g0v.network.yaml`][new-subdomain]
35+
36+
[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
37+
38+
### Delete an existing subdomain
39+
40+
Delete a file or a specific record type within a file. Our automation will sync this deletion when it runs.
41+
42+
### Modify an existing subdomain
43+
44+
Modify an [existing file][existing]. Our automation will sync this change when it runs.
45+
46+
[existing]: /g0v.network./g0v.network.yaml
47+
48+
## Development
49+
50+
To contribute changes to our automation, you'll likely want to be able to run it locally. Here's what you'll need:
51+
52+
- Python 3
53+
- Cloudflare account
54+
- Cloudflare site: `g0v.network` (can "fake it", no need to actually have access to it)
55+
- Cloudflare API token (see instructions in `sample.env`)
56+
57+
```
58+
git clone https://github.com/g0v-network/domains
59+
cd domains
60+
61+
brew install pipenv
62+
pipenv install
63+
64+
# Copy and modify as needed with API token
65+
cp sample.env .env
66+
67+
# Validate your config locally
68+
pipenv run octodns-validate --config-file config.yaml
69+
70+
# Do a dry run (no changes will be made)
71+
pipenv run octodns-sync --config-file config.yaml
72+
73+
# Do a REAL run (!!!)
74+
#
75+
# WARNING: this is destructive, and will delete any records on a domain that
76+
# are not present in your configuration files.
77+
pipenv run octodns-sync --config-file config.yaml --doit
78+
```
79+
80+
## :muscle: Contributing
81+
82+
Please open an issue or pull request in order to apply for a new subdomain.
83+
84+
## :copyright: License
85+
86+
[CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/)

config.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
manager:
3+
max_workers: 2
4+
5+
providers:
6+
config-files:
7+
class: octodns.provider.yaml.SplitYamlProvider
8+
directory: .
9+
default_ttl: 120
10+
enforce_order: false
11+
# Error when dups found
12+
populate_should_replace: false
13+
cloudflare:
14+
class: octodns.provider.cloudflare.CloudflareProvider
15+
token: env/CLOUDFLARE_API_TOKEN
16+
17+
zones:
18+
g0v.network.:
19+
sources:
20+
- config-files
21+
targets:
22+
- cloudflare

g0v.network./g0v.network.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'':
3+
- type: A
4+
value: 162.247.75.222
5+
octodns:
6+
cloudflare:
7+
proxied: true
8+
metdata:
9+
repository: https://github.com/g0v-network/g0v.network
10+
maintainer:
11+
- patcon
12+
- type: MX
13+
value:
14+
exchange: erica.mayfirst.org.
15+
preference: 0
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
training:
3+
type: CNAME
4+
value: trainingg0vnetwork.netlify.com.
5+
octodns:
6+
cloudflare:
7+
proxied: true
8+
metadata:
9+
repo: https://github.com/g0v-network/training.g0v.network
10+
maintainer:
11+
- patcon

sample.env

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See: https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys
2+
# Create a token from the template: "Edit zone DNS"
3+
# We advise scoping it only specific domains you wish to manage via this automation.
4+
CLOUDFLARE_API_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

0 commit comments

Comments
 (0)