Edge Computing Gateway on VPS
Edge Computing Gateway on VPS: Building an IoT Hub for Thảo Viên Store Chain
In the IoT era, collecting real-time data from temperature, humidity, light, door sensors, and more at retail stores is extremely important. Instead of letting every device connect directly to the Cloud (which causes high bandwidth usage and latency), using a VPS as an **Edge Computing Gateway** is the optimal solution. The VPS acts as the central hub to collect, pre-process, and securely push data to the Cloud. This article provides a detailed guide on implementing an Edge Gateway for the Thảo Viên store chain in 2026.
1. What is an Edge Computing Gateway and Why Use It on a VPS?
An Edge Gateway is a device or server located close to the data source. It performs processing, filtering, and aggregation of data before sending it to the Cloud. Using a VPS as a Gateway offers the following benefits:
- Reduces latency and saves Cloud bandwidth
- Enables local logic processing (high temperature alerts, device control)
- Increases security (IoT devices are not directly exposed to the Internet)
- Easily scalable when expanding the number of stores
- Lower cost compared to purchasing dedicated hardware gateways
// Interface simulating Edge Gateway for Thảo Viên Store
interface EdgeGateway {
storeName: string;
location: string;
connectedDevices: number;
uptime: number; // percentage
dataPointsPerHour: number;
cloudPlatform: "AWS" | "Azure" | "Google Cloud" | "MQTT Broker";
}
const thaoVienGateway: EdgeGateway = {
storeName: "Thảo Viên - District 1",
location: "Ho Chi Minh City",
connectedDevices: 28,
uptime: 99.8,
dataPointsPerHour: 4500,
cloudPlatform: "AWS"
};
function checkGatewayHealth(gateway: EdgeGateway): string {
return gateway.uptime > 99.5
? `✅ ${gateway.storeName} - Gateway is operating stably`
: "⚠️ Connection check required";
}
console.log(checkGatewayHealth(thaoVienGateway));
2. System Architecture of Edge Gateway on VPS
The system consists of the following layers:
- Perception Layer: Sensors + NodeMCU/ESP32 + Zigbee
- Gateway Layer (VPS): MQTT Broker, Node-RED, Python scripts
- Processing Layer: Data filtering, rule engine, local storage
- Cloud Layer: AWS IoT Core, InfluxDB, Grafana Cloud
3. Deploying Edge Gateway on VPS
Use Mosquitto MQTT Broker combined with Node-RED to collect and process data.
// MQTT Subscriber configuration on VPS (Edge Gateway)
const mqttConfig = `
const mqtt = require('mqtt');
const client = mqtt.connect('mqtt://localhost:1883');
client.on('connect', () => {
console.log('✅ Edge Gateway connected to MQTT Broker');
client.subscribe('thao-vien/sensor/#');
});
client.on('message', (topic, message) => {
const data = JSON.parse(message.toString());
console.log(`📡 Received data from ${topic}:`, data);
// Local processing at Edge
if (data.temperature > 35) {
console.log("🚨 High temperature alert - Activating fan!");
// Send control command to device
}
// Push data to Cloud after processing
pushToCloud(data);
});
`;
console.log("🚀 MQTT Edge Gateway is ready to collect data from Thảo Viên");
4. Comparison of IoT Gateway Solutions
| Solution | Cost | Latency | Ease of Management | Recommendation for Thảo Viên |
|---|---|---|---|---|
| Direct Cloud Connection | Low initially | High | Easy | Not recommended |
| Hardware Gateway | High | Low | Medium | Suitable for large stores |
| VPS as Edge Gateway | Medium | Very Low | Very High | Best Recommendation |
| Industrial Edge Device | Very High | Very Low | Difficult | For factories |
5. Best Practices for Deploying Edge Gateway
- Use VPN (WireGuard) for secure connection between devices and VPS
- Implement local buffering when Cloud connection is lost
- Monitor VPS with Prometheus + Grafana
- Set up intelligent rule engine on Node-RED
- Perform daily local data backup
- Use Docker to containerize services
- Implement auto-restart and watchdog services
6. Conclusion: Edge Gateway Deployment Checklist for Thảo Viên
Before going live, make sure you have completed the following:
- Installed MQTT Broker and Node-RED on the VPS?
- Successfully connected all IoT sensors?
- Tested the full data processing and Cloud upload flow?
- Implemented real-time alerting system (temperature, door open...)?
- System capable of handling load when expanding to multiple stores?
- Deployed backup, security, and monitoring?
Using a VPS as an Edge Computing Gateway is a smart, cost-effective, and flexible solution for the Thảo Viên store chain. The system not only reliably collects sensor data but also enables fast on-site decision making, providing a significant competitive advantage in modern retail management.
Hope this guide helps you successfully build a professional and stable Edge IoT system for Thảo Viên!
