WWBN / AVideo

Create Your Own Broadcast Network With AVideo Platform Open-Source. OAVP OVP
https://avideo.tube/AVideo_OpenSource
Other
1.91k stars 972 forks source link

Database containers fail healthcheck #8250

Open smcpeck opened 1 year ago

smcpeck commented 1 year ago

Describe the bug After a new docker compose up -d, database containers are unhealthy.

1c5897329f3a   mariadb:latest                       "docker-entrypoint.s…"   5 minutes ago   Up 5 minutes (unhealthy)   3306/tcp                                                            avideo-database-1
f1df7634689c   mariadb:latest                       "docker-entrypoint.s…"   5 minutes ago   Up 5 minutes (unhealthy)   3306/tcp                                                            avideo-database_encoder-1

Expected behavior Containers should be healthy upon deployment.

Solution There are two problems with the current healthcheck.

  1. The wrong command is being used.
    • mariadb-admin should be used instead of mysqladmin
  2. Incorrect credentials are being passed to the command.
    • Credentials from ENV variables should be used, not root and example
-      test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -pexample"]
+      test: "mariadb-admin ping -h localhost -u $MYSQL_USER -p$MYSQL_PASSWORD"
DanielnetoDotCom commented 1 year ago

please try to keep the default database credentials and let me know.

smcpeck commented 1 year ago

please try to keep the default database credentials and let me know.

Both containers are setup with MYSQL_RANDOM_ROOT_PASSWORD: "yes". So trying a healthcheck with -u root -pexample will definitely fail all the time.

Besides, as I mentioned, the wrong (non-existent) command is being used in the healthcheck. I've given you the fix above if you wish to implement it.

I've moved on from AVideo. Too tough to get it up and running without troubleshooting a lot of the internals. Good luck with the project, though. Cheers!

DanielnetoDotCom commented 1 year ago

I am also using the docker version. I do not know what you are doing differently.

smcpeck commented 1 year ago

The containers still work, but they report as unhealthy because of the bad healthcheck. I bet if you do docker ps you will see your DB containers report as unhealthy. If you don't care about the healthcheck being bad and/or don't intend for it to provide a valid report, then you should probably just remove it.

DanielnetoDotCom commented 1 year ago

I see, I you are right, the -pexample is wrong, anyway, I just removed it because it seems to be useless

DanielnetoDotCom commented 1 year ago

Check this update, thanks for helping find it