Skip to content

rob-hooke/beehive

Repository files navigation

🐝 Beehive - Raspberry Pi 5 Homelab Welcome Banner

A beautiful ASCII art welcome banner for your Raspberry Pi 5 homelab that displays real-time system statistics on SSH login.

License Python Powered by pyinfra

Features

  • 🎨 Beautiful ASCII Art - Eye-catching "BEEHIVE" banner with bee theme
  • πŸ“Š Real-time System Stats - CPU temperature, memory, disk, uptime, load average
  • 🐳 Docker Integration - Shows count of running containers
  • 🎨 Color-coded Status - Green/Yellow/Red indicators based on system health
  • πŸš€ Automated Deployment - One command deployment via pyinfra
  • πŸ”„ Idempotent - Safe to run deployment multiple times
  • πŸ”§ Easy Configuration - Environment-based settings

Banner Preview

╔══════════════════════════════════════════════════════╗
β•‘                     🐝 BEEHIVE 🐝                    β•‘
β•‘           Raspberry Pi 5 Homelab Status              β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

  Hostname:    beehive
  Uptime:      5 days, 12 hours
  CPU Temp:    52.3Β°C    [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘] OK
  Memory:      2.1/7.8GB [β–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘] 27%
  Disk:        45/256GB  [β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘] 18%
  Load Avg:    0.45, 0.38, 0.29
  Docker:      12 containers running

Prerequisites

  • Raspberry Pi 5 with Raspberry Pi OS (64-bit recommended)
  • SSH access to the Pi configured
  • SSH key set up for passwordless authentication
  • Python 3.9+ on your development machine (WSL/Linux/Mac)

Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/beehive.git
cd beehive

2. Install Dependencies (on your WSL/local machine)

make setup
# or manually: pip install -r requirements.txt

3. Configure Environment Variables

cp .env.example .env

Edit .env and set your Raspberry Pi's details:

[email protected]
BEEHIVE_SSH_KEY=~/.ssh/id_rsa

Replace hooke with your Pi username and 10.0.0.150 with your Pi's IP address.

4. Test Deployment (Dry Run)

make dry-run

This will show what changes would be made without actually applying them.

5. Deploy to Raspberry Pi

make deploy

That's it! The banner will now display when you SSH into your Raspberry Pi.

Available Commands

Setup & Deployment

Command Description
make help Show all available commands
make setup Install Python dependencies on your local machine
make dry-run Test banner deployment without making changes
make deploy Deploy banner to Raspberry Pi
make status Run banner remotely and display output

First-time / Fresh OS Install

Command Description
make ssh-bootstrap Copy your SSH public key to the Pi and disable password auth (uses password login β€” run once after a fresh OS install)

Tailscale

Command Description
make tailscale-install Install Tailscale and start the daemon on the Pi

Pi-hole

Command Description
make pihole-install Install Pi-hole DNS ad blocker on the Pi

After installing, SSH into the Pi and authenticate manually:

# With an auth key (headless):
sudo tailscale up --authkey=<your-auth-key> --ssh

# Or interactively (follow the login URL):
sudo tailscale up --ssh

# Verify:
tailscale status

Recommended order for a fresh Pi

make ssh-bootstrap     # 1. Set up SSH key auth (needs password in .env)
make deploy            # 2. Deploy the welcome banner
make tailscale-install # 3. Install Tailscale
                       # 4. SSH in and run: sudo tailscale up --ssh
make pihole-install    # 5. Install Pi-hole (interactive β€” follow the prompts)

How It Works

  1. Pyinfra connects to your Raspberry Pi via SSH
  2. Installs required Python libraries (rich, psutil) on the Pi
  3. Copies the banner.py script to /usr/local/bin/banner.py
  4. Makes the script executable
  5. Adds the banner to /home/hooke/.bashrc so it displays on SSH login

The deployment is idempotent, meaning you can run make deploy multiple times safely - it will only make changes if needed.

Usage

Automatic Display

The banner displays automatically when you SSH into your Raspberry Pi:

Manual Display

Run the banner manually on the Pi:

/usr/local/bin/banner.py

Disable Auto-Display

To prevent the banner from showing on SSH login, remove the line from your .bashrc:

# On the Pi
sed -i '/banner.py/d' ~/.bashrc

System Requirements

On Raspberry Pi:

  • Raspberry Pi OS (Bookworm or later recommended)
  • Python 3.9+
  • 100MB free disk space

On Development Machine (WSL/Linux/Mac):

  • Python 3.9+
  • SSH client
  • Git

Color Indicators

The banner uses color coding to help you quickly identify potential issues:

CPU Temperature

  • 🟒 Green (< 60Β°C): Healthy
  • 🟑 Yellow (60-74Β°C): Warm
  • πŸ”΄ Red (β‰₯ 75Β°C): Hot (throttling risk)

Memory Usage

  • 🟒 Green (< 70%): Healthy
  • 🟑 Yellow (70-84%): High
  • πŸ”΄ Red (β‰₯ 85%): Critical

Disk Usage

  • 🟒 Green (< 80%): Healthy
  • 🟑 Yellow (80-89%): High
  • πŸ”΄ Red (β‰₯ 90%): Critical

Troubleshooting

.env file not found error

cp .env.example .env
# Edit .env with your Pi's details

SSH connection fails

  • Verify your Pi's IP address: ping 10.0.0.150
  • On a fresh OS install, run make ssh-bootstrap first to set up key auth
  • Check SSH key is set up: ssh-copy-id [email protected]
  • Test manual SSH: ssh [email protected]

Banner not showing on SSH login

# Manually add it to .bashrc on the Pi
echo '/usr/local/bin/banner.py' >> ~/.bashrc

Docker count shows as None

This is normal if Docker is not installed. The banner will simply not display the Docker line.

Future Enhancements

This is just the beginning! Future plans include:

  • πŸ—οΈ Full Infrastructure as Code - Deploy entire homelab with pyinfra
  • 🏠 Home Assistant - Automated setup with add-ons (MQTT, Node-RED, ESPHome)
  • 🌐 Network Services - Pi-hole, DNS, VPN, reverse proxy
  • πŸ“ˆ Monitoring Stack - Prometheus, Grafana, alerting
  • πŸ’Ύ Backup/Restore - Automated backup scripts
  • πŸ”” Notifications - Telegram/Discord alerts for system events

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

Acknowledgments

  • Built with pyinfra - Fast and flexible infrastructure automation
  • Styled with rich - Beautiful terminal formatting
  • System stats via psutil - Cross-platform system utilities

Made with 🐝 for homelabbers everywhere

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors