···11+# Parakeet PLC Mirror
22+33+A little Rust mirror of Bluesky Social PBC's [plc.directory](https://web.plc.directory/)
44+for use with the [Parakeet AppView](https://gitlab.com/parakeet-social/parakeet) project.
55+66+All endpoints bar `/export` and `/{did}/data` are implemented and should be functionally identical.
77+88+## Running
99+1010+### Prerequisites
1111+1212+- Either Docker, or a binary from [Compiling](#compiling)
1313+- Postgres (tested with 16, but any recent version should work)
1414+1515+### Running PLC Mirror
1616+1717+A docker image is provided as `registry.gitlab.com/parakeet-social/plc-mirror`, or you can [compile](#compiling) a binary.
1818+1919+Complete the below environment variables:
2020+2121+| Variable | Description | Default |
2222+|-------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
2323+| `PLC_DB_URI` | (required) Postgres DB URI in format `postgres://{user}:{pass}@{addr}/{db}` | |
2424+| `PLC_UPSTREAM` | (optional) Upstream PLC directory to import from | `https://plc.directory` |
2525+| `PLC_BIND_ADDR` | (optional) The address and port to bind to, in format `{IP}:{port}` | `127.0.0.1:8080` |
2626+| `PLC_USER_AGENT` | (recommended) The User-Agent header to set on export requests from upstream. Setting this is highly advised | `parakeet-plc` |
2727+| `PLC_START_AFTER` | (optional) Where in time to start importing from PLC. Leaving blank will trigger an import from the beginning of the directory or from the last seen TS if applicable. In format `2018-01-26T18:30:09.453Z`. | |
2828+2929+Then, run the binary. Imports from the upstream directory will begin immediately alongside the API server.
3030+3131+## Compiling
3232+3333+You'll need [Rust](https://www.rust-lang.org/), Cargo, and openssl-dev (aka libssl-dev) to build.
3434+Builds are tested on Rust 1.85.
3535+3636+A simple `cargo b` or `cargo r` should work just fine, likewise for release options.
3737+3838+## License & Contributing
3939+4040+This project is licensed under Apache-2. Contributions are welcome, but please discuss first.