- Add ARCHITECTURE.md with full 4-VPS infrastructure details - Update vps-agents specs: 16GB RAM, 8 dedicated vCPUs - Fix vps-ci specs in diagrams (8GB not 4GB) - Update monthly cost to $228 - Fix /root/cleargrow paths to /opt/repos in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
5.6 KiB
5.6 KiB
ClearGrow Development Platform
System Overview
Self-hosted development platform for the ClearGrow IoT agricultural monitoring system.
Architecture: Distributed 4-VPS setup on Linode (see ARCHITECTURE.md for details)
| VPS | IP | Services | Status |
|---|---|---|---|
| vps-git | 139.144.29.179 | Nginx, PostgreSQL, Gitea | Active |
| vps-track | 170.187.143.45 | Nginx, YouTrack | Active |
| vps-ci | 173.230.138.66 | Nginx, TeamCity, Build Agent, Registry | Active |
| vps-agents | 45.79.204.236 | Agent Runner, Claude Code, Toolchains | Active (this server) |
Service URLs:
- Gitea: https://git.cleargrow.io (vps-git - 139.144.29.179)
- YouTrack: https://track.cleargrow.io (vps-track - 170.187.143.45)
- TeamCity: https://ci.cleargrow.io (vps-ci - 173.230.138.66)
Repositories
| Repository | Path | Technology | Purpose |
|---|---|---|---|
| controller | /opt/repos/controller |
ESP-IDF (C) | ESP32-S3 touchscreen controller with Thread Border Router |
| probe | /opt/repos/probe |
Zephyr (C) | nRF52840 wireless sensor probes |
| docs | /opt/repos/docs |
Markdown | Technical documentation |
| devplatform | /root/claude |
Config | Platform configuration and Claude Code setup |
Quick Commands
# vps-git management (Gitea)
ssh -i ~/.ssh/cleargrow_ed25519 root@139.144.29.179
systemctl status vps-git
docker compose -f /opt/devplatform/docker-compose.yml ps
docker compose -f /opt/devplatform/docker-compose.yml logs -f
# vps-track management (YouTrack)
ssh -i ~/.ssh/cleargrow_ed25519 root@170.187.143.45
systemctl status vps-track
docker compose -f /opt/devplatform/docker-compose.yml ps
docker compose -f /opt/devplatform/docker-compose.yml logs -f
# vps-ci management (TeamCity)
ssh -i ~/.ssh/cleargrow_ed25519 root@173.230.138.66
systemctl status vps-ci
docker compose -f /opt/devplatform/docker-compose.yml ps
docker compose -f /opt/devplatform/docker-compose.yml logs -f
# vps-agents (this server) - Agent Runner
sudo systemctl status cleargrow-agent-runner
sudo journalctl -u cleargrow-agent-runner -f
# Controller firmware (ESP-IDF) - on vps-agents
cd /opt/repos/controller
source ~/esp/esp-idf/export.sh
idf.py build
# Probe firmware (Zephyr) - on vps-agents
cd /opt/repos/probe
west build -b nrf52840dk_nrf52840
Code Style
ESP-IDF (Controller)
- Use ESP-IDF component architecture
- Prefix component functions with component name (e.g.,
wifi_manager_init()) - Use ESP_LOG macros for logging
- Store persistent data in NVS
- Follow FreeRTOS task patterns
Zephyr (Probe)
- Use Zephyr devicetree for hardware abstraction
- Use Kconfig for configuration options
- Follow Zephyr coding style (4-space indent)
- Use power management APIs for sleep modes
Documentation
- Follow Diátaxis framework (guides/reference/project)
- Use templates from
_templates/ - Keep user docs separate from developer docs
Project Architecture
Controller Components
Key components in /opt/repos/controller/components/:
wifi_manager/- WiFi connection and provisioningdisplay/- LVGL UI and touch handlingthread_manager/- Thread Border Routersensor_hub/- Sensor data aggregation from probesnetwork_api/- REST API and MQTT publishingsettings/- NVS-backed configuration
Probe Architecture
Key files in /opt/repos/probe/src/:
thread_node.c- Thread networking and CoAP clientsensor_manager.c- Sensor polling and data aggregationpower_manager.c- Sleep modes and battery monitoring
Protocol
Probes communicate with controller via CoAP over Thread using TLV format.
Testing
Controller
# Unit tests (host-based)
cd /opt/repos/controller
idf.py --project-dir test build
./test/build/test_app
# Integration test on device
idf.py flash monitor
Probe
cd /opt/repos/probe
west build -b native_posix -- -DCONFIG_TEST=y
./build/zephyr/zephyr.exe
YouTrack Integration
Issue references in commit messages:
CG-123- Links commit to issueCG-123 #fixed- Links and transitions to Fixed stateCG-123 #in-progress- Links and transitions to In Progress
Agent Workflow States
Issues flow through these YouTrack states:
- Backlog - New issues
- Ready - Specs complete, ready for agent
- In Progress - Agent working
- Verify - Code review
- Document - Documentation updates
- Review - User final review
- Done - Closed
Common Tasks
Adding a new sensor type to probe
- Add sensor driver to
probe/src/sensors/ - Register in
sensor_manager.c - Add measurement type to TLV protocol
- Update controller's
sensor_hubto parse new type - Add UI display in controller's
displaycomponent
Adding a new REST endpoint to controller
- Define handler in
network_api/api_handlers.c - Register route in
network_api/network_api.c - Document in
docs/reference/api/
Creating a new UI screen
- Add screen file in
controller/components/display/screens/ - Register in screen manager
- Document in
docs/reference/ui/
Debugging Tips
Controller
- Use
idf.py monitorfor serial console - Enable verbose logging:
esp_log_level_set("*", ESP_LOG_VERBOSE) - Use JTAG for hardware debugging
Probe
- Use
west debugfor GDB debugging - Enable RTT logging for non-intrusive debugging
- Check Thread state with
ot stateshell command
Memory Constraints
Controller (ESP32-S3)
- Internal SRAM: ~320KB
- PSRAM: 8MB (frame buffers, history, TFLite)
- Flash: 16MB
Probe (nRF52840)
- RAM: 256KB
- Flash: 1MB
- Optimize for low power sleep modes