Skip to content

Commit

Permalink
docs: Corefile.local-dev
Browse files Browse the repository at this point in the history
documenting how to get started locally, saving an hour figuring it out
  • Loading branch information
lidel committed Nov 27, 2024
1 parent 54115de commit c92fd95
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Corefile
Corefile.local-dev
zones
p2p-forge
p2p-forge-certs/
badger.libp2p-direct-challenges/
registration_libp2p_direct-certs/
2 changes: 2 additions & 0 deletions Corefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# this file demonstrates reference production settings.
# for local development use: ./p2p-forge -conf Corefile.local-dev
libp2p.direct {
log
errors
Expand Down
12 changes: 12 additions & 0 deletions Corefile.local-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
libp2p.direct {
log
errors
any # RFC 8482
prometheus localhost:9253
ipparser libp2p.direct
file zones/libp2p.direct
acme libp2p.direct {
registration-domain registration.libp2p.direct listen-address=:5380 external-tls=true
database-type badger badger.libp2p-direct-challenges
}
}
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,26 @@ Will download using go mod, build and install the binary in your global Go binar

### Local testing

Build and run a custom Corefile configuration and on custom port:
Build and run a custom Corefile configuration and on custom ports (DNS port set to `5354` via CLI, HTTP port set to `5380` via custom Corefile):

```console
$ ./p2p-forge -conf Corefile.example -dns.port 5353
$ ./p2p-forge -conf Corefile.local-dev -dns.port 5354
```

Test with `dig`:

```console
$ dig A 1-2-3-4.k51qzi5uqu5dlwfht6wwy7lp4z35bgytksvp5sg53fdhcocmirjepowgifkxqd.libp2p.direct @localhost -p 5353
$ dig A 1-2-3-4.k51qzi5uqu5dlwfht6wwy7lp4z35bgytksvp5sg53fdhcocmirjepowgifkxqd.libp2p.direct @localhost -p 5354
1.2.3.4

$ curl http://localhost:5380/v1/health -I
HTTP/1.1 204 No Content
```

To run on port `53` as non-root user, adjust permission:

```console
$ sudo setcap cap_net_bind_service=+ep /path/to/p2p-forge
```

### Docker
Expand Down

0 comments on commit c92fd95

Please sign in to comment.