Translate all README files to Russian
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,31 +1,32 @@
|
||||
# Home Automation Platform
|
||||
# Платформа домашней автоматизации
|
||||
|
||||
A microservice-based home automation platform, built as a portfolio project
|
||||
demonstrating Go (concurrency, message queues, MQTT), PHP/Laravel (API,
|
||||
authorization), and polyglot persistence (PostgreSQL, ClickHouse, Redis).
|
||||
Pet-проект на микросервисной архитектуре для портфолио, демонстрирующий Go
|
||||
(конкурентность, очереди сообщений, MQTT), PHP/Laravel (API, авторизация)
|
||||
и работу с разными БД по назначению (PostgreSQL, ClickHouse, Redis).
|
||||
|
||||
**This is not a "growbox project."** A growbox is the first implemented
|
||||
**zone** with a first set of **device types** (light, pump, fan, temperature
|
||||
sensor). The core system — device management, telemetry, automation rules,
|
||||
users, notifications — operates purely on the abstractions *zone*, *device*,
|
||||
*device type*, *sensor reading*, *command*, *rule*. Nothing growbox-specific
|
||||
is hardcoded in the core: adding a "living room" zone with a "smart plug"
|
||||
device type should require zero changes to service code, only new rows in
|
||||
**Это не «проект гроубокса».** Гроубокс — первая реализованная **зона**
|
||||
с первым набором **типов устройств** (свет, полив, вентиляция, датчик
|
||||
температуры). Ядро системы — управление устройствами, телеметрия, правила
|
||||
автоматизации, пользователи, уведомления — оперирует исключительно
|
||||
абстракциями *зона*, *устройство*, *тип устройства*, *показание датчика*,
|
||||
*команда*, *правило*. Ничего специфичного для гроубокса не зашито в ядре:
|
||||
добавление зоны «гостиная» с типом устройства «умная розетка» не должно
|
||||
требовать изменений в коде сервисов — только новые строки в
|
||||
`device_types` / `zones` / `devices`.
|
||||
|
||||
## Architecture
|
||||
## Архитектура
|
||||
|
||||
```
|
||||
ESP32 (or emulator)
|
||||
ESP32 (или эмулятор)
|
||||
│ MQTT
|
||||
▼
|
||||
ingest-service (Go) ──► ClickHouse (raw telemetry)
|
||||
ingest-service (Go) ──► ClickHouse (сырая телеметрия)
|
||||
│
|
||||
▼ RabbitMQ ("new reading" event)
|
||||
rule-engine-service (Go) ──► PostgreSQL (rules, cached)
|
||||
│ gRPC (on rule match)
|
||||
▼ RabbitMQ (событие "новое показание")
|
||||
rule-engine-service (Go) ──► PostgreSQL (правила, кэшируются)
|
||||
│ gRPC (при срабатывании правила)
|
||||
▼
|
||||
device-control-service (Go) ──► MQTT (command) ──► device
|
||||
device-control-service (Go) ──► MQTT (команда) ──► устройство
|
||||
│
|
||||
▼
|
||||
Redis (device shadow: desired/reported state, status, last_seen)
|
||||
@@ -33,68 +34,69 @@ Redis (device shadow: desired/reported state, status, last_seen)
|
||||
Laravel API (PHP) ──► PostgreSQL / ClickHouse / Redis
|
||||
│ gRPC / HTTP
|
||||
▼
|
||||
device-control-service (manual commands from the UI)
|
||||
device-control-service (ручные команды из UI)
|
||||
```
|
||||
|
||||
## Stack
|
||||
## Стек
|
||||
|
||||
| Concern | Technology |
|
||||
| Назначение | Технология |
|
||||
|---|---|
|
||||
| Device firmware / emulator | Go (`services/esp32-emulator`) |
|
||||
| Device ↔ server protocol | MQTT (Mosquitto) |
|
||||
| Telemetry / commands / rules backend | Go |
|
||||
| Business logic / API / dashboard | PHP (Laravel) |
|
||||
| Users, zones, devices, rules | PostgreSQL |
|
||||
| Telemetry (time-series) | ClickHouse |
|
||||
| Real-time device state | Redis (Device Shadow pattern) |
|
||||
| Inter-service async events | RabbitMQ |
|
||||
| Inter-service sync calls | gRPC / Protobuf |
|
||||
| Metrics (stage 2.5) | Prometheus + Grafana |
|
||||
| Containerization | Docker Compose |
|
||||
| Web frontend (stage 3) | Vue.js + Inertia.js |
|
||||
| Mobile app (stage 3) | Flutter |
|
||||
| Notifications | Telegram Bot (MVP) / Firebase Cloud Messaging (later) |
|
||||
| Прошивка устройства / эмулятор | Go (`services/esp32-emulator`) |
|
||||
| Протокол устройство ↔ сервер | MQTT (Mosquitto) |
|
||||
| Backend телеметрии / команд / правил | Go |
|
||||
| Бизнес-логика / API / дашборд | PHP (Laravel) |
|
||||
| Пользователи, зоны, устройства, правила | PostgreSQL |
|
||||
| Телеметрия (time-series) | ClickHouse |
|
||||
| Состояние устройств в реальном времени | Redis (паттерн Device Shadow) |
|
||||
| Асинхронные события между сервисами | RabbitMQ |
|
||||
| Синхронные вызовы между сервисами | gRPC / Protobuf |
|
||||
| Метрики (этап 2.5) | Prometheus + Grafana |
|
||||
| Контейнеризация | Docker Compose |
|
||||
| Веб-фронтенд (этап 3) | Vue.js + Inertia.js |
|
||||
| Мобильное приложение (этап 3) | Flutter |
|
||||
| Уведомления | Telegram-бот (MVP) / Firebase Cloud Messaging (позже) |
|
||||
|
||||
## Layout
|
||||
## Структура репозитория
|
||||
|
||||
```
|
||||
services/
|
||||
ingest-service/ Go — MQTT → ClickHouse + RabbitMQ
|
||||
device-control-service/ Go — gRPC + MQTT + Redis device shadow
|
||||
rule-engine-service/ Go — RabbitMQ consumer + rule evaluation
|
||||
health-check-service/ Go — offline detection ticker
|
||||
esp32-emulator/ Go — fake device for local dev
|
||||
laravel-app/ PHP/Laravel — API, auth, dashboard (stage 2)
|
||||
proto/ Shared gRPC contracts (device_control.proto)
|
||||
rule-engine-service/ Go — консьюмер RabbitMQ + оценка правил
|
||||
health-check-service/ Go — тикер обнаружения офлайн-устройств
|
||||
esp32-emulator/ Go — фейковое устройство для локальной разработки
|
||||
laravel-app/ PHP/Laravel — API, авторизация, дашборд (этап 2)
|
||||
proto/ Общие gRPC-контракты (device_control.proto)
|
||||
migrations/
|
||||
postgres/ users, zones, devices, device_types, automation_rules
|
||||
clickhouse/ telemetry table
|
||||
configs/mosquitto/ MQTT broker config
|
||||
monitoring/ Prometheus + Grafana config (stage 2.5)
|
||||
clickhouse/ таблица telemetry
|
||||
configs/mosquitto/ Конфиг MQTT-брокера
|
||||
monitoring/ Конфиги Prometheus + Grafana (этап 2.5)
|
||||
```
|
||||
|
||||
Each `services/*/README.md` describes that service's responsibility and
|
||||
explicit non-responsibilities before any code exists there.
|
||||
Каждый `services/*/README.md` описывает зону ответственности сервиса и явно
|
||||
то, что в неё не входит, — ещё до того, как там появится код.
|
||||
|
||||
## Build stages
|
||||
## Этапы разработки
|
||||
|
||||
1. **Go services** — ingest, rule-engine, device-control, ESP32 emulator.
|
||||
2. **Laravel** — auth (Sanctum, owner/viewer), CRUD for zones/devices/rules,
|
||||
Blade dashboard, manual device control. MVP is considered done here.
|
||||
3. *(optional, high value)* **Observability** — Prometheus metrics from the
|
||||
Go services, a Grafana dashboard or two.
|
||||
4. **Extensions** (no rush) — Telegram notifications, Vue.js/Inertia
|
||||
frontend, Flutter app, real ESP32 hardware.
|
||||
1. **Go-сервисы** — ingest, rule-engine, device-control, эмулятор ESP32.
|
||||
2. **Laravel** — авторизация (Sanctum, owner/viewer), CRUD для зон/устройств/
|
||||
правил, Blade-дашборд, ручное управление устройствами. MVP считается
|
||||
готовым на этом этапе.
|
||||
3. *(опционально, но сильно повышает ценность)* **Observability** — метрики
|
||||
Prometheus с Go-сервисов, один-два дашборда в Grafana.
|
||||
4. **Расширения** (не спеша) — Telegram-уведомления, фронтенд на
|
||||
Vue.js/Inertia, приложение на Flutter, подключение реального ESP32.
|
||||
|
||||
## Running locally
|
||||
## Запуск локально
|
||||
|
||||
Infrastructure only for now (app services are added to `docker-compose.yml`
|
||||
as they're implemented):
|
||||
Пока только инфраструктура (сервисы добавляются в `docker-compose.yml` по
|
||||
мере реализации):
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
This brings up Mosquitto (`1883`), PostgreSQL (`5432`), ClickHouse (`8123`/`9000`),
|
||||
Redis (`6379`), and RabbitMQ (`5672`, management UI on `15672`).
|
||||
Поднимутся Mosquitto (`1883`), PostgreSQL (`5432`), ClickHouse (`8123`/`9000`),
|
||||
Redis (`6379`) и RabbitMQ (`5672`, веб-интерфейс управления на `15672`).
|
||||
|
||||
Reference in New Issue
Block a user