tobybatch / kimai2

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

Kimai with ProxyRevers: Menu-Buttons in Kimai Version 2.2.1 do not work #555

Closed raywitzel closed 6 months ago

raywitzel commented 8 months ago

Describe the bug I use kimai (Version 1.24.0 prod) with docker-compose; Kimai is accessed via ProxyPass/ProxyPassReverse with Apache2. To make the update to Version 2.2.1 prod, I changed only the Image in docker-compose.yml. In the Result, I could login in the new Kimai version (using url http://domain/kimai). However, there was a problem with the menu buttons:

These buttons do not work. And the small Icons belong to the menu buttons are not visible. This error is reproducible in a local area with the following description.

To Reproduce

  1. Create the file .env, with the content you can see below
  2. Start the container via docker-compose.yml below and with the image kimai2:apache-1.24.0-prod.
  3. Create the kimai Admin User
  4. Copy (with docker cp) the directory /opt/kimai/public in the local place. Rename the new created dircetory public in kimai. Create the directory html and move the directory kimai inside them. The owner must be www-data.
  5. Stop the container and comment out the following lines in docker-compose.yml: **volumes:
    • ./html/kimai:/opt/kimai/public**
  6. Start the container again (if the user has not been saved, it must be recreated)
  7. Go inside the container docker exec -it kimai_old bash and create the following symbolic link: ln -s /opt/kimai/public /opt/kimai/public/kimai (owner must be www-data)
  8. Be aware that apache2 works with proxyreverse, and add the following section in /etc/apache2/sites-enabled/default-ssl.conf
....
<VirtualHost test-server-ubuntu.intranet:80>
        ServerName test-server-ubuntu.intranet
        ServerAlias www.test-server-ubuntu.intranet

        # Kimai Version 2.1
#        ProxyPass /kimai http://127.0.0.1:40802/kimai retry=0
#        ProxyPassReverse /kimai http://127.0.0.1:40802/kimai
        # Kimai Version 1.24
        ProxyPass /kimai http://127.0.0.1:30405/kimai retry=0
        ProxyPassReverse /kimai http://127.0.0.1:30405/kimai
</VirtualHost>
...

Hint: use you own local domain.

  1. Now you can start kimai via the IP-Address http://IP-Address:30405 or via your own local domain http://test-server-ubuntu.intranet/kimai In the result Kimai Version 1.24.0 appears and it works good, without any problems. No matter in which way kimai was called.
  2. Shut down the container and change the image (from 1.24.0 to 2.2.1) in the docker-compose.yml
  3. Start the container again.
  4. Now you can start kimai via the IP-Address http://IP-Address:30405 or via your own local domain http://test-server-ubuntu.intranet/kimai Starting with the IP-Address the Kimai Version 2.2.1 works good and without any problems. Starting with your own local domain, you can login, but you can not use the buttons (all without icons):
    • Emplyment contract
    • Invoices
    • Administration
    • System

kimai_problem_with_menu_buttons

Desktop (please complete the following information):

Files docker-compose.yml and .env docker-compose.yml

version: "3.5"

services:
  app:
    container_name: kimai_old
    image: kimai/kimai2:apache-1.24.0-prod
#    image: kimai/kimai2:apache-2.2.1-prod
    restart: always
    ports:
      - 30405:8001
    depends_on:
        - db_kimai_old
    environment:
      - DATABASE_URL=mysql://kimaiuser_old:${DATABASE_PASSWORD}@db_kimai_old:3306/kimai_old
      - TRUSTED_HOSTS=localhost,192.168.0.217,127.0.0.1,test-server-ubuntu,test-server-ubuntu.intranet
#      - APP_ENV=prod
      - APP_ENV=dev
 #   volumes:
 #      - ./html/kimai:/opt/kimai/public

  db_kimai_old:
    image: mysql:8.0.34
    container_name: db_kimai_old
    restart: always
#    volumes:
#       - ./kimai-mysql:/var/lib/mysql
    environment:
      - MYSQL_DATABASE=kimai_old
      - MYSQL_USER=kimaiuser_old
      - MYSQL_PASSWORD=${DATABASE_PASSWORD}
      - MYSQL_ROOT_PASSWORD=password_2_old
    ports:
      - 3336:3306

  phpmyadmin:
    container_name: phpmyadmin_old
    image: phpmyadmin
    restart: always
    ports:
      - 9091:80
    environment:
      - PMA_ARBITRARY=1

volumes:
  mysql-data:
    driver: local

.env

COMPOSE_PROJECT_NAME=old_kimai
DATABASE_PASSWORD=passwort_alt

Additional context To reproduce this error, you must not install kimai 1.24.0 at first. You can directly create a new Kimai version. Then you must call Kimai via http://domain/kimai Important is a correct working ProxyPass Apache2 Server and a Symbolic Link as mentioned above.

When you start Kimai in dev-Mode via IP-Address than Kimai shows several debug-options.
If you start Kimai in dev-Mode via http://domain/kimai these debug-options are not appears.

Can anyone help me ?

kevinpapst commented 8 months ago

Kimai does not support running in a subdirectory. image