···1# localdev
23-Code and configuration to create a local development environment.00000000000000000000000
···1# localdev
23+Code and configuration to create a network-local development environment. It uses tailscale and can be used to have shared isolated infrastructure that can be used to support individuals and teams.
4+5+## Configuration
6+7+8+## Operation
9+10+1. Configure and start the PLC service. See plc/README.md
11+12+2. Configure and start the PDS service. See pds/README.md
13+14+3. Configure and start the DNS service. See dns/README.md
15+16+4. Configure split-DNS in Tailscale.
17+18+ 1. Visit https://tailscale.com/
19+ 2. Go to the Machines tab and get the internal IP address of `didadmin`
20+ 2. Go to the DNS configuration page
21+ 3. Add a nameserver and select "Custom"
22+ 4. Enter the IP address of the `didadmin`, select "Restrict to domain (Split DNS)", and set the domain to "pyroclastic.cloud"
23+24+## Maintenance
25+26+Tailscale SSL certificates need to be periodically regenerated. Run the respective `docker compose exec tailscale /bin/sh -c "tailscale cert ..."` command to generate new certs and restart (stop and start) the nginx proxy for it to use the new cert.
+14
dns/Corefile.example
···00000000000000
···1+. {
2+ log
3+ errors
4+5+ reload 10s
6+7+ records pyroclastic.cloud {
8+ @ 60 IN TXT "TEST"
9+ _atproto.test1734305850 60 IN TXT "did=did:plc:p75ngbyvabgetgoy52aswele"
10+ _atproto.test1734440080 60 IN TXT "did=did:plc:k5d6h7nlhbh5tuxrlxczgal3"
11+ _atproto.test1734440644 60 IN TXT "did=did:plc:x45wmz7vktj2aqcqwj7yakxs"
12+ }
13+14+}
···1+# DNS
2+3+The DNS component does several things:
4+5+1. It uses CoreDNS as a split-DNS nameserver for resolving local handles.
6+2. It provides a small HTTP application for generating new handles for testing purposes.
7+8+## Configuration
9+10+This service makes API calls to the local PDS and also exists on a tailscale network. Please make note of any `PLACEHOLDER` and `OPTIONAL` strings in the following files:
11+12+In `./docker-compose.yml`:
13+14+* Set the `PDS_ADMIN_PASSWORD` environment variable to your PDS admin password.
15+* Set the `PDS_HOSTNAME` to the internal hostname of your PDS. (i.e. `pds.sneaky-fox.ts.net`)
16+* Optionally, if you are not using the `pyroclastic.cloud` domain (it's fine to leave this as-is) then change that.
17+18+## Operation
19+20+1. First, build the `didadmin` tool.
21+22+ `docker build -f ./didadmin/Dockerfile -t didadmin ./didadmin/`
23+24+3. Bring networking up.
25+26+ `docekr compose up tailscale -d`
27+28+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
29+30+ `docker compose logs tailscale`
31+32+4. Generate an SSL certificate for the node. Be sure to change `internal.ts.net` to whatever your Tailnet name is (i.e. `sneaky-fox.ts.net`)
33+34+ `docker compose exec tailscale /bin/sh -c "tailscale cert --cert-file /mnt/tls/cert.pem --key-file /mnt/tls/cert.key didadmin.internal.ts.net"`
35+36+5. Bring didadmin up.
37+38+ `docekr compose up app -d`
39+40+ When this first starts, it'll create the `/etc/coredns/database.db` and `/etc/coredns/Corefile` files inside the container.
41+42+6. Bring coredns and the proxy up.
43+44+ `docker compose up -d`
45+46+7. Ensure the PLC and PDS services are running, and split-DNS is configured before using.
47+48+## Usage
49+50+In a browser, visit https://didadmin.sneaky-fox.ts.net/ and use the form to create accounts on the local PDS.
···1+# PDS
2+3+## Configuration
4+5+This is a fully operational PDS and needs appropriate configuration. If you decide to run multiple PDS instances for testing, be sure to configure each one individually.
6+7+Copy the `env.example` file to `env` and update the following entry "PLACEHOLDER" values.
8+9+* `PDS_JWT_SECRET` value set with `openssl rand --hex 16`
10+* `PDS_ADMIN_PASSWORD` value set with `openssl rand --hex 16`
11+* `PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX` value set with `openssl ecparam --name secp256k1 --genkey --noout --outform DER | tail --bytes=+8 | head --bytes=32 | xxd --plain --cols 32`
12+* `PDS_HOSTNAME` value updated to relflect your internal tailnet
13+* `PDS_ADMIN_EMAIL` value updated to relflect your internal tailnet
14+* `PDS_DID_PLC_URL` value updated to relflect your internal tailnet
15+* Optionally, if you are not using the `pyroclastic.cloud` domain (it's fine to leave this as-is) then change that.
16+17+## Operation
18+19+1. Create the configuration file and update it accordingly.
20+21+2. Bring networking up.
22+23+ `docekr compose up tailscale -d`
24+25+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
26+27+ `docker compose logs tailscale`
28+29+3. Generate an SSL certificate for the node. Be sure to change `internal.ts.net` to whatever your Tailnet name is (i.e. `sneaky-fox.ts.net`)
30+31+ `docker compose exec tailscale /bin/sh -c "tailscale cert --cert-file /mnt/tls/cert.pem --key-file /mnt/tls/cert.key pds.internal.ts.net"`
32+33+4. Bring the app and proxy up.
34+35+ `docker compose up -d`
36+37+## Usage
38+39+The PDS will be available at https://pds.internal.ts.net/.
40+41+The maildev service will be available at http://pds.internal.ts.net:1080/.
···1+# PLC
2+3+To start a PLC server, you must build a container from the PLC repository.
4+5+1. First, clone https://github.com/did-method-plc/did-method-plc
6+7+ `git clone https://github.com/did-method-plc/did-method-plc`
8+9+2. Build the container
10+11+ `docker build -f ./did-method-plc/packages/server/Dockerfile -t plcjs ./did-method-plc/`
12+13+3. Bring networking up.
14+15+ `docekr compose up tailscale -d`
16+17+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
18+19+ `docker compose logs tailscale`
20+21+4. Generate an SSL certificate for the node. Be sure to change `internal.ts.net` to whatever your Tailnet name is (i.e. `sneaky-fox.ts.net`)
22+23+ `docker compose exec tailscale /bin/sh -c "tailscale cert --cert-file /mnt/tls/cert.pem --key-file /mnt/tls/cert.key plc.internal.ts.net"`
24+25+5. Bring the database up.
26+27+ `docekr compose up db -d`
28+29+6. Bring the app and proxy up.
30+31+ `docker compose up -d`