- Python 98.8%
- Dockerfile 1.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| argocd | ||
| deploy | ||
| docs | ||
| tests | ||
| waifu | ||
| .gitignore | ||
| Dockerfile | ||
| main.py | ||
| pyproject.toml | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
Acid Waifu
Waifu posting automation for a better future
Selects posts from waifu.im and posts waifus on discord.
- main.py: thin entrypoint that boots the application
- waifu/: package containing config, image api client, tagger client, discord bot, metrics, tracing, and logging setup
Deployment
You need:
- Discord bot token
- Discord channel id to post in (the bot needs post access to it)
You have two options for deployment: single container or helm chart.
- Single container: build the image with
Dockerfileand runmain.py. - Helm chart: install the chart in
chart/acidwaifu/. See the chartvalues.yamlfor the configurable options (schedule, image, and all behavioural tunables).
The application is configured entirely through environment variables — see
waifu/config.py for the full list.
Development
Install the development dependencies and run the same checks as CI:
python3 -m venv .venv
.venv/bin/pip install -r requirements-dev.txt
.venv/bin/black .
.venv/bin/mypy .
.venv/bin/pytest
Releasing
Two environments are declared in app/argocd.yaml and synced by Argo CD.
- test renders
chart/acidwaifufrommainand runs the mutable:latestimage. Merging tomainis the deployment: CI validates the commit and builds:latest, and Argo CD renders the new chart. - prod tracks stable packaged charts with
targetRevision: "4.*". The chart version and image tag are coupled through the chart'sappVersion.
Create a production release by tagging a commit that is on main:
git tag v4.1.0
git push origin v4.1.0
CI then:
- rejects non-
vX.Y.Ztags and tags that are not reachable frommain, - runs black, mypy, and pytest,
- builds
git.pr0.tech/rs/acidwaifu:v4.1.0, - publishes chart
4.1.0withappVersion: v4.1.0, - Argo CD syncs prod to the newest
4.*chart, which renders the matching image tag.
Release tags never move :latest; that tag belongs to main and to the test
environment.
Rollback
A deploy or rollback affects the next CronJob run; an already running job
keeps the image it started with. Automatic sync disables
argocd app rollback, so roll back in git by pinning prod to the previous
chart version in app/argocd.yaml:
targetRevision: "4.0.0"
Commit that change, verify prod, then restore targetRevision: "4.*" to
resume automatic stable releases.