--- name: sylvia-iot-services description: Deploy, manage, and operate Sylvia-IoT platform services. Use this skill whenever the user wants to start, stop, reset, or check the status of Sylvia-IoT services — whether for local development, E2E testing, demos, or production. Triggers on mentions of sylvia-iot-core, sylvia-router, or any Sylvia-IoT deployment context, even if the user doesn't say "deploy" explicitly (e.g. "I need the backend up for testing", "set up a demo environment", "switch from core to router"). --- # Sylvia-IoT Services Sylvia-IoT is an open-source IoT platform that routes device messages to applications. Core modules: auth, broker, coremgr, data. The `sylvia-router` binary bundles all core modules plus IP router functionality. All deployment logic lives in the [woofdogtw/sylvia-iot-deployment](https://github.com/woofdogtw/sylvia-iot-deployment) repo. **Always download the latest scripts from GitHub to `/tmp/sylvia-iot-deployment/` before running anything** — these scripts are the source of truth and handle all the complexity. ## Step 1: Download Scripts ```bash if [ -d /tmp/sylvia-iot-deployment ]; then git -C /tmp/sylvia-iot-deployment pull else git clone https://github.com/woofdogtw/sylvia-iot-deployment /tmp/sylvia-iot-deployment fi ``` ## Step 2: Clarify Intent Ask what's needed. Use context clues to skip obvious questions. When in doubt, apply the defaults below. | Question | Options | Default | |----------|---------|---------| | Operation | start / stop / status / reset-db / remove | start | | Deployment method | scripts / compose / kustomize / systemd | scripts | | Binary | core / router | **router** | | Optional services | lora-ifroglab, app-demo | both (demo), none (E2E test) | | GUI | yes / no | yes (demo), no (E2E test) | | Database (scripts only) | sqlite / mongodb | sqlite | **Tip:** If the user mentions "testing" or "E2E", lean toward `--bin core` or `--bin router` without GUI. If they mention "demo" or "show", use router + lora-ifroglab + app-demo + GUI. **Common combo for demos:** ```bash ./start.sh --bin router --with lora-ifroglab,app-demo --gui ``` ## Step 3: Check Prerequisites Before running scripts, verify: - **Docker**: `docker info` (all methods except systemd for infra) - **sqlite3**: `command -v sqlite3` (scripts method with sqlite) - **kubectl + kustomize**: `kubectl version` (kustomize method) - **sudo access**: systemd method requires `sudo` If something is missing, tell the user what to install and stop. ## Step 4: Run the Appropriate Scripts ### scripts/ — Local dev/test (native binaries) ```bash cd /tmp/sylvia-iot-deployment/scripts # Start ./start.sh [--db sqlite|mongodb] [--bin core|router] [--with lora-ifroglab,app-demo] [--gui] [--host HOSTNAME] # Stop (containers stopped but not removed) ./stop.sh # Status ./status.sh # Reset database only ./reset-db.sh [--db sqlite|mongodb] ``` No "remove" operation for scripts — just stop. Data persists in the scripts/ directory. ### compose/ — Docker Compose ```bash cd /tmp/sylvia-iot-deployment/compose # Start (also configures .env) ./setup.sh [--with lora-ifroglab,app-demo] [--host HOSTNAME] [--port PORT] # Stop (containers removed, data volumes kept) ./setup.sh --down # Remove everything including data ./setup.sh --down-v ``` ### kustomize/ — Kubernetes ```bash cd /tmp/sylvia-iot-deployment/kustomize/overlays/sylvia-iot-core # Start ./install.sh # Remove kubectl delete -k . ``` Note: `sylvia-router` is NOT supported in kustomize (it manages host network interfaces). ### systemd/ — Ubuntu/Debian production ```bash cd /tmp/sylvia-iot-deployment/systemd # Install and start sudo ./install.sh [--bin core|router] [--with lora-ifroglab,app-demo] [--gui] [--host HOSTNAME] # Uninstall sudo ./install.sh --uninstall ``` ## Default Credentials | Service | URL | Credentials | |---------|-----|-------------| | Sylvia-IoT + GUI | http://localhost:1080 | admin / admin | | RabbitMQ | http://localhost:15672 | guest / guest | | EMQX Dashboard | http://localhost:18083 | admin / public | ## Switching Between core and router Both `sylvia-iot-core` and `sylvia-router` listen on port 1080. To switch: 1. Stop the currently running service 2. Start the new one For scripts method: ```bash ./stop.sh ./start.sh --bin router # or --bin core ```