The @smokesignal.events/localdev repository contains code, configuration, and documentation to create a multi-host network-local development environment using Tailscale.
- Run a PLC instance
- Run a PDS instance with a sidecar maildev instance to support viewing email notifications from the PDS
- Run a CoreDNS instance to configure split-DNS for DNS based at-handle resolution
- Run a “DID Admin” tool to support test account creation
More at https://tangled.sh/@smokesignal.events/localdev/
2 Likes
The docker image of CoreDNS you used is not default. I documented the compilation WITH external records plugin.
Also : if you’re stubborn like me and dont use vscode :
-You have to modify the docker compose file to add and env. file with you env data
-Adding to post-install.sh : cargo tunnelto , sqlx reset and cargo build
-tunnelto doesn’t work with localhost on devcontainer, had to use -host 127.0.0.1
Can you send me the copy for the README so I can update it? A gist or pastebin link would be fine.
# DNS
The DNS component does several things:
1. It uses CoreDNS as a split-DNS nameserver for resolving local handles with records plugin.
2. It provides a small HTTP application for generating new handles for testing purposes.
## Configuration
This service makes API calls to the local PDS and also exists on a tailscale network.
Copy `docker-compose.example.yml` to `docker-compose.yml` and make the following changes:
* Set the `PDS_ADMIN_PASSWORD` environment variable to your PDS admin password.
* Set the `PDS_HOSTNAME` to the internal hostname of your PDS. (i.e. `pds.sneaky-fox.ts.net`)
* Optionally, if you are not using the `pyroclastic.cloud` domain (it's fine to leave this as-is) then change that.
* Optional, set the `TS_AUTHKEY` if you are using one.
## Operation
1. First, build the `didadmin` tool.
`docker build -f ./didadmin/Dockerfile -t didadmin ./didadmin/`
2. Build CoreDNS with records plugin : `git clone coredns`
* `cd coredns`
* `echo "records:github.com/coredns/records" >> ./plugin.cfg`
* `docker run --rm -i -t -v $PWD:/go/src/github.com/coredns/coredns -w /go/src/github.com/coredns/coredns golang:1.23 sh -c 'GOFLAGS="-buildvcs=false" make gen && GOFLAGS="-buildvcs=false" make' `
3. Create custom Docker image `Dockerfile-coredns`
FROM ubuntu
COPY coredns /coredns
RUN chmod +x /coredns
EXPOSE 53 53/udp
ENTRYPOINT ["/coredns"]
4. Build the docker image
`docker build -t [your choice]/coredns:v1 -f Dockerfile-coredns .`
https://purushothamkdr453.medium.com/kubernetes-adding-enabling-externplugin-to-coredns-image-e56825f8fb60
5. Bring networking up.
`docker compose up tailscale -d`
If you are using dynamic machine authentication, you'll need to view the logs and click on the link.
`docker compose logs tailscale`
6. 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`)
`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"`
7. Bring didadmin up.
`docker compose up app -d`
When this first starts, it'll create the `/etc/coredns/database.db` and `/etc/coredns/Corefile` files inside the container.
8. Bring coredns and the proxy up.
`docker compose up -d`
9. Ensure the PLC and PDS services are running, and split-DNS is configured before using.
## Usage
In a browser, visit https://didadmin.sneaky-fox.ts.net/ and use the form to create accounts on the local PDS.
1 Like
# Localdev Playbook
To run Smoke Signal in localdev (assuming vscode):
1. Create the localdev services https://tangled.sh/@smokesignal.events/localdev
## Vscode version
2. Create a Smoke Signal dev container. Ensure it is connected to tailscale.
3. Run migrations `sqlx database reset`
4. Copy `.vscode/launch.example.json` to `.vscode.json` and set the following environment variables:
* `DNS_NAMESERVERS` to `100.100.100.100`
* `PLC_HOSTNAME` to `plc.internal.ts.net`. Be sure to change `internal.ts.net` to whatever your Tailnet name is (i.e. `sneaky-fox.ts.net`)
* `EXTERNAL_BASE` to `placeholder.tunn.dev`. Be sure to change this to whatever tunnel service you're using.
5. Start your developer tunnel `tunnelto --subdomain placeholder --port 3100 --host localhost`
At this point you can open up https://placeholder.tunn.dev/ and login with identities created with https://didadmin.internal.ts.net using the handle and password "password".
## manual version
2. Create `.env` file in `.devcontainer`
"DEBUG": "true",
"HTTP_PORT": "3100",
"EXTERNAL_BASE": "yourhostname",
"HTTP_COOKIE_KEY": "7omSYPNPwxT2gZPf0sQ51kPhaWKAqBu22M0j2il81LyIWP79jR4lrS1rBRX5ZIQS9qxATh469XL0k4G8c67r+A",
"OAUTH_ACTIVE_KEYS": "01JV8430MGTTA692WBYFGRMWRG",
"DESTINATION_KEY": "01JV8430MGTTA692WBYFGRMWRG",
"SIGNING_KEYS": "eyJrZXlzIjpbeyJraWQiOiIwMUpWODQzME1HVFRBNjkyV0JZRkdSTVdSRyIsImFsZyI6IkVTMjU2Iiwia3R5IjoiRUMiLCJjcnYiOiJQLTI1NiIsIngiOiJYb3dFbHpXMFhTeXVXUWJOaVFpTDFmbm9RQlhZRmkwWk9BQ2U3S3JONU1jIiwieSI6IkFXLWpFNWYtcXNZYVBoRFhCUUNuNjVCaVRKRWtJRVEzYXFONXV2b1U1TkkiLCJkIjoiNXNvT2RZWko2MzVoWnJWMmlRcFgya1dPR19wdFB0eHJVN1J4eFFaUTNJSSJ9XX0K",
"RUST_LOG": "smokesignal=debug,html5ever=info,info"
3. Modify `devcontainer` service in `.devcontainer/docker-compose.yml` and `docker compose up -d`
devcontainer:
image: mcr.microsoft.com/devcontainers/rust:1-1-bullseye
volumes:
- ..:/workspace:cached
- /var/run/docker.sock:/var/run/docker.sock
- smokesignal_sccache:/sccache
- smokesignal_data:/var/lib/smokesignal
command: sleep infinity
env_file:
- .env
environment:
- RUSTC_WRAPPER=sccache
- SCCACHE_DIR=/sccache
- RUST_LOG=debug
- RUST_BACKTRACE=1
- RUST_LIB_BACKTRACE=1
- HTTP_PORT=3100
- TZ=America/New_York
- DATABASE_URL=postgres://postgres:password@postgres/smokesignal
4. Connect to the devcontainer `docker container exec -it devcontainer-devcontainer-1 /bin/bash`
5. add to `.devcontainer/post-install.sh` and run it
cd ..
sqlx database reset
cargo build --bin=smokesignal
6. Start `target/debug/smokesignal`
7. Start your developer tunnel `tunnelto --subdomain placeholder --port 3100 --host 127.0.0.1`
Note : Be sure to delete the target folder if you have problems after recompiling.
1 Like