Open djripcord opened 5 months ago
UPDATE:
The container seems to be only intermittently checking other containers. I suspect this because only when I restart a container does MqDockerUp notice a change. The logs reflect normally and show basic status information, but only when making a drastic change, such as starting or stopping a container. It does not seem to be monitoring the container otherwise. It also still is not connected to the MQTT broker.
Here is a log after a container restart:
mqdockerup@1.4.0 start ts-node src/index.ts
| \/ | | \ __ | | __ | | | |_ | |\/| |/ ` | | | |/ \ / | |/ / _ \ '| | | | ' \ | | | | (| | || | () | (| < / | | || | |) | || ||_, |____/ \/ _||_\|| _/| ./ || |_| Starting MqDockerUp V1.4.0 ...
29.01.2024 18:06:13 [info] Connected to the database. 29.01.2024 18:06:13 [info] Database initialized successfully 29.01.2024 18:06:30 [info] Checking for removed containers... 29.01.2024 18:06:30 [info] Checking for containers... 29.01.2024 18:06:30 [info] Removed missing container mqdockerup from Home Assistant and database. 29.01.2024 18:06:30 [info] Removed missing container palworld-server from Home Assistant and database. 29.01.2024 18:06:30 [info] Adding container mqdockerup to database 29.01.2024 18:06:30 [info] Checking for image updates... Container died: palworld-server (483b868db46720c36c6b1a3ba86d33d83b95dea58ae56ac66f79f7141531c18f) 29.01.2024 18:06:30 [info] Image micrib/mqdockerup:latest is up-to-date 29.01.2024 18:06:30 [info] Finished checking for image updates 29.01.2024 18:06:30 [info] Next check in 1 minute 29.01.2024 18:06:30 [info] Checking for removed containers... 29.01.2024 18:06:30 [info] Checking for containers... 29.01.2024 18:06:30 [info] Adding container palworld-server to database 29.01.2024 18:06:30 [info] Checking for image updates... 29.01.2024 18:06:30 [info] Image micrib/mqdockerup:latest is up-to-date Container started: palworld-server (483b868db46720c36c6b1a3ba86d33d83b95dea58ae56ac66f79f7141531c18f) 29.01.2024 18:06:30 [info] Image thijsvanloef/palworld-server-docker:latest is up-to-date 29.01.2024 18:06:30 [info] Finished checking for image updates 29.01.2024 18:06:30 [info] Next check in 1 minute
While the logs claim MqDockerUp is going to check again in 1 minute, it does not seem to do so.
So MQTT isn't working, but MqDockerUp also does not seem to be collecting any live data. I would assume this is a networking issue on my end, but I have another server running MqDockerUp with no issues.
This seems to be a problem while connecting to mqtt.
Could you please try connecting to your broker via TCP/WS ?
The default ports are: mqtt://10.0.0.20:1883 - TCP mqtt://10.0.0.20:8083- WS
This seems to be a problem while connecting to mqtt.
Could you please try connecting to your broker via TCP/WS ?
The default ports are: mqtt://10.0.0.20:1883 - TCP mqtt://10.0.0.20:8083- WS
I am already connecting over TCP as far as I can tell. My MQTT broker is on 1883 and connectable by a different server. Can you elaborate what you mean by that?
Regardless - I disabled firewall rules that may be affecting this and I still am not getting a connection to MQTT. I even watched the logs on my MQTT broker and found my server does not even attempt to make a connection. If it was, I should expect to see a log entry describing the connection attempt on my broker.
I encountered the same issue.
When I start mqdockerup via npm run start
, everything works fine. However, when attempting to start it via Docker, it stops after displaying Connected to database. Database initialized successfully
.
As mentioned earlier, there seems to be an issue with the connection to MQTT.
I'm using the Mosquitto container in Docker. The problem lies in the fact that the mqdockerup container is not authorized to communicate with the Mosquitto container.
To resolve this, I had to edit my compose.yaml
file as follows:
services:
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
restart: unless-stopped
ports:
- "1883:1883/tcp"
environment:
- TZ=Europe/Berlin
volumes:
- /opt/mosquitto/config:/mosquitto/config
- /opt/mosquitto/data:/mosquitto/data
- /opt/mosquitto/log:/mosquitto/log
stdin_open: true
tty: true
networks:
myNetwork:
ipv4_address: 172.19.0.2
mqdockerup:
image: micrib/mqdockerup:latest
restart: always
networks:
myNetwork:
ipv4_address: 172.19.0.3
environment:
MAIN_INTERVAL: "5m"
MQTT_CONNECTIONURI: "mqtt://172.19.0.2:1883"
MQTT_USERNAME: "USER"
MQTT_PASSWORD: "PW"
ACCESSTOKENS_GITHUB: "TOKEN"
volumes:
- /var/run/docker.sock:/var/run/docker.sock # This is required to access the docker API
- your/path/data:/app/data/ # This is required to store the data (database.db)
container_name: mqdockerup
networks:
myNetwork:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.19.0.0/24
Please ensure to check the network settings for both mqdockerup and Mosquitto.
The newly created network, myNetwork
, will facilitate communication between mqdockerup and Mosquitto.
It's crucial to note that the MQTT IP address for mqdockerup cannot remain as 127.0.0.1
and needs to be updated to the new one, such as 172.19.0.2
in this example.
I hope this helps.
I have since resolved this problem. It would seem there was an issue with volumes. I compared my configuration between the server I had that was working, and my problematic one. The configured volume directories were different, which shouldn't have been an issue, but perhaps there was a permissions issue.
It would be great if MqDockerUp could detect this problem and post to the log, instead of just hanging.
Leaving this open in case @MichelFR wants to add this to their todo.
Running version latest on Ubuntu 22.04
MqDockerUp starts successfully, but
docker logs --follow mqdockerup
only showsConnected to database. Database initialized successfully
It does not attempt to connect to MQTT or provide any errors in the logs. No failures, no errors, but also no status messages indicating a successful connection.
The following is my docker compose:
version: '3.9'
services: mqdockerup: image: micrib/mqdockerup:latest restart: unless-stopped environment: MAIN_INTERVAL: "1m" MQTT_CONNECTIONURI: "mqtt://10.0.0.20:1883" MQTT_USERNAME: "clover" MQTT_PASSWORD: "REDACTED" ACCESSTOKENS_GITHUB: "" MQTT_CONNECTTIMEOUT: "30" MQTT_TOPIC: "clover" MQTT_CLIENTID: "clover" volumes:
The following is my container log:
clover@clover:~/mqdockerup$ docker compose up [+] Running 1/0 ✔ Container mqdockerup Created 0.0s Attaching to mqdockerup mqdockerup | mqdockerup | > mqdockerup@1.4.0 start mqdockerup | > ts-node src/index.ts mqdockerup | mqdockerup | mqdockerup | _ mqdockerup | | \/ | _ | \ _| | ___ _ | | | |_ mqdockerup | | |\/| |/ ` | | | |/ \ / | |/ / _ \ '| | | | ' \ mqdockerup | | | | | (| | || | () | (| < / | | || | |) | mqdockerup | || ||_, |_/ \/ __||\_|| \/| ._/ mqdockerup | || |_| mqdockerup | Starting MqDockerUp V1.4.0 ... mqdockerup | mqdockerup | 28.01.2024 15:07:00 [info] Connected to the database. mqdockerup | 28.01.2024 15:07:00 [info] Database initialized successfully
This same behavior occurs when running the container directly using `docker run -d
Docker Version 24.0.7