70 lines
2.2 KiB
Markdown
70 lines
2.2 KiB
Markdown
# Remote Services
|
|
|
|
Cargo workspace with the server-side pieces of Noisebell. Runs on any Linux box.
|
|
|
|
| Service | Port | What it does |
|
|
|---------|------|--------------|
|
|
| [`cache-service/`](cache-service/) | 3000 | Polls the Pi, stores history in SQLite, fans out webhooks |
|
|
| [`discord-bot/`](discord-bot/) | 3001 | Posts door status to a Discord channel |
|
|
| [`rss-service/`](rss-service/) | 3002 | Serves an Atom feed of door events |
|
|
| [`noisebell-common/`](noisebell-common/) | — | Shared types and helpers |
|
|
|
|
See each service's README for configuration and API docs.
|
|
|
|
## Building
|
|
|
|
```sh
|
|
cargo build --release
|
|
```
|
|
|
|
Or with Nix:
|
|
|
|
```sh
|
|
nix build .#noisebell-cache
|
|
nix build .#noisebell-discord
|
|
nix build .#noisebell-rss
|
|
```
|
|
|
|
## NixOS deployment
|
|
|
|
The flake exports NixOS modules. Each service runs as a hardened systemd unit behind Caddy.
|
|
|
|
```nix
|
|
{
|
|
inputs.noisebell.url = "git+https://git.extremist.software/jet/noisebell?dir=remote";
|
|
|
|
outputs = { self, nixpkgs, noisebell, ... }: {
|
|
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
|
|
system = "x86_64-linux";
|
|
modules = [
|
|
noisebell.nixosModules.default
|
|
({ ... }: {
|
|
services.noisebell-cache = {
|
|
enable = true;
|
|
domain = "cache.noisebell.example.com";
|
|
piAddress = "http://noisebell-pi:80";
|
|
piApiKeyFile = "/run/secrets/noisebell-pi-api-key";
|
|
inboundApiKeyFile = "/run/secrets/noisebell-inbound-api-key";
|
|
outboundWebhooks = [{
|
|
url = "http://localhost:3001/webhook";
|
|
secretFile = "/run/secrets/noisebell-discord-webhook-secret";
|
|
}];
|
|
};
|
|
services.noisebell-discord = {
|
|
enable = true;
|
|
domain = "discord.noisebell.example.com";
|
|
discordTokenFile = "/run/secrets/noisebell-discord-token";
|
|
channelId = "123456789012345678";
|
|
webhookSecretFile = "/run/secrets/noisebell-discord-webhook-secret";
|
|
};
|
|
services.noisebell-rss = {
|
|
enable = true;
|
|
domain = "rss.noisebell.example.com";
|
|
cacheUrl = "http://localhost:3000";
|
|
};
|
|
})
|
|
];
|
|
};
|
|
};
|
|
}
|
|
```
|