Red-Lavalink logs its connection headers, password included, every time Audio connects. The Red image now imports dogebot.logfilter through a .pth file at interpreter startup, which adds a filter to that logger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUebqhE8dK19vyn4Ct5g1L
Dogebot
A Discord bot built on Red-DiscordBot 3.5, deployed as rootless podman containers with quadlets. Music (Audio, AudioTrivia) runs on its own Lavalink, which updates itself daily, together with its YouTube plugin and yt-cipher, so that playback keeps working when YouTube changes.
What runs
graph LR
discord[Discord] --- red[dogebot-red<br/>Red 3.5 + dogesetup cog]
red --> pg[(dogebot-postgres)]
red -->|ws :2333| lava[dogebot-lavalink<br/>Lavalink 3.7 red build<br/>+ youtube-plugin]
lava -->|signatures| cipher[dogebot-yt-cipher]
lava --> yt[YouTube / SoundCloud / ...]
timer[dogebot-update.timer] -.->|build, smoke test, swap| lava
timer -.->|podman auto-update| cipher
| Container | Image | Updates |
|---|---|---|
dogebot-red |
localhost/dogebot-red:latest, built from containers/red |
rebuild after changing uv.lock |
dogebot-lavalink |
localhost/dogebot-lavalink:current, built from containers/lavalink |
daily, by dogebot-update (below) |
dogebot-yt-cipher |
ghcr.io/kikkia/yt-cipher:master |
daily, podman auto-update with rollback |
dogebot-postgres |
docker.io/library/postgres:16-alpine |
daily, podman auto-update with rollback |
All four share the dogebot network. Only Lavalink publishes a port, on 127.0.0.1:2333, for the smoke test.
Cogs
src/dogebot/manifest.py lists them. On every start the dogesetup cog adds the repos, installs missing
cogs, loads everything, and points Audio at dogebot-lavalink. It then updates the repos and reloads changed
cogs every 24 hours (DOGEBOT_COG_UPDATE_HOURS). Owners can run d!dogesetup to do all of that at once.
| Cog | From |
|---|---|
| admin, audio, mod, modlog, permissions, reports, warnings | Red (core) |
| starboard, roletools, serverstats | TrustyJAID/Trusty-cogs |
| audiotrivia | bobloy/Fox-V3 |
| reactchannel | PhasecoreX/PCXCogs |
| timezone | aikaterna/aikaterna-cogs (branch v3) |
| userinfo | flaree/Flare-Cogs |
Music: how it stays working
YouTube playback depends on three moving parts:
- Lavalink itself. Red 3.5 speaks Lavalink's v3 protocol, so this is Red's own build of Lavalink 3.7, from Cog-Creators/Lavalink-Jars, not upstream Lavalink 4.
- The youtube-source plugin. It signs in to YouTube with
an OAuth refresh token and uses the
TVandWEBclients. - yt-cipher, which deciphers YouTube's stream signatures for the plugin.
dogebot-update (daily, from dogebot-update.timer):
- Finds the newest Red Lavalink build, the newest youtube-source release, and the newest youtube-source snapshot (a build of every commit, where YouTube fixes land first).
- For each new combination, release first, builds an image tagged
:candidate. - Starts that candidate next to the live Lavalink and checks that it can search YouTube and load a YouTube
video (
src/dogebot/lavalink.py). - Promotes the first candidate that passes: it becomes
:current(the old one is kept as:previous), and Lavalink restarts. If the restarted service fails the same check, it rolls back. - If the version already running still passes, it stops there. If it fails, for example because YouTube broke the release, it goes on to try the snapshot.
- Runs
podman auto-updatefor yt-cipher and Postgres.
The versions running now are in ~/.local/state/dogebot/lavalink.json. To check music by hand:
LAVALINK_PASSWORD=$(podman secret inspect --showsecret --format '{{.SecretData}}' dogebot-lavalink-password) mise run smoke
The smoke test covers loading tracks, not actual playback, which needs a Discord voice connection.
Deploy
Needs rootless podman 4.4 or newer (quadlets), mise, and lingering for the user
(loginctl enable-linger).
git clone https://gitea.godemperordoge.org/ziadarafat/dogebot.git ~/src/dogebot
cd ~/src/dogebot && mise trust && mise install && mise run sync
DOGEBOT_DISCORD_TOKEN=... DOGEBOT_YOUTUBE_REFRESH_TOKEN=... deploy/install.sh # add --start to start the bot too
install.sh creates the podman secrets, builds both images, installs the quadlets into
~/.config/containers/systemd/dogebot/ and the timer into ~/.config/systemd/user/, and starts everything except
the bot. It leaves the bot stopped unless you pass --start, so that two copies never log in with one token.
| Podman secret | Used by | Source |
|---|---|---|
dogebot-discord-token |
Red (RED_TOKEN) |
DOGEBOT_DISCORD_TOKEN |
dogebot-youtube-refresh-token |
Lavalink | DOGEBOT_YOUTUBE_REFRESH_TOKEN |
dogebot-postgres-password |
Postgres, Red | generated |
dogebot-lavalink-password |
Lavalink, Red | generated |
dogebot-yt-cipher-token |
yt-cipher, Lavalink | generated |
If the YouTube refresh token stops working, Lavalink logs a device code: sign in at google.com/device with the bot's YouTube account, then put the new refresh token from the log into the secret.
systemctl --user status dogebot-red dogebot-lavalink dogebot-yt-cipher dogebot-postgres
journalctl --user -u dogebot-red -f
systemctl --user start dogebot-update # update Lavalink now
Development
mise installs uv, and uv installs Python 3.11 and the dependencies.
mise install && mise run sync
mise run fmt # ruff format + ruff check --fix
mise run check # lint, ty type check, tests
mise run build # both images
Ruff settings are the ones from the lptn projects (80 columns, 8-space indents, a wide rule set). Code is fully annotated and checked with ty.
dogesetup uses Red's internal Downloader and Core methods (the same ones behind [p]cog install). Red is
pinned in pyproject.toml, and tests/test_red_contract.py fails if an upgrade removes or renames them.