Add: IOT using Mosquitto // Node red // InfluxDB // Grafana

File and folder permissions are a bitch.
Also, will only leave access to grafana and remove the rest to be accessed using ssh tunnels
This commit is contained in:
2023-07-13 14:32:17 +05:30
parent ae6fde8113
commit 774b69be38
6 changed files with 350 additions and 0 deletions

40
iot/files/mosquitto.conf Normal file
View File

@ -0,0 +1,40 @@
# Use a persistence location outside the container
persistence true
persistence_location /mosquitto/data
# Set the maximum number of clients and messages
max_connections 1000
max_inflight_messages 1000
# Set the maximum size of incoming messages
max_queued_messages 10000
max_packet_size 1000
# Enable MQTT logging
log_dest file /mosquitto/log/mosquitto.log
log_type error
log_type warning
log_type notice
log_type information
# Disable anonymous access
allow_anonymous false
# Set a username and password for client authentication
password_file /mosquitto/config/passwd
# Uncomment the following lines if you want to enable TLS/SSL encryption
# cafile /mosquitto/config/ca.crt
# certfile /mosquitto/config/server.crt
# keyfile /mosquitto/config/server.key
# require_certificate true
# Uncomment the following lines if you want to enable WebSocket support
listener 9001
protocol websockets
# Uncomment the following lines if you want to enable MQTT over TLS/SSL
# listener 8883
# cafile /mosquitto/config/ca.crt
# certfile /mosquitto/config/server.crt
# keyfile /mosquitto/config/server.key

44
iot/files/nginx.conf.j2 Normal file
View File

@ -0,0 +1,44 @@
server {
listen 80;
server_name {{ http_host }};
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
location /mqtt/ {
proxy_pass http://localhost:9001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
}
location /node-red/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:1880/;
}
location /dashboard/ {
proxy_set_header Host $http_host;
proxy_pass http://localhost:3005/;
}
location /dashboard/api/live/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_pass http://localhost:3005/;
}
}

2
iot/files/passwd Normal file
View File

@ -0,0 +1,2 @@
esp8266:esp8266
nodered:nodered