🚀 Deploying Node-RED on Akash Network with Multi-User Auth and Social Media Automation
A step-by-step guide to deploying Node-RED in the cloud using Docker and Akash Network, with a GUI, secure multi-user login, and automation flows for Instagram, Facebook, and YouTube.
1. What is Node-RED?
Node-RED is a flow-based, low-code programming tool for wiring together hardware devices, APIs, and online services using a browser-based editor. It's built on Node.js and widely used for IoT, automation, and rapid prototyping.
2. Build a Docker Image for Node-RED
Use a Dockerfile to add custom nodes like:
- node-red-dashboard
- node-red-contrib-users (multi-user auth)
- node-red-contrib-postgresql
- node-red-contrib-cron-plus
- node-red-contrib-custom-chatgpt (optional)
Include a custom settings.js
for HTTPS and adminAuth. Example password hashes can be generated using:
node-red admin hash-pw
3. Docker Compose & Local Testing
Use a docker-compose file to run both Node-RED and Postgres locally. Configure persistent volumes and expose ports. Verify nodes via Palette Manager and create database tables:
CREATE TABLE users (...);
4. Akash Deployment (SDL)
Use an SDL file to define services for:
- Node-RED (with persistent volume)
- PostgreSQL (secure, not globally exposed)
- Nginx reverse proxy (handles SSL via Let's Encrypt or pre-mounted certs)
5. Multi-User Login with node-red-contrib-users
Add user accounts via the sidebar UI. Use the "Is Logged In" node to protect dashboard routes. JWT cookies manage sessions. Access control is enforced via msg.req.user
.
6. API Integration: Instagram, Facebook, YouTube
Register apps and implement OAuth flows for each platform. Use HTTP request nodes to post content at runtime:
- Instagram: /media → /media_publish
- Facebook: /feed (with optional scheduling param)
- YouTube: upload or update privacy via Data API
7. Scheduling with node-red-contrib-cron-plus
Use dynamic scheduling by sending commands to cron-plus node. On startup, reload jobs from the DB. Example schedule format:
{ command: "add", name: "job123", schedule: "2025-07-01T15:00:00Z", payload: {...} }
8. Secure Database & Credential Handling
Use PostgreSQL behind firewall rules. Encrypt tokens, restrict access via msg.req.user
. Consider refresh tokens over long-lived access tokens. Enable data backups.