Skip to content

apimgr/weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Service

Build Release Documentation License

About

A unified weather information platform that aggregates global meteorological data from authoritative sources into a single, accessible service for developers, businesses, and end users.

Weather Service combines forecasts, severe weather alerts, earthquakes, hurricanes, and lunar data from 10+ government agencies worldwide through one consistent API and web interface.

Official Site

https://weather.apimgr.us

Features

  • Global weather forecasts (16-day) via Open-Meteo
  • Severe weather alerts from 6 countries (NOAA, Environment Canada, UK Met Office, BOM, JMA, CONAGUA)
  • Real-time earthquake monitoring via USGS
  • Hurricane/tropical storm tracking via NOAA NHC
  • Moon phase calculations
  • Automatic IP-based location detection
  • WebSocket real-time notifications
  • Single static binary with all assets embedded
  • Multi-platform (Linux, macOS, Windows, FreeBSD - amd64/arm64)
  • Production grade with rate limiting, caching, health checks

Production

Docker (Recommended)

docker run -d \
  --name weather \
  -p 64580:80 \
  -v ./rootfs/config:/config:z \
  -v ./rootfs/data:/data:z \
  ghcr.io/apimgr/weather:latest

Docker Compose

curl -O https://raw.githubusercontent.com/apimgr/weather/main/docker/docker-compose.yml
docker compose up -d

Binary

# Download latest release
curl -LO https://github.com/apimgr/weather/releases/latest/download/weather-linux-amd64

# Make executable and run
chmod +x weather-linux-amd64
./weather-linux-amd64

Systemd Service

# Download and install
sudo mv weather-linux-amd64 /usr/local/bin/weather
sudo useradd -r -s /bin/false weather
sudo mkdir -p /var/lib/weather/{data,config}
sudo chown -R weather:weather /var/lib/weather

# Create service
sudo tee /etc/systemd/system/weather.service > /dev/null <<EOF
[Unit]
Description=Weather API Service
After=network.target

[Service]
Type=simple
User=weather
ExecStart=/usr/local/bin/weather
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now weather

CLI Client

A companion CLI client is available for interacting with the server API.

Install

# Download latest release
curl -LO https://github.com/apimgr/weather/releases/latest/download/weather-cli-linux-amd64
chmod +x weather-cli-linux-amd64
sudo mv weather-cli-linux-amd64 /usr/local/bin/weather-cli

Configure

# Connect to server (creates ~/.config/apimgr/weather/cli.yml)
weather-cli --server https://api.example.com --token YOUR_API_TOKEN

Usage

weather-cli --help
weather-cli weather Brooklyn,NY
weather-cli severe-weather
weather-cli moon

Configuration

Configuration is auto-generated on first run. Edit via admin panel at http://{fqdn}:{port}/admin.

Key settings:

  • server.address - Listen address (default: :80)
  • server.mode - production or development

Configuration file: $CONFIG_DIR/server.yml

server:
  address: ":80"
  mode: production

logging:
  level: info
  format: json

geoip:
  update_interval: 168h

cache:
  weather_ttl: 15m
  severe_ttl: 5m

API

API documentation available at /api/v1/ when running.

Endpoint Description
GET /healthz Health check
GET /api/v1/weather/:location Weather forecast
GET /api/v1/severe-weather Severe weather alerts
GET /api/v1/earthquakes Earthquake data
GET /api/v1/hurricanes Hurricane tracking
GET /api/v1/moon Moon phase

Examples

# Weather for location
curl http://localhost/api/v1/weather/Brooklyn,NY

# Severe weather
curl http://localhost/api/v1/severe-weather

# Moon phase
curl http://localhost/api/v1/moon

Other

Data Sources

Troubleshooting

  • Check logs: docker logs weather
  • Health check: curl http://{fqdn}:{port}/healthz
  • Port in use: netstat -tulpn | grep :80

Support

Development

Development instructions are for contributors only.

Prerequisites

  • Docker (for containerized builds)
  • Make

Build

# Clone
git clone https://github.com/apimgr/weather
cd weather

# Quick dev build (outputs to binaries/)
make dev

# Full build (all platforms, outputs to binaries/)
make build

# Test
make test

Project Structure

src/           # Source code
tests/         # Test files
docker/        # Docker files
binaries/      # Built binaries (gitignored)

License

MIT - See LICENSE.md