Commit Graph

3 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