Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

143 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Weatherust

Infrastructure monitoring and automation platform built with Rust

Rust Docker License

Weatherust is a comprehensive Rust-based monitoring and automation platform for infrastructure management, featuring weather monitoring, speed testing, health checks, and system updates across multiple servers.

πŸ“‹ Table of Contents

✨ Features

  • 🌀️ Weather Monitoring - OpenWeatherMap integration with 7-day forecasts
  • ⚑ Speed Testing - Ookla Speedtest CLI with threshold alerts
  • πŸ₯ Health Monitoring - Docker container health and resource tracking
  • πŸ“¦ Update Monitoring - Multi-server OS and Docker image update detection
  • πŸ”„ Update Automation - Remote update application and cleanup operations
  • πŸ”” Dual Notifications - Gotify and ntfy.sh support with action buttons
  • 🐳 Docker-First - Containerized services with Ofelia scheduling
  • πŸ”’ Security-Focused - Constant-time comparisons, minimal key exposure
  • πŸ“Š Observable - Structured logging with tracing and metrics

πŸš€ Quick Start

Prerequisites

  • Docker and Docker Compose
  • OpenWeatherMap API key (for weather service)
  • Notification backend: Gotify and/or ntfy.sh
  • SSH key for remote server access (for update services)

Installation

  1. Clone and configure:

    git clone https://github.com/jsprague84/weatherust.git
    cd weatherust
    cp .env.example .env
  2. Edit .env and configure:

    # OpenWeatherMap
    OWM_API_KEY=your_api_key
    
    # Notifications (choose one or both)
    GOTIFY_URL=https://gotify.example.com/message
    WEATHERUST_GOTIFY_KEY=your_token
    
    # OR/AND
    NTFY_URL=https://ntfy.sh
    WEATHERUST_NTFY_TOPIC=weather
    
    # SSH for remote operations
    UPDATE_SSH_KEY=/home/user/.ssh/id_ed25519
    UPDATE_SERVERS=server1:user@host1,server2:user@host2
  3. Start the stack:

    docker compose pull
    docker compose up -d
  4. Verify:

    docker compose logs -f ofelia
    docker compose ps

Test Individual Services

# Weather check
docker compose run --rm weatherust --zip 52726 --units imperial

# Speed test
docker compose run --rm speedynotify

# Health check
docker compose exec healthmon_runner /app/healthmon health

# Update monitor
docker compose exec updatemon_runner /app/updatemon --docker --local

# Update controller (list servers)
docker compose exec updatectl_runner /app/updatectl list servers

πŸ› οΈ Services

Monitoring Services (Read-Only)

Service Purpose Schedule Details
weatherust Weather monitoring Daily 05:30 README
speedynotify Internet speed tests Daily 02:10 Threshold alerts
healthmon Container health Every 5 min CPU/MEM monitoring
updatemon Update detection Daily 03:00 README

Action Services (Write Operations)

Service Purpose Access Details
updatectl Update controller CLI + Webhook README
updatectl_webhook HTTP API Port 8080 API Docs

πŸ“š Documentation

For Users

For Developers

πŸ’» Development

Local Development

# Build
cargo build --workspace

# Test
cargo test --workspace

# Run specific service
cargo run --bin updatectl -- list servers

# Format and lint
cargo fmt --all
cargo clippy --workspace -- -D warnings

Docker Build

# Build all services
docker build -t weatherust:local .
docker build -f Dockerfile.updatectl -t updatectl:local .
docker build -f Dockerfile.healthmon -t healthmon:local .

Documentation

# Generate API docs
cargo doc --open

For detailed development instructions, see CONTRIBUTING.md.

βš™οΈ Configuration

Notification Backends

Gotify (Self-Hosted)

GOTIFY_URL=https://gotify.example.com/message

# Service-specific tokens
WEATHERUST_GOTIFY_KEY=token1
UPDATEMON_GOTIFY_KEY=token2
UPDATECTL_GOTIFY_KEY=token3
HEALTHMON_GOTIFY_KEY=token4
SPEEDY_GOTIFY_KEY=token5

ntfy.sh (Public or Self-Hosted)

NTFY_URL=https://ntfy.sh  # or your server
NTFY_AUTH=token  # optional for self-hosted

# Service-specific topics
WEATHERUST_NTFY_TOPIC=weather
UPDATEMON_NTFY_TOPIC=updates
UPDATECTL_NTFY_TOPIC=update-actions
HEALTHMON_NTFY_TOPIC=docker-health
SPEEDY_NTFY_TOPIC=speedtest

Server Configuration

# Format: name:user@host or user@host
UPDATE_SERVERS=Office-WS:user@192.168.1.10,Cloud-VM:user@remote.com

# SSH key (only this key is mounted to containers)
UPDATE_SSH_KEY=/home/user/.ssh/id_ed25519

# Local server name (optional)
UPDATE_LOCAL_NAME=docker-vm

Schedule Customization

Edit docker-compose.yml Ofelia labels:

# Example: Run weatherust at 06:00 instead of 05:30
ofelia.job-exec.weatherust.schedule: "0 0 6 * * *"

Cron format: second minute hour day month weekday

🚒 Deployment

Production Deployment

  1. Pin versions in .env:

    WEATHERUST_TAG=v1.0.0
    UPDATECTL_TAG=v1.0.0
    HEALTHMON_TAG=v1.0.0
    UPDATEMON_TAG=v1.0.0
    SPEEDYNOTIFY_TAG=v1.0.0
  2. Configure secrets properly (see Security)

  3. Deploy:

    docker compose pull
    docker compose up -d

Security Best Practices

βœ… DO:

  • Mount only specific SSH key (UPDATE_SSH_KEY)
  • Use service-specific notification tokens
  • Pin Docker image versions for production
  • Rotate secrets periodically
  • Enable --dry-run for testing

❌ DON'T:

  • Mount entire .ssh directory
  • Commit .env file
  • Use latest tag in production
  • Share secrets between environments

Monitoring

# View logs
docker compose logs -f

# Check service status
docker compose ps

# View Ofelia schedule
docker compose logs ofelia

# Check specific service
docker compose logs -f updatectl_webhook

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Ofelia Scheduler               β”‚
β”‚         (Cron-like for Docker)          β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚    β”‚    β”‚    β”‚
     β–Ό    β–Ό    β–Ό    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  weatherust  speedynotify  healthmon   β”‚
β”‚  updatemon                             β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Notifications (Gotify / ntfy.sh)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚  updatectl   β”‚    β”‚  updatectl   β”‚
     β”‚   (CLI)      β”‚    β”‚  (Webhook)   β”‚
     β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                   β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Remote Serversβ”‚
              β”‚    via SSH    β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For detailed architecture, see ARCHITECTURE.md.

πŸ”§ Workspace Structure

weatherust/
β”œβ”€β”€ common/             # Shared library
β”‚   β”œβ”€β”€ error.rs       # Structured error types
β”‚   β”œβ”€β”€ constants.rs   # Configuration constants
β”‚   β”œβ”€β”€ security.rs    # Security utilities
β”‚   β”œβ”€β”€ retry.rs       # Retry logic
β”‚   └── ...
β”œβ”€β”€ weatherust/        # Weather monitoring
β”œβ”€β”€ speedynotify/      # Speed testing
β”œβ”€β”€ healthmon/         # Health monitoring
β”œβ”€β”€ updatemon/         # Update monitoring
└── updatectl/         # Update controller

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes following our code standards
  4. Test thoroughly (cargo test --workspace)
  5. Commit using conventional commits
  6. Push and create a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ†˜ Support


Note: For detailed user documentation including all configuration options, troubleshooting, and examples, see the full README.md.

About

application to schedule weather updates and send to gotify clients

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages