51 lines
1.8 KiB
Markdown
51 lines
1.8 KiB
Markdown
# 10Backward
|
|
|
|
Daily Mastodon throwback bot scaffolded with Docker Compose.
|
|
|
|
The container runs a cron daemon that invokes the Python entrypoint once per
|
|
day at the configured `RUN_AT` (Europe/Berlin default). The actual blog
|
|
clone / post pipeline is intentionally stubbed in this scaffold and is to be
|
|
implemented in a follow-up job — this repository currently ships:
|
|
|
|
- Pinned Python dependency manifest.
|
|
- `Dockerfile` (python:3.11-slim + cron + git + ca-certificates + tzdata).
|
|
- `docker-compose.yml` building locally, mounting `.env` read-only and
|
|
persisting `./data` for the blog clone and `posted.json` state.
|
|
- `entrypoint.sh` that validates required env vars and fails clearly on
|
|
startup before launching `cron -f` in the foreground.
|
|
- Safe `.env.example` with placeholder credentials only.
|
|
|
|
## Build & run
|
|
|
|
```bash
|
|
cp .env.example .env # fill in real credentials locally
|
|
docker compose build
|
|
docker compose up -d
|
|
docker compose logs -f bot
|
|
```
|
|
|
|
`./data` is persisted across restarts on the host. The blog clone (added in a
|
|
follow-up job) will live in `./data/blog/`, and posted-state in
|
|
`./data/posted.json`.
|
|
|
|
## Configuration
|
|
|
|
| Variable | Required | Default | Notes |
|
|
| --- | --- | --- | --- |
|
|
| `MASTODON_BASE_URL` | yes | — | e.g. `https://mastodon.social` |
|
|
| `MASTODON_ACCESS_TOKEN` | yes | — | never commit |
|
|
| `SITE_URL` | yes | — | source blog URL (HTTPS) |
|
|
| `HASHTAGS` | yes | — | comma-separated, e.g. `#throwback,#10backward` |
|
|
| `RUN_AT` | yes | `09:00` | `HH:MM` in `TZ` |
|
|
| `MASTODON_VISIBILITY` | no | `public` | `public`, `unlisted`, `private`, `direct` |
|
|
| `THROWBACK_PREFIX` | no | `Throwback:` | German-localizable |
|
|
| `RETRY_COUNT` | no | `3` | post retries |
|
|
| `TZ` | no | `Europe/Berlin` | any IANA timezone |
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
pip install -r requirements-dev.txt
|
|
pytest
|
|
```
|