danielbrendel / hortusfox-web

Self-hosted collaborative plant management system for your local environment
https://hortusfox.github.io
MIT License
459 stars 18 forks source link

Authentication issues with Mariadb 11 #193

Closed adrianbn closed 2 days ago

adrianbn commented 1 month ago

Describe the bug I was having issues getting the docker compose to work due to authentication errors. The web service would never become available because it would fail to auth to the mariadb container. The mariadb container would show the following error:

Version: '11.3.2-MariaDB-1:11.3.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2024-05-07  3:50:38 3 [Warning] Access denied for user 'hortusfox'@'192.168.192.3' (using password: YES)
2024-05-07  3:50:43 4 [Warning] Access denied for user 'hortusfox'@'192.168.192.3' (using password: YES)

I found this comment in another issue https://github.com/danielbrendel/hortusfox-web/issues/101#issuecomment-1927290177 and decided to change the mariadb version from latest (currently 11) to 10 and that solved the issue.

To Reproduce This is the dockerfile I am using, just a slight modification from the one on the repo. This works as long as the mariadb image is pointed to version 10 (as in the example), and fails to authenticate if you change it to latest.

services:
  app:
    container_name: hortusfox-web
    image: ghcr.io/danielbrendel/hortusfox-web:latest
    ports:
      - "${HORTUSFOX_HTTP_PORT}:80" 
    volumes:
      - app_images:/var/www/html/public/img
      - app_logs:/var/www/html/app/logs
      - app_backup:/var/www/html/public/backup
      - app_themes:/var/www/html/public/themes
      - app_migrate:/var/www/html/app/migrations
    environment:
      APP_ADMIN_EMAIL: "${HORTUSFOX_ADMIN_EMAIL}"
      APP_ADMIN_PASSWORD: "${HORTUSFOX_ADMIN_PASSWORD}"
      DB_HOST: db
      DB_PORT: "3306"
      DB_DATABASE: hortusfox
      DB_USERNAME: "${HORTUSFOX_DB_USERNAME}"
      DB_PASSWORD: "${HORTUSFOX_DB_PASSWORD}"
      DB_CHARSET: "utf8mb4"
    depends_on:
      - db
    networks:
      - hortusfox-net

  db:
    container_name: hortusfox-db
    image: mariadb:10
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: "${HORTUSFOX_DB_ROOT_PASSWORD}"
      MYSQL_DATABASE: hortusfox
      MYSQL_USER: "${HORTUSFOX_DB_USERNAME}"
      MYSQL_PASSWORD: "${HORTUSFOX_DB_PASSWORD}"
    networks:
      - hortusfox-net
    volumes:
      - db_data:/var/lib/mysql

networks:
  hortusfox-net:

volumes:
  db_data:
  app_images:
  app_logs:
  app_backup:
  app_themes:
  app_migrate:

Steps to reproduce the behavior:

  1. Change the image: mariadb:10 line for image: mariadb.
  2. Start the compose stack w/ docker compose up...
  3. check the DB / App logs with docker logs
  4. See error

Expected behavior It should authenticate correctly with version 11 as well.

Screenshots If applicable, add screenshots to help explain your problem.

Software:

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

pflavio commented 1 month ago

I have the same issue, but switching the MariaDB version down to 10 does not solve it for me unfortunately.

danielbrendel commented 1 month ago

Thank you for your bug report. That's kinda odd, I'll look into this issue.

@pflavio what does your docker log show?

pflavio commented 1 month ago

@pflavio what does your docker log show?

Hi @danielbrendel I just one of these after the other 2024-05-12 9:36:11 15439 [Warning] Access denied for user 'user'@'172.20.0.3' (using password: YES). 172.20.0.3 is the internal Docker IP of the hortusfox-web-app container. I even tried setting everything to the default values from the example docker-compose to rule out breaking any rules for length or special characters in passwords.

danielbrendel commented 1 month ago

I tried to check this in my environment, but I don't have any troubles using mariadb 11.

This is the version I was checking: 11.3.2-MariaDB-1:11.3.2+maria~ubu2204

I checked both creating from scratch or updating existing containers and both worked fine.

danielbrendel commented 1 week ago

Does the problem still persist?

danielbrendel commented 2 days ago

Closed due to inactivity / non-reproducible.