···11# localdev
2233-Code and configuration to create a local development environment.33+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.
44+55+## Configuration
66+77+88+## Operation
99+1010+1. Configure and start the PLC service. See plc/README.md
1111+1212+2. Configure and start the PDS service. See pds/README.md
1313+1414+3. Configure and start the DNS service. See dns/README.md
1515+1616+4. Configure split-DNS in Tailscale.
1717+1818+ 1. Visit https://tailscale.com/
1919+ 2. Go to the Machines tab and get the internal IP address of `didadmin`
2020+ 2. Go to the DNS configuration page
2121+ 3. Add a nameserver and select "Custom"
2222+ 4. Enter the IP address of the `didadmin`, select "Restrict to domain (Split DNS)", and set the domain to "pyroclastic.cloud"
2323+2424+## Maintenance
2525+2626+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
···11+. {
22+ log
33+ errors
44+55+ reload 10s
66+77+ records pyroclastic.cloud {
88+ @ 60 IN TXT "TEST"
99+ _atproto.test1734305850 60 IN TXT "did=did:plc:p75ngbyvabgetgoy52aswele"
1010+ _atproto.test1734440080 60 IN TXT "did=did:plc:k5d6h7nlhbh5tuxrlxczgal3"
1111+ _atproto.test1734440644 60 IN TXT "did=did:plc:x45wmz7vktj2aqcqwj7yakxs"
1212+ }
1313+1414+}
+50
dns/README.md
···11+# DNS
22+33+The DNS component does several things:
44+55+1. It uses CoreDNS as a split-DNS nameserver for resolving local handles.
66+2. It provides a small HTTP application for generating new handles for testing purposes.
77+88+## Configuration
99+1010+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:
1111+1212+In `./docker-compose.yml`:
1313+1414+* Set the `PDS_ADMIN_PASSWORD` environment variable to your PDS admin password.
1515+* Set the `PDS_HOSTNAME` to the internal hostname of your PDS. (i.e. `pds.sneaky-fox.ts.net`)
1616+* Optionally, if you are not using the `pyroclastic.cloud` domain (it's fine to leave this as-is) then change that.
1717+1818+## Operation
1919+2020+1. First, build the `didadmin` tool.
2121+2222+ `docker build -f ./didadmin/Dockerfile -t didadmin ./didadmin/`
2323+2424+3. Bring networking up.
2525+2626+ `docekr compose up tailscale -d`
2727+2828+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
2929+3030+ `docker compose logs tailscale`
3131+3232+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`)
3333+3434+ `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"`
3535+3636+5. Bring didadmin up.
3737+3838+ `docekr compose up app -d`
3939+4040+ When this first starts, it'll create the `/etc/coredns/database.db` and `/etc/coredns/Corefile` files inside the container.
4141+4242+6. Bring coredns and the proxy up.
4343+4444+ `docker compose up -d`
4545+4646+7. Ensure the PLC and PDS services are running, and split-DNS is configured before using.
4747+4848+## Usage
4949+5050+In a browser, visit https://didadmin.sneaky-fox.ts.net/ and use the form to create accounts on the local PDS.
···11+# PDS
22+33+## Configuration
44+55+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.
66+77+Copy the `env.example` file to `env` and update the following entry "PLACEHOLDER" values.
88+99+* `PDS_JWT_SECRET` value set with `openssl rand --hex 16`
1010+* `PDS_ADMIN_PASSWORD` value set with `openssl rand --hex 16`
1111+* `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`
1212+* `PDS_HOSTNAME` value updated to relflect your internal tailnet
1313+* `PDS_ADMIN_EMAIL` value updated to relflect your internal tailnet
1414+* `PDS_DID_PLC_URL` value updated to relflect your internal tailnet
1515+* Optionally, if you are not using the `pyroclastic.cloud` domain (it's fine to leave this as-is) then change that.
1616+1717+## Operation
1818+1919+1. Create the configuration file and update it accordingly.
2020+2121+2. Bring networking up.
2222+2323+ `docekr compose up tailscale -d`
2424+2525+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
2626+2727+ `docker compose logs tailscale`
2828+2929+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`)
3030+3131+ `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"`
3232+3333+4. Bring the app and proxy up.
3434+3535+ `docker compose up -d`
3636+3737+## Usage
3838+3939+The PDS will be available at https://pds.internal.ts.net/.
4040+4141+The maildev service will be available at http://pds.internal.ts.net:1080/.
···11+# PLC
22+33+To start a PLC server, you must build a container from the PLC repository.
44+55+1. First, clone https://github.com/did-method-plc/did-method-plc
66+77+ `git clone https://github.com/did-method-plc/did-method-plc`
88+99+2. Build the container
1010+1111+ `docker build -f ./did-method-plc/packages/server/Dockerfile -t plcjs ./did-method-plc/`
1212+1313+3. Bring networking up.
1414+1515+ `docekr compose up tailscale -d`
1616+1717+ If you are using dynamic node registration, you'll need to view the logs and click on the link.
1818+1919+ `docker compose logs tailscale`
2020+2121+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`)
2222+2323+ `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"`
2424+2525+5. Bring the database up.
2626+2727+ `docekr compose up db -d`
2828+2929+6. Bring the app and proxy up.
3030+3131+ `docker compose up -d`