Commit Graph

59 Commits

Author SHA1 Message Date
Wizznu 94499d02d5 feat: Add Dockerfile for Railway deployment
Added production-ready Dockerfile:
- Node.js 18 Alpine (lightweight)
- Multi-stage dependency installation
- Health check monitoring
- Non-root user for security
- Production optimizations

Added .dockerignore:
- Exclude node_modules (reinstalled in Docker)
- Exclude .env files (Railway injects env vars)
- Reduce image size
- Faster build times

Railway will now detect project type via Dockerfile instead of guessing from package.json.
This ensures proper build configuration for BullMQ worker.
2026-02-10 11:29:49 +07:00
Wizznu a9d894b2fd feat: ApsGo Railway Worker - 24/7 Background Automation
Complete Node.js worker for IoT automation:

Features:
- Waktu Mode: Time-based scheduling with cron
- Sensor Mode: Threshold-based automation
- BullMQ + Redis: Queue management (prevent race conditions)
- Firebase Admin: Realtime Database integration
- Auto History Logging: Every 10 minutes
- Health Monitoring: Auto-restart on failure
- Graceful Shutdown: Clean resource cleanup

Architecture:
- NO HTTP server (background worker only)
- Listen to Firebase Realtime DB changes
- Process jobs from Redis queue
- Execute scheduled tasks via cron

Tech Stack:
- Node.js 18+
- Firebase Admin SDK
- BullMQ (job queue)
- Redis (in-memory DB)
- IoRedis client

Files:
- worker.js: Main worker implementation (500+ lines)
- package.json: Dependencies and scripts
- railway.json: Railway deployment config (NO healthcheck - worker not HTTP)
- .env.example: Environment variables template
- README.md: Complete documentation
- .gitignore: Node modules, env files, logs

Ready for Railway deployment!
Connect to Redis and set Firebase environment variables.
2026-02-10 10:52:29 +07:00
awisnuu 8df97e29ec
Initial commit 2026-02-10 10:49:24 +07:00
Wizznu 0f7def971e fix: Add missing dart:async import for StreamSubscription 2026-02-10 07:50:50 +07:00
Wizznu de5ce25f57 feat: Add Railway Worker, bug fixes, and mosvet_8 pengaduk
 New Features:
- Railway Worker for 24/7 automation (Node.js + BullMQ + Redis)
- Connection monitoring service
- Automation constants for centralized config
- History logging service with auto cleanup
- Mosvet_8 pengaduk support in kontrol page and Firebase

🐛 Bug Fixes:
- Fixed StreamSubscription memory leak in dashboard_page
- Added AppLifecycle observer for proper service management
- Fixed race conditions with Redis queue
- Improved error handling and user feedback
- Better connection status monitoring

📚 Documentation:
- DEPLOYMENT_GUIDE.md - Complete Railway deployment guide
- BUGS_AND_FIXES.md - Bug report and fixes summary
- RAILWAY_QUICK_START.md - Quick reference guide
- IMPLEMENTATION_COMPLETE.md - Complete implementation summary
- FULL_HISTORY_SYSTEM.md - History system documentation

🔧 Code Changes:
- lib/main.dart - Added AppLifecycleObserver
- lib/screens/dashboard_page.dart - Fixed memory leak
- lib/screens/histori_page.dart - Full Firebase integration
- lib/screens/kontrol_page.dart - Added pengaduk (mosvet_8)
- lib/services/firebase_database_service.dart - Added mosvet_8, history methods
- lib/services/kontrol_automation_service.dart - Use constants, connection check
- lib/services/automation_constants.dart - NEW centralized constants
- lib/services/connection_monitor_service.dart - NEW connection monitoring
- lib/services/history_logging_service.dart - NEW auto logging service
- railway-worker/ - NEW complete worker implementation

Status:  Production Ready
2026-02-10 07:22:43 +07:00
Wizznu a213576bce feat: Implement dual mode system (Smart & Fixed) and fix logout bugs
- Add Smart Mode: auto-stop when target reached or timeout
- Add Fixed Duration Mode: water for exact duration
- Fix auth state management to prevent unexpected logout
- Add error handling across all pages
- Update automation service with dual mode logic
- Add mode selection UI in sensor config page
- Update Firebase structure: mode_sensor, durasi_sensor
- Enhance logging for debugging
- Add flutter_launcher_icons for app icon management
- Add comprehensive documentation (3 MD files)
PERUBHAAN BESAR
2026-01-26 11:47:23 +07:00
Wizznu c3b68edba1 tersingkrong per tanggal 12 januari 2026 2026-01-12 18:31:42 +07:00
Wizznu 2586f744a9 dashboard terhubung firebase 2026-01-12 17:53:26 +07:00
Wizznu 95949930ad Initial commit: ApsGo project with Firebase integration 2026-01-12 15:24:52 +07:00