- Python 97.4%
- Dockerfile 2.6%
|
All checks were successful
Build and push container image / build (push) Successful in 46s
Generate hashtags from town names mentioned in fire updates, prioritising new fires over changed over removed. Town tags are trimmed to keep the post within Mastodon's 500-character limit. Also removes #EmergencyUpdate from the base tags. |
||
|---|---|---|
| .forgejo/workflows | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| test_wildfire_monitor.py | ||
| wildfire_data_retriever.py | ||
| wildfire_monitor.py | ||
Wildfires
Monitors active wildfire emergencies in Catalonia and posts updates to Mastodon when something changes.
Data source: Catalonia fire service via ArcGIS Feature Server.
How it works
On each run the script fetches the current list of active emergencies, compares it to the previous run (stored in wildfire_data.json), and posts a summary to Mastodon only when something has changed (new fires, status changes, or fires no longer active). The first run bootstraps the state silently without posting.
Configuration
Copy .env.example to .env and fill in:
MASTODON_INSTANCE_URL=https://your-instance.social/
MASTODON_ACCESS_TOKEN=your-token-here
DATA_FILE=wildfire_data.json # optional, defaults to current directory
Running locally
pip install -r requirements.txt
python wildfire_monitor.py # fetch and display, no post
python wildfire_monitor.py --post-to-mastodon # fetch, display, and post if changed
Container
docker build -t wildfires .
docker run --rm --env-file .env -v ./data:/data wildfires
Deployment
The container image is built automatically via Forgejo Actions on push to main and pushed to codeberg.org/cdamian/wildfires:latest.
On onyx (the Mastodon server) it runs every 2 hours via a systemd timer using Podman. State persists in /var/lib/wildfires/wildfire_data.json on the host.