forked from jchomaz/Vulture
Lancement en mode network plutot que pod
This commit is contained in:
@@ -18,11 +18,11 @@ mqtt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
listeners.tcp {
|
listeners.tcp {
|
||||||
bind = "127.0.0.1:1883"
|
bind = "0.0.0.0:1883"
|
||||||
}
|
}
|
||||||
|
|
||||||
listeners.ws {
|
listeners.ws {
|
||||||
bind = "127.0.0.1:9001"
|
bind = "0.0.0.0:9001"
|
||||||
}
|
}
|
||||||
|
|
||||||
http_server {
|
http_server {
|
||||||
|
|||||||
@@ -4,21 +4,28 @@ set -e
|
|||||||
# Move to repository root
|
# Move to repository root
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
echo "Creating Pod vulture..."
|
NETWORK_NAME="vulture-net"
|
||||||
# Check if pod exists to avoid error
|
|
||||||
if podman pod exists vulture; then
|
echo "Creating network $NETWORK_NAME..."
|
||||||
echo "Pod vulture already exists."
|
if podman network exists $NETWORK_NAME; then
|
||||||
|
echo "Network $NETWORK_NAME already exists."
|
||||||
else
|
else
|
||||||
podman pod create --name vulture -p 8080:80 -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 9001:9001
|
podman network create $NETWORK_NAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting NanoMQ..."
|
echo "Starting NanoMQ..."
|
||||||
podman run -dt --rm --pod vulture --name nanomq -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf docker.io/emqx/nanomq:latest --conf /etc/nanomq.conf
|
# NanoMQ needs to expose ports for external access (e.g. VApp frontend) and be on the network for VNode
|
||||||
|
podman run -dt --rm --network $NETWORK_NAME --name nanomq \
|
||||||
|
-p 1883:1883 -p 9001:9001 -p 8081:8081 -p 8083:8083 -p 8883:8883 \
|
||||||
|
-v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf \
|
||||||
|
docker.io/emqx/nanomq:latest --conf /etc/nanomq.conf
|
||||||
|
|
||||||
echo "Starting VNode..."
|
echo "Starting VNode..."
|
||||||
podman run -dt --rm --pod vulture --name vnode vnode:latest
|
# VNode connects to nanomq via the network, no ports needed on host unless for debugging
|
||||||
|
podman run -dt --rm --network $NETWORK_NAME --name vnode vnode:latest
|
||||||
|
|
||||||
echo "Starting VApp..."
|
echo "Starting VApp..."
|
||||||
podman run -dt --rm --pod vulture --name vapp vapp:latest
|
# VApp (nginx) needs port 80 exposed
|
||||||
|
podman run -dt --rm --network $NETWORK_NAME --name vapp -p 8080:80 vapp:latest
|
||||||
|
|
||||||
echo "All containers started."
|
echo "All containers started on network $NETWORK_NAME."
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ podman stop vapp || echo "vapp not running"
|
|||||||
podman stop vnode || echo "vnode not running"
|
podman stop vnode || echo "vnode not running"
|
||||||
podman stop nanomq || echo "nanomq not running"
|
podman stop nanomq || echo "nanomq not running"
|
||||||
|
|
||||||
echo "Removing pod..."
|
echo "Removing network..."
|
||||||
podman pod rm vulture || echo "Pod vulture not found"
|
podman network rm vulture-net || echo "Network vulture-net not found"
|
||||||
|
|
||||||
echo "Cleanup complete."
|
echo "Cleanup complete."
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
const mqtt = require('mqtt');
|
const mqtt = require('mqtt');
|
||||||
|
|
||||||
// MQTT broker configuration
|
// MQTT broker configuration
|
||||||
const brokerUrl = 'mqtt://localhost'; // Broker URL (change if needed)
|
const brokerUrl = 'mqtt://nanomq'; // Broker URL (change if needed)
|
||||||
const clientId = 'buzzer_manager';
|
const clientId = 'buzzer_manager';
|
||||||
const options = {
|
const options = {
|
||||||
clientId,
|
clientId,
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
{
|
{
|
||||||
"services": {
|
"services": {
|
||||||
"mqttHost": "mqtt://localhost",
|
"mqttHost": "mqtt://nanomq",
|
||||||
"score":{
|
"score": {
|
||||||
"MQTTconfig":{
|
"MQTTconfig": {
|
||||||
"mqttScoreTopic": "game/score",
|
"mqttScoreTopic": "game/score",
|
||||||
"mqttScoreChangeTopic": "game/score/update"
|
"mqttScoreChangeTopic": "game/score/update"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"quizzcollector":{
|
"quizzcollector": {
|
||||||
"MQTTconfig":{
|
"MQTTconfig": {
|
||||||
"mqttQuizzCollectorListTopic": "game/quizz-collector/list",
|
"mqttQuizzCollectorListTopic": "game/quizz-collector/list",
|
||||||
"mqttQuizzCollectorCmdTopic": "game/quizz-collector/cmd"
|
"mqttQuizzCollectorCmdTopic": "game/quizz-collector/cmd"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
{
|
{
|
||||||
"hosts": {
|
"hosts": {
|
||||||
"buzzers":{
|
"buzzers": {
|
||||||
"IP":{
|
"IP": {
|
||||||
"redBuzzerIP": "8.8.8.6",
|
"redBuzzerIP": "8.8.8.6",
|
||||||
"blueBuzzerIP": "8.8.8.8",
|
"blueBuzzerIP": "8.8.8.8",
|
||||||
"greenBuzzerIP": "8.8.8.8",
|
"greenBuzzerIP": "8.8.8.8",
|
||||||
"yellowBuzzerIP": "8.8.8.8"
|
"yellowBuzzerIP": "8.8.8.8"
|
||||||
},
|
},
|
||||||
"MQTTconfig":{
|
"MQTTconfig": {
|
||||||
"mqttHost": "mqtt://localhost",
|
"mqttHost": "mqtt://nanomq",
|
||||||
"mqttTopic": "buzzer/watcher"
|
"mqttTopic": "buzzer/watcher"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
const mqtt = require('mqtt');
|
const mqtt = require('mqtt');
|
||||||
|
|
||||||
// Configuration du broker MQTT et de WLED
|
// Configuration du broker MQTT et de WLED
|
||||||
const brokerUrl = 'mqtt://localhost'; // Change ce lien si nécessaire
|
const brokerUrl = 'mqtt://nanomq'; // Change ce lien si nécessaire
|
||||||
const clientId = 'light_manager_wled';
|
const clientId = 'light_manager_wled';
|
||||||
const wledTopicBase = 'wled/all'; // Le topic de base pour ton ruban WLED
|
const wledTopicBase = 'wled/all'; // Le topic de base pour ton ruban WLED
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
Reference in New Issue
Block a user