Includes: - Backend services: ingestion (:8001), weather API (:8002), gateway (:8003), billing (:8004) with BTCPay integration - Shared asyncpg pool, TimescaleDB hypertable, Redis, Mosquitto MQTT - React frontend: Dashboard (MapLibre) and Messaging (chat UI) - Bridge daemon for Pi + Meshtastic (Serial/TCP T-Deck support) - Production Docker Compose, Nginx reverse proxy, ops scripts - DEPLOY.md with step-by-step deployment guide
59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# KosmoConnect Bridge Daemon Installer for Raspberry Pi
|
|
# Run this script as root (or with sudo)
|
|
|
|
INSTALL_DIR="/opt/kosmo-bridge"
|
|
SERVICE_FILE="kosmo-bridge.service"
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Please run as root (e.g., sudo ./install.sh)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== KosmoConnect Bridge Installer ==="
|
|
|
|
# 1. Create user
|
|
if ! id -u kosmo &>/dev/null; then
|
|
echo "Creating kosmo user..."
|
|
useradd --system --no-create-home --home-dir "$INSTALL_DIR" kosmo
|
|
fi
|
|
|
|
# 2. Install directory
|
|
echo "Setting up $INSTALL_DIR ..."
|
|
mkdir -p "$INSTALL_DIR"
|
|
cp -r src "$INSTALL_DIR/"
|
|
chown -R kosmo:kosmo "$INSTALL_DIR"
|
|
|
|
# 3. Python virtual environment
|
|
echo "Creating Python venv..."
|
|
python3 -m venv "$INSTALL_DIR/venv"
|
|
"$INSTALL_DIR/venv/bin/pip" install --upgrade pip
|
|
"$INSTALL_DIR/venv/bin/pip" install -r requirements.txt
|
|
|
|
# 4. Systemd service
|
|
echo "Installing systemd service..."
|
|
cp "$SERVICE_FILE" /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
systemctl enable kosmo-bridge.service
|
|
|
|
echo ""
|
|
echo "==========================================="
|
|
echo "Installation complete."
|
|
echo ""
|
|
echo "Before starting the service, edit:"
|
|
echo " /etc/systemd/system/kosmo-bridge.service"
|
|
echo "to set your MQTT_HOST, MQTT_USER, MQTT_PASS, etc."
|
|
echo ""
|
|
echo "For network-connected devices (e.g., T-Deck over WiFi), uncomment:"
|
|
echo " Environment=\"MESHTASTIC_HOST=192.168.1.45\""
|
|
echo " Environment=\"MESHTASTIC_TCP_PORT=4403\""
|
|
echo "and comment out MESHTASTIC_DEVICE."
|
|
echo ""
|
|
echo "Then run:"
|
|
echo " sudo systemctl start kosmo-bridge"
|
|
echo " sudo systemctl status kosmo-bridge"
|
|
echo " sudo journalctl -u kosmo-bridge -f"
|
|
echo "==========================================="
|