mirror of
https://github.com/ewanc26/bluesky-moon-tracker.git
synced 2026-07-21 15:33:21 +00:00
Mirror of github.com/ewanc26/bluesky-moon-tracker
- Rust 96.3%
- Nix 3.7%
| src | ||
| .env.example | ||
| .gitattributes | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| AGENTS.md | ||
| Cargo.toml | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
Bluesky Moon Tracker
This repository is available on GitHub and Tangled. GitHub is the primary version, and the Tangled version is a mirror.
Bluesky Moon Tracker is a small Rust bot that posts the current moon phase to Bluesky once per day at 00:00 UTC. It prefers moon data from the Skytime API, falls back to a local lunar calculation when needed, and can optionally use Ollama to generate the post text.
🧶 Also available on Tangled
Features
- Posts once per day at 00:00 UTC with a graceful shutdown loop
- Fetches moon phase data from Skytime and falls back to a local calculation if the API is unavailable
- Optionally uses Ollama to generate the post text
- Falls back to template-based message generation if Ollama is not configured or fails
- Supports a debug mode for generating sample messages or posting immediately with credentials
- Designed to run as a background service such as a macOS launchd job
Requirements
- Rust 2024 toolchain with
cargo - A Bluesky account and app password
- Optional: Ollama installed locally if you want AI-generated post text
Configuration
Create a .env file in the repository root:
BLUESKY_USERNAME=your_handle.bsky.social
BLUESKY_PASSWORD=your_app_password
BLUESKY_PDS_URL=https://bsky.social
DEBUG_MODE=false
OLLAMA_MODEL=llama3.2
OLLAMA_URL=http://localhost:11434
OLLAMA_TIMEOUT=30000
Environment variables
BLUESKY_USERNAME/BLUESKY_PASSWORD— Bluesky login credentialsBLUESKY_PDS_URL— optional PDS URL, defaults tohttps://bsky.socialDEBUG_MODE— set totrueto print sample messages or post immediately when credentials are presentOLLAMA_MODEL— enables Ollama generation when setOLLAMA_URL— Ollama server URL, defaults tohttp://localhost:11434OLLAMA_TIMEOUT— request timeout in milliseconds, defaults to30000
Usage
Development
cargo run
Release build
cargo build --release
./target/release/bluesky-moon-tracker
Debug mode
Set DEBUG_MODE=true to run the template generator without scheduling posts. If Bluesky credentials are present, the bot posts immediately once and exits its debug flow.
Project structure
src/
├── main.rs # Entry point, config loading, runtime mode selection
├── config.rs # Environment parsing
├── bluesky.rs # Bluesky login and post creation
├── scheduler.rs # UTC-midnight scheduler
└── moon/
├── api.rs # Skytime + local moon phase lookup
├── calc.rs # Local lunar phase calculation
├── constants.rs # Phases, aliases, and message constants
└── messages.rs # Template and Ollama message generation
Notes
- Skytime is tried first; local phase calculation is used as a fallback.
- Ollama is optional. If it is not configured or unavailable, the bot uses template messages instead.
- The bot is intended to be run continuously as a background process or service.
Run the bot with Cargo:
cargo run
Or run the release binary directly:
If you found this useful, consider buying me a ko-fi!