Deploy to Raspberry Pi in One Command: Building a Rust-based Deployment Tool
Source: Dev.to
The Problem
I run a small homelab with multiple Raspberry Pis:
- Pi in living room: Home automation
- Pi in garage: Temperature monitoring
- Pi in basement: Blog and personal sites
Every time I wanted to deploy an update I had to run commands like:
ssh pi@192.168.1.50
cd ~/apps/temperature-monitor
git pull
npm install
sudo systemctl restart temp-monitor
ssh pi@192.168.1.51
# ... repeat ...
ssh pi@192.168.1.52
# ... and again ...
Ansible felt too heavy, Docker Swarm was overkill for three Pis. I just wanted git push → deployed.
The Solution
I built Flare – a lightweight deployment tool in Rust that:
- Auto‑discovers devices on your network
- Deploys from GitHub/Gitea with one command
- Manages apps (start/stop/restart)
- Sets up databases automatically

How It Works
1. Start daemon on your Pi
# On Raspberry Pi
flared
# Listening on :7530
2. Discover devices from your laptop
# On your laptop
$ flare discover
[0] 192.168.1.50:7530 (new)
[1] 192.168.1.51:7530 (new)
$ flare sync 0
Name: pi-living-room
Flare uses UDP broadcast to find devices automatically—no static IPs needed.
3. Add config to your project
Create flare.toml in your repository:
[app]
name = "temp-monitor"
version = "1.0.0"
[run]
command = "python sensor.py"
port = 8080
[database]
type = "sqlite"
name = "readings.db"
4. Deploy!
flare deploy github-user/temp-monitor --device pi-living-room
Real-World Example
Sensor code (sensor.py)
import time
import sqlite3
from flask import Flask, jsonify
from w1thermsensor import W1ThermSensor
app = Flask(__name__)
sensor = W1ThermSensor()
@app.route('/temperature')
def get_temp():
temp = sensor.get_temperature()
# Store in SQLite
conn = sqlite3.connect('readings.db')
c = conn.cursor()
c.execute('INSERT INTO readings VALUES (?, ?)', (time.time(), temp))
conn.commit()
return jsonify({'temperature': temp})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
Corresponding flare.toml
[app]
name = "temperature-monitor"
version = "1.0.0"
[build]
command = "pip install -r requirements.txt"
[run]
command = "python sensor.py"
port = 8080
[database]
type = "sqlite"
name = "readings.db"
preseed = "schema.sql"
[health]
url = "http://localhost:8080/temperature"
timeout = 10
Deploy to all Pis at once:
flare deploy my-github/temp-monitor --device all
Technical Details
- Discovery: UDP broadcast on port 7001
- Authentication: Argon2‑hashed tokens (auto‑generated)
- Transport: TLS‑encrypted TCP (self‑signed certs)
- Protocol: Length‑prefixed messages
- Isolation: Optional systemd scopes
Stack: Rust with Tokio for async, rustls for TLS, clap for CLI, serde for serialization.
Security
Flare generates a unique token for each device during sync:
// CLI generates random token
let token = generate_random_token();
// Hashes with Argon2
let hash = argon2::hash(token);
// Sends hash to daemon
daemon.register(hash);
// Future deploys use this token
deploy_with_token(token);
No passwords to manage; tokens can be rotated anytime.
Performance
On a Raspberry Pi Zero W:
- Binary size: ~10 MB
- RAM usage: ~20 MB idle, ~40 MB during deploy
- Deploy time: 5–15 seconds (repo size dependent)
- CPU: ~5 % idle, ~30 % during deploy
Compared to Ansible:
- Ansible requires Python (100 MB+) and takes minutes to run playbooks, plus inventory maintenance.
Current Limitations 📝
- v0.2 status
- Gateway reverse proxy incomplete (static sites work, APIs coming)
- No Windows daemon support yet
- Single database per app
- Basic health checks only
Try It!
# Install
cargo install flare-cli flare-daemon
# Or download binaries from GitHub
# Quick test
flared &
flare discover
flare deploy your-github/your-app
GitHub:
What’s Next?
- Web dashboard
- Multi‑database support
- Metrics collection
- Plugin system
Conclusion
Flare solved my “I just want to deploy to Pi” problem. It isn’t Kubernetes, but for homelabs and IoT projects, simplicity often wins.
If you’re running a homelab or edge devices, give it a try and share your feedback!