Files
atproto-cosocial-labeler/README.md
T
govandClaude Opus 5.5 1a08d2efda build: release a static image with scripts/release.sh
The image now packages a cross-compiled musl binary on distroless instead of
compiling inside Docker. The script builds it, pushes :<version> and :latest
to git.cosocial.info, and tags the commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 15:18:01 -05:00

60 lines
2.2 KiB
Markdown

# Canadian Cities Labeler
An atproto labeler that puts a Canadian city badge on accounts that ask for one over Bluesky DMs.
1. Subscribe to `@cities.pds.cosocial.ca` (the Subscribe button on its profile).
2. Follow it.
3. DM it your city, e.g. `Halifax` or `Richmond, BC`. Send `remove` to clear it.
The labeler polls its DMs, matches the city against `data/cities.json`, and signs an account
label (e.g. `halifax-ns`), negating any previous one. Labels are stored in SQLite and served over
`com.atproto.label.subscribeLabels` and `queryLabels`.
Built on [jacquard](https://tangled.org/nonbinary.computer/jacquard) for atproto types and XRPC.
## Local test
```sh
cp .env.example .env # set LABELER_APP_PASSWORD
cargo run --bin keygen # paste SIGNING_KEY_HEX into .env
cargo run # :4100
```
`rust-toolchain.toml` pins the Rust version; rustup installs it on first build.
The labeler account must allow DMs from everyone (Settings → Privacy and security → Chat).
DM it from a test account, then check
`curl 'localhost:4100/xrpc/com.atproto.label.queryLabels?uriPatterns=<did>'`.
Labels won't appear in the Bluesky app until the labeler is deployed publicly and its DID
document has the `#atproto_label` key and `#atproto_labeler` service.
## First time setup
```sh
cargo run --bin setup -- declare # label definitions; gives the account a Subscribe button
cargo run --bin setup -- did # run after deploying; requires labeler account's main password + emailed code
```
## Release
Releases are made manually with the Rust toolchain. `scripts/release.sh` cross-compiles a static
linux/amd64 binary, packages it into a container image, pushes
`git.cosocial.info/cosocial-canada/atproto-cosocial-labeler:<version>` and `:latest`, and tags the
commit as `v<version>`. It refuses to run with uncommitted changes or an existing tag.
Prerequisites (once):
```sh
brew install zig # linker and C compiler for cross-compiling
cargo install --locked cargo-zigbuild
docker login git.cosocial.info # token with the write:package scope
```
The pinned toolchain and its `x86_64-unknown-linux-musl` target come from `rust-toolchain.toml`.
Docker must be running. Then:
```sh
scripts/release.sh 0.1.0
```