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 |