tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
183 stars 96 forks source link

[BUG] Failed to validate database. Invalid platform version. #531

Closed pbek closed 10 months ago

pbek commented 10 months ago

Describe the bug Watchtower just updated my kimai/kimai2:apache container to kimai/kimai2:apache@sha256:b9f112affef9301c6be8e16e9b75bed13131fc9f5f38793f85e61f6843d5e28e.

When starting the new container, there immediately was an error:

Kimai updates running ...

=========================

 [ERROR] Failed to validate database.                                           

         Invalid platform version "" specified. The platform version has to be  

         specified in the format:                                               

         "<major_version>.<minor_version>.<patch_version>".                     

This error is repeated on every database access.

To Reproduce Steps to reproduce the behaviour:

  1. Start the container kimai/kimai2:apache (I'm not if this only occurs on existing installations)
  2. Get above error messages

Docker compose file (with passwords redacted)

  kimai:
    image: kimai/kimai2:apache
    depends_on:
      - kimai-mysql
    volumes:
      - kimai-var:/opt/kimai/var
      - ./kimai/local.yaml:/opt/kimai/config/packages/local.yaml
    restart: unless-stopped
    networks:
      - kimai
      - traefik
    environment:
      - TZ=Europe/Vienna
      - TRUSTED_HOSTS=localhost,127.0.0.1,time.domain.com
      - ADMINMAIL=my@email.com
      # We need to set user and group because of https://github.com/tobybatch/kimai2/issues/456
      - USER_ID=33
      - GROUP_ID=33
    env_file:
      - ./kimai/variables-kimai.env
    labels:
      - traefik.http.routers.kimai.rule=Host(`time.domain.com`)
      - traefik.http.routers.kimai.tls.certresolver=default
      - traefik.http.routers.kimai.tls=true
      - traefik.http.services.kimai.loadbalancer.server.port=8001
      - traefik.docker.network=server_traefik
kevinpapst commented 10 months ago

https://github.com/kimai/kimai/issues/4246

The DATABASE_URL is missing the serverVersion.

pbek commented 10 months ago

Oh, sorry, I missed that open issue!

pbek commented 10 months ago

We need to add the ?charset=utf8&serverVersion=mariadb-10.11.4 part to the examples, like https://github.com/tobybatch/kimai2/blob/main/compose/docker-compose.apache.prod.yml#L32. 😅

kevinpapst commented 10 months ago

Yes

pbek commented 10 months ago

In my case, I had to add ?charset=utf8&serverVersion=5.7. Everything seems to be all right now, thank you very much for the quick help, @kevinpapst!

pbek commented 10 months ago

I created https://github.com/tobybatch/kimai2/pull/532.

kevinpapst commented 10 months ago

I wonder if the patch version (which is mentioned in the first error) is relevant for MySQL... I always add it for MariaDB.

pbek commented 10 months ago

At least it worked for me without the patch version. 🤷🏻‍♂️

nemchik commented 10 months ago

I found https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html has sections for both MariaDB and MySQL and both say to run SELECT VERSION(); on the database to get the version. MySQL isn't really different than what is documented thus far, but MariaDB outputs 10.11.4-MariaDB-log for me. I tested this value with Kimai 2.0.30 and it works. So it seems like the format has changed from mariadb-10.11.4 to 10.11.4-MariaDB-additionalPackageInfo in Doctrine 3.6. The additionalPackageInfo seems to not be super important.

Nexow91 commented 10 months ago

Unfortunately I have the same problem since the update. Unfortunately I can't find this .env file to make the changes. I am using Kimai as Docker on Unraid.

DATABASE_URL is just a variable in the configuration. I think this .env file should be in Docker. Does anyone know where? Otherwise, I would need to restore a backup.

Ah so I understand that you are still over there then I'll just wait I just thought I have to enter something and just can not find the file to do so :(

kevinpapst commented 10 months ago

@Nexow91 https://github.com/tobybatch/kimai2/issues/531#issuecomment-1686207105

nemchik commented 10 months ago

You shouldn't need to edit the .env file when running in docker. Just set your DATABASE_URL variable to include the extra parameters mentioned above.

Nexow91 commented 10 months ago

@kevinpapst @nemchik

many many thanks the system is running again sorry if I did not get it right away am now happy that I can finally enter my times :) Have a good time

pbek commented 10 months ago

Also see https://github.com/tobybatch/kimai2/issues/531#issuecomment-1686346277 😉

tobybatch commented 10 months ago

Fixed by #532