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] DemoBundle returns 404 in prod image for api endpoints #514

Closed Epimetheus89 closed 1 year ago

Epimetheus89 commented 1 year ago

Describe the bug The DemoBundle is not working with the fpm docker image. After installation of the bundle, the api endpoint returns 404 Not Found. After changing the used image to fpm-dev, the plugin started working as expected.

To Reproduce Steps to reproduce the behaviour:

  1. Download docker compose file from: https://github.com/tobybatch/kimai2/blob/main/compose/docker-compose.fpm.prod.yml
  2. Run `docker compose -f docker-compose.fpm.prod.yml up
  3. Download version 2.0.1 of the DemoBundle: https://github.com/Keleo/DemoBundle/archive/refs/tags/2.0.1.zip
  4. Unzip the DemoBundle, copy the files to the running docker image and reload the caches as described in the doc of the bundle
  5. Call endpoint from swagger ui:
    1. Launch the UI of kimai
    2. Login with default credentials
    3. Set an api password
    4. Go to the swagger ui
    5. Authorize with api credentials
    6. Execute /api/demos

The endpoint returns a 404 not found status code instead of a 200 ok.

Desktop (please complete the following information):

Docker compose file (with passwords redacted) https://github.com/tobybatch/kimai2/blob/main/compose/docker-compose.fpm.prod.yml

Additional context I tried using the fpm-dev image version with the exactly same steps described above and it works completely as expected.

kevinpapst commented 1 year ago

If you see the endpoint in the UI, then it should work. If you don't see the endpoint in the Swagger docs, then the cache reload is not enough (opcache is not reloaded by the command). Restart the image instead.

Anyway: the demo bundle is a development bundle. Using it in a prod environment is wrong. You will not be able to see changes, due to aggressive file and opcode caches

Epimetheus89 commented 1 year ago

Yes I can see the endpoint in the UI. Therefore I would assume that it should work.

We are using a self written bundle in our company. After the upgrade it stopped working. As there have been some changes in bundle development, I upgraded our own plugin but it did not work with the same error above. After that I tried it with the DemoBundle with the same result. I wrote the bug report with the DemoBundle because all sources are public available.

As both bundles are working with the fpm-dev image, I would assume that there is a difference between both images.

I also tried the apache images with the exactly same result: The endpoint is working correctly with the apache-dev image, but not with apache image.

Here is a screenshot of the demo endpoint including the result: image

tobybatch commented 1 year ago

@Epimetheus89 Have you tried this using the dev build?

Epimetheus89 commented 1 year ago

Hi @tobybatch I tried the latest apache and apache-dev docker image from dockerhub. My plugin works fine with the apache-dev image but not with the apache image.

Do you mean the apache-dev or fpm-dev images with "dev" or is there another dev image?

Epimetheus89 commented 1 year ago

I just saw that there was an update of the docker images yesterday. I tested the new image in our production environment and it seems to work again as I receive a 200 status code and data from our plugin endpoint.

tobybatch commented 1 year ago

kk