tobybatch / kimai2

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

[BUG] Error 500 when using local.yaml mounted inside container #69

Closed vvirehead closed 4 years ago

vvirehead commented 4 years ago

Describe the bug Using local.yaml causes kimai to return error 500 in browser.

To Reproduce Steps to reproduce the behavior:

  1. Run docker-compose up with docker-compose.yml as configured below
  2. Run docker exec -u root -it CONTAINER_NAME /bin/sh and change group and owner of local.yml to www-data
  3. Load page in browser to get error 500

Desktop (please complete the following information):

Command used to run the container

Docker compose file (with passwords redacted)

docker-compose.yml ```yaml version: '3.5' services: sqldb: image: mysql:5.7 environment: - MYSQL_DATABASE=kimai - MYSQL_USER=kimaiuser - MYSQL_PASSWORD=kimaipassword - MYSQL_ROOT_PASSWORD=### volumes: - /var/lib/mysql command: --default-storage-engine innodb restart: unless-stopped healthcheck: test: mysqladmin -p### ping -h localhost interval: 20s start_period: 10s timeout: 10s retries: 3 networks: - kimai nginx: build: compose ports: - ###:80 volumes: - ./nginx_site.conf:/etc/nginx/conf.d/default.conf restart: unless-stopped depends_on: - kimai volumes: - public:/opt/kimai/public healthcheck: test: wget --spider http://nginx/health || exit 1 interval: 20s start_period: 10s timeout: 10s retries: 3 networks: - kimai kimai: image: kimai/kimai2:fpm-alpine-1.5-prod environment: - APP_ENV=prod - TRUSTED_PROXIES=### - TRUSTED_HOSTS=### - ADMINMAIL=admin@kimai.local - ADMINPASS=### volumes: - ./local.yaml:/opt/kimai/config/packages/local.yaml - public:/opt/kimai/public - var:/opt/kimai/var restart: unless-stopped healthcheck: test: wget --spider http://nginx || exit 1 interval: 20s start_period: 10s timeout: 10s retries: 3 networks: - kimai postfix: image: catatnight/postfix environment: maildomain: neontribe.co.uk smtp_user: kimai:kimai restart: unless-stopped restart: always networks: - kimai networks: kimai: name: kimai driver: bridge driver_opts: com.docker.network.bridge.name: br-kimai volumes: public: var: ```

local.yaml (with passwords redacted)

/opt/kimai/config/packages/local.yaml ```yaml kimai: ldap: connection: host: ldap.xxx.yyy username: uid=aaa,ou=bbb,dc=xxx,dc=yyy password: ### accountDomainName: xxx.yyy accountDomainNameShort: xxx accountFilterFormat: (&(objectClass=Person)(sAMAccountName=%s)) user: baseDn: ou=ccc,dc=xxx,dc=yyy filter: (&(objectClass=person)) usernameAttribute: samaccountname attributesFilter: (&(objectClass=Person)) attributes: - { ldap_attr: mail, user_method: setEmail } - { ldap_attr: displayname, user_method: setAlias } - { ldap_attr: samaccountname, user_method: setUsername } role: baseDn: dc=xxx,dc=yyy filter: (&(objectClass=group)) groups: - { ldap_value: ###, role: ROLE_TEAMLEAD } - { ldap_value: ###, role: ROLE_SUPER_ADMIN } - { ldap_value: ###, role: ROLE_USER } user: registration: false password_reset: false security: providers: chain_provider: chain: providers: [kimai_ldap] firewalls: secured_area: kimai_ldap: ~ ```

Additional context /opt/kimai/var/log/prod.log returns (redacted):

prod.log ```[2020-01-21 19:29:57] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_parameters":{"_route":"fos_user_security_login","_controller":"fos_user.security.controller:loginAction","_locale":"en"},"request_uri":"http://xxx.yyy.zzz/en/login","method":"GET"} [] [2020-01-21 19:29:57] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"secured_area","authenticators":1} [] [2020-01-21 19:29:57] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} [] [2020-01-21 19:29:57] security.DEBUG: Guard authenticator does not support the request. {"firewall_key":"secured_area","authenticator":"App\\Security\\TokenAuthenticator"} [] [2020-01-21 19:29:57] security.INFO: Populated the TokenStorage with an anonymous Token. [] [] [2020-01-21 19:29:57] php.INFO: User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. at /opt/kimai/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php:66)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "%5Ba936b1335bf136416e45c7e5c0555d7a%5D%5B1%5D" of type Doctrine\ORM\Query\ParserResult: file_put_contents(/opt/kimai/var/cache/prod/pools/LDyCdeXPFx/5e27513589ab96.39336279): failed to open stream: Permission denied {"key":"%5Ba936b1335bf136416e45c7e5c0555d7a%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/LDyCdeXPFx/5e27513589ab96.39336279): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "%5BFOS%5CUserBundle%5CController%5CSecurityController%5D%5B1%5D" of type array: file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied {"key":"%5BFOS%5CUserBundle%5CController%5CSecurityController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "%5BFOS%5CUserBundle%5CController%5CSecurityController%23loginAction%5D%5B1%5D" of type array: file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied {"key":"%5BFOS%5CUserBundle%5CController%5CSecurityController%23loginAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] [2020-01-21 19:29:57] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Failed to create "/opt/kimai/var/cache/prod/translations": mkdir(): Permission denied.")." at /opt/kimai/templates/bundles/FOSUserBundle/Security/login.html.twig line 4 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Failed to create \"/opt/kimai/var/cache/prod/translations\": mkdir(): Permission denied.\"). at /opt/kimai/templates/bundles/FOSUserBundle/Security/login.html.twig:4, Symfony\\Component\\Filesystem\\Exception\\IOException(code: 0): Failed to create \"/opt/kimai/var/cache/prod/translations\": mkdir(): Permission denied. at /opt/kimai/vendor/symfony/filesystem/Filesystem.php:105)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "%5BSymfony%5CBundle%5CTwigBundle%5CController%5CExceptionController%5D%5B1%5D" of type array: file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied {"key":"%5BSymfony%5CBundle%5CTwigBundle%5CController%5CExceptionController%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "%5BSymfony%5CBundle%5CTwigBundle%5CController%5CExceptionController%23showAction%5D%5B1%5D" of type array: file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied {"key":"%5BSymfony%5CBundle%5CTwigBundle%5CController%5CExceptionController%23showAction%5D%5B1%5D","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/j5j-2cUkbi/5e2751358c9545.23229187): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] [2020-01-21 19:29:57] cache.WARNING: Failed to save key "_default" of type array: file_put_contents(/opt/kimai/var/cache/prod/pools/buXsFVlzuf/5e275135bbf522.91018724): failed to open stream: Permission denied {"key":"_default","exception":"[object] (ErrorException(code: 0): file_put_contents(/opt/kimai/var/cache/prod/pools/buXsFVlzuf/5e275135bbf522.91018724): failed to open stream: Permission denied at /opt/kimai/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:92)"} [] ```

Error occurs only if local.yaml owner and group are changed to www-data (from root), and even if local.yaml is empty.

kevinpapst commented 4 years ago

Anything in /opt/kimai/var/log/prod.log?

vvirehead commented 4 years ago

Anything in /opt/kimai/var/log/prod.log?

it's in the description

vvirehead commented 4 years ago

Webpage returns this information: A critical error occurred, please try again. You may have found a software problem, please contact your administrator if the problem persists.

kevinpapst commented 4 years ago

Oh true... 😁 But why would the cache directories have suddenly wrong permissions when you add a local.yaml? Sounds like docker magic and not Kimai itself ...

vvirehead commented 4 years ago

docker exec --user root CONTAINER_NAME chown -R www-data:www-data /opt/kimai/var fixed the bug, but it looks like I have to run it each time I modify local.yaml / clear / warmup cache outside container.

vvirehead commented 4 years ago

After fixing initial bug LDAP is still not working:

/opt/kimai/var/log/prod.log

[2020-01-21 19:53:40] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-21 19:53:40] php.INFO: User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. at /opt/kimai/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php:66)"} []
[2020-01-21 19:53:40] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-21 19:53:40] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-21 19:53:40] request.CRITICAL: Uncaught PHP Exception LogicException: "An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates." at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366 {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-21 19:53:40] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-21 19:53:40] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []```

And web interface returns Invalid Credentials.

I can, however, login with superadmin.

How can I trace LDAP logs?

kevinpapst commented 4 years ago

All errors sounds suspicious. The "Untrusted Host "nginx". message was IMO recently discussed in this repo, check the other issues. Maybe the other error is just a follow up.

You can turn on development mode to see more logs, that requires a reinstall of composer packages. I guess you should better use the dev version of the docker images for that.

vvirehead commented 4 years ago

I'm using nginx as a reverse proxy, maybe that's the cause?

On Tue, Jan 21, 2020, 21:05 Kevin Papst notifications@github.com wrote:

All errors sounds suspicious. The "Untrusted Host "nginx". message was IMO recently discussed in this repo, check the other issues. Maybe the other error is just a follow up.

You can turn on development mode to see more logs, that requires a reinstall of composer packages. I guess you should better use the dev version of the docker images for that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tobybatch/kimai2/issues/69?email_source=notifications&email_token=AA6TABTBJQIALXIRWDKZ363Q65IO3A5CNFSM4KJY62LKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJRCHHQ#issuecomment-576856990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6TABUMGZFP45GFD56LXWDQ65IO3ANCNFSM4KJY62LA .

tobybatch commented 4 years ago

@g-mike let me just try and replicate this here.

vvirehead commented 4 years ago

I run dev image and also set environment to dev, than resolved the issues with LDAP. I'm still getting some errors in prod but I can login with LDAP now with group assignment.

Perhaps the logs are made by the healthcheck in docker-compose.yaml?

    healthcheck:
      test: wget --spider http://nginx || exit 1

Production log below:

prod.log ``` [2020-01-22 11:35:40] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} [] [2020-01-22 11:35:40] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} [] [2020-01-22 11:35:40] php.INFO: User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. at /opt/kimai/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php:66)"} [] [2020-01-22 11:35:40] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} [] [2020-01-22 11:35:40] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} [] [2020-01-22 11:35:40] request.CRITICAL: Uncaught PHP Exception LogicException: "An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates." at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366 {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} [] [2020-01-22 11:35:40] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} [] [2020-01-22 11:35:40] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} [] ```
kevinpapst commented 4 years ago

These errors are not normal. Probably outdated composer dependencies.

vvirehead commented 4 years ago

How can I update composer dependencies? Is it caused by the system I use specifically or is it something that developer should update? Either way kimai seems to work fine.

Kudos to developers :) 🎩

kevinpapst commented 4 years ago

Check the update docs. But actually I thought the prod docker would do that automatically. I am not sure about the reason for this problem. Go to "Doctor" in the left menu, you will find a listing of installed "Composer packages".

Compare that with the "latest stable" demo: https://demo-stable.kimai.org/en/doctor

Find demo users at https://www.kimai.org/demo/

vvirehead commented 4 years ago

Yes, I see many outdated packages - how can I fix this problem?

The most notorious example is this one:

kevinpapst/kimai2 | No version set (parsed as 1.0.0)@
kevinpapst commented 4 years ago

Hm, which Kimai are you running? Are you using 1.7 (check bin/console kimai:version). You could run composer install --no-dev --optimize-autoloader, but honestly I would try to find the reason instead, as docker should do all that for you, shouldn't it @tobybatch ?

Schrolli91 commented 4 years ago

all the composer packages should be pre installed into the container - not on startup but on build time of the image

vvirehead commented 4 years ago
  1. I cloned master from this repo
  2. Adjusted docker-compose for reverse-proxy and local.yml mounted locally
  3. I run docker-compose up

I recently updated all ubuntu packages including docker, pulled this kimai repo and run build with same configs as posted above - with same results.

beberlei/doctrineextensions v1.2.4@5d5a7259b7d44f6d9d5ced4c09f9db6b7f460139
behat/transliterator    v1.2.0@826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c
doctrine/annotations    v1.8.0@904dca4eb10715b92569fbcd79e201d5c349b6bc
doctrine/cache  1.9.1@89a5c76c39c292f7798f964ab3c836c3f8192a55
doctrine/collections    1.6.4@6b1e4b2b66f6d6e49983cebfe23a21b7ccc5b0d7
doctrine/common v2.11.0@b8ca1dcf6b0dc8a2af7a09baac8d0c48345df4ff
doctrine/dbal   v2.10.0@0c9a646775ef549eb0a213a4f9bd4381d9b4d934
doctrine/doctrine-bundle    1.12.0@a374f3bc54fe7c23ddb722ef6b9ddd2d9dcb9115
doctrine/doctrine-cache-bundle  1.3.5@5514c90d9fb595e1095e6d66ebb98ce9ef049927
doctrine/doctrine-migrations-bundle 2.1.2@856437e8de96a70233e1f0cc2352fc8dd15a899d
doctrine/event-manager  1.1.0@629572819973f13486371cb611386eb17851e85c
doctrine/inflector  1.3.1@ec3a55242203ffa6a4b27c58176da97ff0a7aec1
doctrine/instantiator   1.3.0@ae466f726242e637cebdd526a7d991b9433bacf1
doctrine/lexer  1.2.0@5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6
doctrine/migrations 2.2.0@8e124252d2f6be1124017d746d5994dd4095d66f
doctrine/orm    v2.7.0@4d763ca4c925f647b248b9fa01b5f47aa3685d62
doctrine/persistence    1.2.0@43526ae63312942e5316100bb3ed589ba1aba491
doctrine/reflection v1.0.0@02538d3f95e88eb397a5f86274deb2c6175c2ab6
easycorp/easy-log-handler   v1.0.9@224e1dfcf9455aceee89cd0af306ac097167fac1
egulias/email-validator 2.1.11@92dd169c32f6f55ba570c309d83f5209cefb5e23
erusev/parsedown    1.7.3@6d893938171a817f4e9bc9e86f2da1e370b7bcd7
exsyst/swagger  v0.4.1@a02984db5edacdce2b4e09dae5ba8fe17a0e449e
friendsofsymfony/rest-bundle    2.6.0@54758949bff9fc520997415341323eebf3f54892
friendsofsymfony/user-bundle    dev-master@1e932f6fb58c56a41adc4186169d98fdd5f1e71e
gedmo/doctrine-extensions   v2.4.37@5dd471f656e46d815f063bf3f12c667649ec7ffb
guzzlehttp/psr7 1.6.1@239400de7a173fe9901b9ac7c06497751f00727a
hoa/compiler    3.17.08.08@aa09caf0bf28adae6654ca6ee415ee2f522672de
hoa/consistency 1.17.05.02@fd7d0adc82410507f332516faf655b6ed22e4c2f
hoa/event   1.17.01.13@6c0060dced212ffa3af0e34bb46624f990b29c54
hoa/exception   1.17.01.16@091727d46420a3d7468ef0595651488bfc3a458f
hoa/file    1.17.07.11@35cb979b779bc54918d2f9a4e02ed6c7a1fa67ca
hoa/iterator    2.17.01.10@d1120ba09cb4ccd049c86d10058ab94af245f0cc
hoa/math    1.17.05.16@7150785d30f5d565704912116a462e9f5bc83a0c
hoa/protocol    1.17.01.14@5c2cf972151c45f373230da170ea015deecf19e2
hoa/regex   1.17.01.13@7e263a61b6fb45c1d03d8e5ef77668518abd5bec
hoa/stream  1.17.02.21@3293cfffca2de10525df51436adf88a559151d82
hoa/ustring 4.17.01.16@e6326e2739178799b1fe3fdd92029f9517fa17a0
hoa/visitor 2.17.01.16@c18fe1cbac98ae449e0d56e87469103ba08f224a
hoa/zformat 1.17.01.10@522c381a2a075d4b9dbb42eb4592dd09520e4ac2
illuminate/cache    v6.5.2@b7121bc6c2f345beae396bf7081c566b17d335d4
illuminate/contracts    v6.5.2@5e32ed8640ff70179dfde98eda04790b1cfa9a41
illuminate/support  v6.5.2@7a93f9e5a15bbf41236a8695fb738bf293f3c186
intervention/image  2.5.1@abbf18d5ab8367f96b3205ca3c89fb2fa598c69e
jdorn/sql-formatter v1.2.17@64990d96e0959dff8e059dfcdc1af130728d92bc
jms/metadata    2.1.0@8d8958103485c2cbdd9a9684c3869312ebdaf73a
jms/serializer  3.3.0@4c1e4296734385af7718ca71ec0febb4815b4a87
jms/serializer-bundle   3.4.1@d5af7fe83fead9b791dd6b46a936d5e6e42deed4
kevinpapst/adminlte-bundle  3.0.2@e7480d78614309b5b581f6928afc6a6b4e4fb9af
kimai/kimai2-composer   0.1@7ff68f4270d2e48920309a3c1530f4d247a24905
laminas/laminas-ldap    2.10.1@52d67bbe6095da4e7e3578407e44322a6d7874ce
laminas/laminas-zendframework-bridge    1.0.1@0fb9675b84a1666ab45182b6c5b29956921e818d
laravolt/avatar 3.0.0@d95652df4499790e25d66a4fbfc34dfb93e7314d
league/csv  9.4.1@bf83acc23a7d60978fce36a384f97bf9d7d2ea0c
markbaker/complex   1.4.7@1ea674a8308baf547cbcbd30c5fcd6d301b7c000
markbaker/matrix    1.2.0@5348c5a67e3b75cd209d70103f916a93b1f1ed21
monolog/monolog 1.25.2@d5e2fb341cb44f7e2ab639d12a1e5901091ec287
mpdf/mpdf   v7.1.9@a0fc1215d2306aa3b4ba6e97bd6ebe4bab6a88fb
myclabs/deep-copy   1.9.3@007c053ae6f31bba39dfa19a7726f56e9763bbea
nelmio/api-doc-bundle   v3.5.0@f596adfb4d16e65d1a1941f907092a119d4c76cb
nelmio/cors-bundle  1.5.6@10a24c10f242440211ed31075e74f81661c690d9
nesbot/carbon   2.27.0@13b8485a8690f103bf19cba64879c218b102b726
ocramius/package-versions   1.4.2@44af6f3a2e2e04f2af46bcb302ad9600cba41c7d
ocramius/proxy-manager  2.1.1@e18ac876b2e4819c76349de8f78ccc8ef1554cd7
pagerfanta/pagerfanta   v2.1.3@a53ff01d521648d9dbca19b93ac6bc75a59b0972
paragonie/random_compat v9.99.99@84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95
pclzip/pclzip   2.8.2@19dd1de9d3f5fc4d7d70175b4c344dee329f45fd
phpdocumentor/reflection-common 2.0.0@63a995caa1ca9e5590304cd845c15ad6d482a62a
phpdocumentor/reflection-docblock   4.3.2@b83ff7cfcfee7827e1e78b637a5904fe6a96698e
phpdocumentor/type-resolver 1.0.1@2e32a6d48972b2c1976ed5d8967145b6cec4a4a9
phpoffice/common    0.2.9@edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d
phpoffice/phpspreadsheet    1.10.0@f734783d826bd84c3d54fcf7b71c37ab9bac4b04
phpoffice/phpword   0.15.0@dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f
psr/cache   1.0.1@d11b50ad223250cf17b86e38383413f5a6764bf8
psr/container   1.0.0@b7ce3b176482dbbc1245ebf52b181af44c2cf55f
psr/http-message    1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363
psr/log 1.1.2@446d54b4cb6bf489fc9d75f55843658e6f25d801
psr/simple-cache    1.0.1@408d5eafb83c57f6365a3ca330ff23aa4a5fa39b
ralouphie/getallheaders 3.0.3@120b605dfeb996808c31b6477290a714d356e822
sensio/framework-extra-bundle   v5.5.1@dfc2c4df9f7d465a65c770e9feb578fe071636f7
setasign/fpdi   1.6.2@a6ad58897a6d97cc2d2cd2adaeda343b25a368ea
swiftmailer/swiftmailer v6.2.3@149cfdf118b169f7840bbe3ef0d4bc795d1780c9
symfony/asset   v4.3.8@3f97e57596884f7b9158d564a533112a0d19dbdd
symfony/cache   v4.3.8@83dca34362a0aba2b93aa1226dac6ef7cfea1262
symfony/cache-contracts v1.1.7@af50d14ada9e4e82cfabfabdc502d144f89be0a1
symfony/config  v4.3.8@8267214841c44d315a55242ea867684eb43c42ce
symfony/console v4.3.8@831424efae0a1fe6642784bd52aae14ece6538e6
symfony/debug   v4.3.8@5ea9c3e01989a86ceaa0283f21234b12deadf5e2
symfony/debug-bundle    v4.3.8@bb83f93785dae1f9c227a408ced3eb3f86399bf8
symfony/debug-pack  v1.0.7@09a4a1e9bf2465987d4f79db0ad6c11cc632bc79
symfony/dependency-injection    v4.3.8@80c6d9e19467dfbba14f830ed478eb592ce51b64
symfony/doctrine-bridge v4.3.8@a18757e2de67c7add2b3175ff12e5f16e8f0ca9d
symfony/dotenv  v4.3.8@62d93bf07edd0d76f033d65a7fd1c1ce50d28b50
symfony/event-dispatcher    v4.3.8@0df002fd4f500392eabd243c2947061a50937287
symfony/event-dispatcher-contracts  v1.1.7@c43ab685673fb6c8d84220c77897b1d6cdbe1d18
symfony/expression-language v4.3.8@d81f0eb914f534e8b17a9db8c2408d1f0cf55fd2
symfony/filesystem  v4.3.8@9abbb7ef96a51f4d7e69627bc6f63307994e4263
symfony/finder  v4.3.8@72a068f77e317ae77c0a0495236ad292cfb5ce6f
symfony/flex    v1.4.8@f5bfc79c1f5bed6b2bb4ca9e49a736c2abc03e8f
symfony/form    v4.3.8@1134c093d6fd339ea1b8823c50940607b58349f2
symfony/framework-bundle    v4.3.8@117560d884615d0c39179a24aa3c69c4af540d81
symfony/http-foundation v4.3.8@cabe67275034e173350e158f3b1803d023880227
symfony/http-kernel v4.3.8@5fdf186f26f9080de531d3f1d024348b2f0ab12f
symfony/inflector   v4.3.8@f97c69c132c08e31d291689d2d77bb0878094acb
symfony/intl    v4.3.8@818771ff6acef04cdce05023ddfc39b7078014bf
symfony/mime    v4.3.8@22aecf6b11638ef378fab25d6c5a2da8a31a1448
symfony/monolog-bridge  v4.3.8@6b9d84b34e0c2c5d9d4f4dbd5f36b0c9e4e5ef93
symfony/monolog-bundle  v3.5.0@dd80460fcfe1fa2050a7103ad818e9d0686ce6fd
symfony/options-resolver    v4.3.8@f46c7fc8e207bd8a2188f54f8738f232533765a4
symfony/orm-pack    v1.0.7@c57f5e05232ca40626eb9fa52a32bc8565e9231c
symfony/polyfill-ctype  v1.12.0@550ebaac289296ce228a706d0867afc34687e3f4
symfony/polyfill-intl-icu   v1.12.0@66810b9d6eb4af54d543867909d65ab9af654d7e
symfony/polyfill-intl-idn   v1.12.0@6af626ae6fa37d396dc90a399c0ff08e5cfc45b2
symfony/polyfill-mbstring   v1.12.0@b42a2f66e8f1b15ccf25652c3424265923eb4f17
symfony/polyfill-php72  v1.12.0@04ce3335667451138df4307d6a9b61565560199e
symfony/polyfill-php73  v1.12.0@2ceb49eaccb9352bff54d22570276bb75ba4a188
symfony/profiler-pack   v1.0.4@99c4370632c2a59bb0444852f92140074ef02209
symfony/property-access v4.3.8@bb0c302375ffeef60c31e72a4539611b7f787565
symfony/property-info   v4.3.8@460242fd0696f3a4a8a7f6e4105b832557960c3b
symfony/routing v4.3.8@533fd12a41fb9ce8d4e861693365427849487c0e
symfony/security-bundle v4.3.8@9f247c672e08385c67e3ca7cfc1484072bcc6517
symfony/security-core   v4.3.8@8c46ea77fe0738f2495eacc08fa34e1e19ff0b0d
symfony/security-csrf   v4.3.8@0760ec651ea8ff81e22097780337e43f3a795769
symfony/security-guard  v4.3.8@62cc82a384f2c1c75c58189fcf713032f6fef1e9
symfony/security-http   v4.3.8@290b23a46a932746c4cf3c313d59d99f82af2a87
symfony/serializer  v4.3.8@18f30003dbe7178dcc1f75901ecb9f4937d146f5
symfony/service-contracts   v1.1.8@ffc7f5692092df31515df2a5ecf3b7302b3ddacf
symfony/stopwatch   v4.3.8@e96c259de6abcd0cead71f0bf4d730d53ee464d0
symfony/swiftmailer-bundle  v3.4.0@553d2474288349faed873da8ab7c1551a00d26ae
symfony/templating  v4.3.8@b513c4152bcaf1e54889ff8b75760fad53385707
symfony/translation v4.3.8@bbce239b35b0cd47bd75848b23e969f17dd970e7
symfony/translation-contracts   v1.1.7@364518c132c95642e530d9b2d217acbc2ccac3e6
symfony/twig-bridge v4.3.8@67fdb93de3361bcf1ab02bd8275af8c790bae900
symfony/twig-bundle v4.3.8@869ebf144acafd19fb9c8c386808c26624f28572
symfony/validator   v4.3.8@8062841487a1a7d95f4c7cc359e674079daf4c48
symfony/var-dumper  v4.3.8@ea4940845535c85ff5c505e13b3205b0076d07bf
symfony/var-exporter    v4.3.8@097aa4c02954dabe9d508229be86213723973ac0
symfony/web-profiler-bundle v4.3.8@6ce12ffe97d9e26091b0e7340a9d661fba64655e
symfony/webpack-encore-bundle   v1.7.1@8a5ba96bbec60bf04e2a70e45d2e953c94c4edc5
symfony/yaml    v4.3.8@324cf4b19c345465fad14f3602050519e09e361d
twig/extensions v1.5.4@57873c8b0c1be51caa47df2cdb824490beb16202
twig/twig   v2.12.2@d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed
webmozart/assert    1.5.0@88e6d84706d09a236046d686bbea96f07b3a34f4
white-october/pagerfanta-bundle v1.3.1@5421d5e79b72495b34b745d37e4d341e6fa2190d
willdurand/jsonp-callback-validator v1.1.0@1a7d388bb521959e612ef50c5c7b1691b097e909
willdurand/negotiation  v2.3.1@03436ededa67c6e83b9b12defac15384cb399dc9
zendframework/zend-code 3.4.0@46feaeecea14161734b56c1ace74f28cb329f194
zendframework/zend-escaper  2.6.1@3801caa21b0ca6aca57fa1c42b08d35c395ebd5f
zendframework/zend-eventmanager 3.2.1@a5e2583a211f73604691586b8406ff7296a946dd
zircote/swagger-php 2.0.14@f2a00f26796e5cd08fd812275ba2db3d1e807663
composer/semver 1.5.0@46d9139568ccb8d9e7cdd4539cab7347568a5e2e
composer/xdebug-handler 1.4.0@cbe23383749496fe0f373345208b79568e4bc248
dama/doctrine-test-bundle   v5.0.4@b485fe601ca9d50b4a5a85406d6657378dda494d
doctrine/data-fixtures  1.4.0@608a35a3b5bcc4214d116603095f8b0c51091592
doctrine/doctrine-fixtures-bundle   3.3.0@8f07fcfdac7f3591f3c4bf13a50cbae05f65ed70
friendsofphp/php-cs-fixer   v2.16.0@ceaff36bee1ed3f1bbbedca36d2528c0826c336d
fzaninotto/faker    v1.9.0@27a216cbe72327b2d6369fab721a5843be71e57d
jean85/pretty-package-versions  1.2@75c7effcf3f77501d0e0caa75111aff4daa0dd48
nette/bootstrap v3.0.1@b45a1e33b6a44beb307756522396551e5a9ff249
nette/di    v3.0.1@4aff517a1c6bb5c36fa09733d4cea089f529de6d
nette/finder    v2.5.1@14164e1ddd69e9c5f627ff82a10874b3f5bba5fe
nette/neon  v3.0.0@cbff32059cbdd8720deccf9e9eace6ee516f02eb
nette/php-generator v3.3.1@4240fd7adf499138c07b814ef9b9a6df9f6d7187
nette/robot-loader  v3.2.0@0712a0e39ae7956d6a94c0ab6ad41aa842544b5c
nette/schema    v1.0.1@337117df1dade22e2ba1fdc4a4b832c1e9b06b76
nette/utils v3.0.2@c133e18c922dcf3ad07673077d92d92cef25a148
nikic/php-parser    v4.3.0@9a9981c347c5c49d6dfe5cf826bb882b824080dc
phar-io/manifest    1.0.3@7761fcacf03b4d4f16e7ccb606d4879ca431fcf4
phar-io/version 2.0.1@45a2ec53a73c70ce41d55cedef9063630abaf1b6
php-cs-fixer/diff   v1.3.0@78bb099e9c16361126c86ce82ec4405ebab8e756
phpspec/prophecy    1.9.0@f6811d96d97bdf400077a0cc100ae56aa32b9203
phpstan/phpdoc-parser   0.3.5@8c4ef2aefd9788238897b678a985e1d5c8df6db4
phpstan/phpstan 0.11.19@63cc502f6957b7f74efbac444b4cf219dcadffd7
phpstan/phpstan-doctrine    0.11.6@77592865e167b32c7dcb4f39a35210e909a8854c
phpstan/phpstan-phpunit 0.11.2@fbf2ad56c3b13189d29655e226c9b1da47c2fad9
phpstan/phpstan-symfony 0.11.6@c7be3054c21fd472a52b1c38eb129c3f93776084
phpunit/php-code-coverage   7.0.10@f1884187926fbb755a9aaf0b3836ad3165b478bf
phpunit/php-file-iterator   2.0.2@050bedf145a257b1ff02746c31894800e5122946
phpunit/php-text-template   1.2.1@31f8b717e51d9a2afca6c9f046f5d69fc27c8686
phpunit/php-timer   2.1.2@1038454804406b0b5f5f520358e78c1c2f71501e
phpunit/php-token-stream    3.1.1@995192df77f63a59e47f025390d2d1fdf8f425ff
phpunit/phpunit 8.4.3@67f9e35bffc0dd52d55d565ddbe4230454fd6a4e
sebastian/code-unit-reverse-lookup  1.0.1@4419fcdb5eabb9caa61a27c7a1db532a6b55dd18
sebastian/comparator    3.0.2@5de4fc177adf9bce8df98d8d141a7559d7ccf6da
sebastian/diff  3.0.2@720fcc7e9b5cf384ea68d9d930d480907a0c1a29
sebastian/environment   4.2.3@464c90d7bdf5ad4e8a6aea15c091fec0603d4368
sebastian/exporter  3.1.2@68609e1261d215ea5b21b7987539cbfbe156ec3e
sebastian/global-state  3.0.0@edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4
sebastian/object-enumerator 3.0.3@7cfd9e65d11ffb5af41198476395774d4c8a84c5
sebastian/object-reflector  1.1.1@773f97c67f28de00d397be301821b06708fca0be
sebastian/recursion-context 3.0.0@5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8
sebastian/resource-operations   2.0.1@4d7a795d35b889bf80a0cc04e08d77cedfa917a9
sebastian/type  1.1.3@3aaaa15fa71d27650d62a948be022fe3b48541a3
sebastian/version   2.0.1@99732be0ddb3361e16ad77b68ba41efc8e979019
symfony/browser-kit v4.3.8@b14fa08508afd152257d5dcc7adb5f278654d972
symfony/css-selector    v4.3.8@f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9
symfony/dom-crawler v4.3.8@4b9efd5708c3a38593e19b6a33e40867f4f89d72
symfony/maker-bundle    v1.14.3@c864e7f9b8d1e1f5f60acc3beda11299f637aded
symfony/phpunit-bridge  v4.4.0@7daa9d4a2f457f9cae32f1c2406de1921dc86a79
symfony/process v4.3.8@3b2e0cb029afbb0395034509291f21191d1a4db0
symfony/thanks  v1.1.0@9474a631b52737c623b6aeba22f00bbc003251da
symfony/web-server-bundle   v4.3.8@dc26b980900ddf3e9feade14e5b21c029e8ca92f
theseer/tokenizer   1.1.3@11336f6f84e16a720dae9d8e6ed5019efa85a0f9
symfony/polyfill-iconv  *@
symfony/polyfill-php71  *@
symfony/polyfill-php70  *@
symfony/polyfill-php56  *@
kevinpapst/kimai2   No version set (parsed as 1.0.0)@

@kevinpapst - I did run composer install --no-dev --optimize-autoloader inside containers /opt/kimai/ directory, but it only removed packages and made my (thankfully) empty container broken (webpage returned error 500)

Any ideas how to solve this?

kevinpapst commented 4 years ago

Running the composer update most certainly changed permissions. The latest fix in master (just a couple of minutes old) allows you to build specific versions. The old version probably didn't install 1.7. Can you retry with the latest master?

vvirehead commented 4 years ago

Ok, I did:

  1. docker-compose down --volumes --rmi all --remove-orphans
  2. git pull leaving only custom local.yml and modified docker-compose.yml
  3. run docker-compose up --build

I still get exactly the same results in doctor.

kevinpapst commented 4 years ago

Maybe @Schrolli91 or @tobybatch can help you better. The build.sh was adjusted, don't know how this is exactly related.

vvirehead commented 4 years ago

@kevinpapst is there a way I can mount whole /opt/kimai locally?

I would like to have it running with those issues right now and have a way of making backups easily until this problem is fixed.

tobybatch commented 4 years ago

You should be able to mount a working kimai into the container by using adding the mounted directory as a volume. I've not tested this.

Change the nginx and kimai entries in the docker-compose.yml to mount the local kimai folder:

  nginx:
    build: compose
    ...
    volumes:
      - PATH_TO_KIMAI:/opt/kimai/public
    healthcheck:
    ...
 kimai:
    image: kimai/kimai2:fpm-alpine-1.7-prod
    ...
    volumes:
      - PATH_TO_KIMAI:/opt/kimai/public
    ...
vvirehead commented 4 years ago

You should be able to mount a working kimai into the container by using adding the mounted directory as a volume. I've not tested this.

Change the nginx and kimai entries in the docker-compose.yml to mount the local kimai folder:

  nginx:
    build: compose
    ...
    volumes:
      - PATH_TO_KIMAI:/opt/kimai/public
    healthcheck:
    ...
 kimai:
    image: kimai/kimai2:fpm-alpine-1.7-prod
    ...
    volumes:
      - PATH_TO_KIMAI:/opt/kimai/public
    ...
    volumes:
      - ./kimai:/opt/kimai/public

I tried this, also without public, tried running default docker-compose.yml and copying files from inside contaier to the local files system without luck.

I've changed permissions as instructed: docker exec --user root kimai_kimai_1 chown -R www-data:www-data /opt/kimai/var - but that didn't help.

Is there a reliable way to locally mount volumes?

vvirehead commented 4 years ago

Aside from mounting volumes, I verified that I do not have version 1.7 installed

I'm not sure which version was previously installed, but logs showed that I've just updated to 1.6:

I. Update

  1. I logged in to container shell with docker exec -u root -it CONTAINER /bin/bash
  2. I run composer clearcache
  3. I run composer upgrade
  4. I run composer install --no-dev --optimize-autoloader
  5. I run bin/console kimai:update
  6. I got this message: [OK] Congratulations! Successfully updated Kimai 2 to version 1.6 (stable)
  7. Webpage is showing even newer packages than ones in the demo:
beberlei/doctrineextensions v1.2.6@af72c4a136b744f1268ca8bb4da47a2f8af78f86
behat/transliterator    v1.3.0@3c4ec1d77c3d05caa1f0bf8fb3aae4845005c7fc
doctrine/annotations    v1.8.0@904dca4eb10715b92569fbcd79e201d5c349b6bc
doctrine/cache  1.10.0@382e7f4db9a12dc6c19431743a2b096041bcdd62
doctrine/collections    1.6.4@6b1e4b2b66f6d6e49983cebfe23a21b7ccc5b0d7
doctrine/common 2.12.0@2053eafdf60c2172ee1373d1b9289ba1db7f1fc6
doctrine/dbal   v2.10.1@c2b8e6e82732a64ecde1cddf9e1e06cb8556e3d8
doctrine/doctrine-bundle    2.0.7@6926771140ee87a823c3b2c72602de9dda4490d3
doctrine/doctrine-migrations-bundle 2.1.2@856437e8de96a70233e1f0cc2352fc8dd15a899d
doctrine/event-manager  1.1.0@629572819973f13486371cb611386eb17851e85c
doctrine/inflector  1.3.1@ec3a55242203ffa6a4b27c58176da97ff0a7aec1
doctrine/instantiator   1.3.0@ae466f726242e637cebdd526a7d991b9433bacf1
doctrine/lexer  1.2.0@5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6
doctrine/migrations 2.2.1@a3987131febeb0e9acb3c47ab0df0af004588934
doctrine/orm    v2.7.0@4d763ca4c925f647b248b9fa01b5f47aa3685d62
doctrine/persistence    1.3.6@5dd3ac5eebef2d0b074daa4440bb18f93132dee4
doctrine/reflection v1.1.0@bc420ead87fdfe08c03ecc3549db603a45b06d4c
easycorp/easy-log-handler   v1.0.9@224e1dfcf9455aceee89cd0af306ac097167fac1
egulias/email-validator 2.1.15@e834eea5306d85d67de5a05db5882911d5b29357
erusev/parsedown    1.7.4@cb17b6477dfff935958ba01325f2e8a2bfa6dab3
exsyst/swagger  v0.4.1@a02984db5edacdce2b4e09dae5ba8fe17a0e449e
friendsofsymfony/rest-bundle    2.6.0@54758949bff9fc520997415341323eebf3f54892
friendsofsymfony/user-bundle    dev-master@a9e71b6e7b61e7f39ba77436ba3e9af954450c4b
gedmo/doctrine-extensions   v2.4.39@c549b40bff560380c53812283d25ce42ee0992e4
guzzlehttp/psr7 1.6.1@239400de7a173fe9901b9ac7c06497751f00727a
hoa/compiler    3.17.08.08@aa09caf0bf28adae6654ca6ee415ee2f522672de
hoa/consistency 1.17.05.02@fd7d0adc82410507f332516faf655b6ed22e4c2f
hoa/event   1.17.01.13@6c0060dced212ffa3af0e34bb46624f990b29c54
hoa/exception   1.17.01.16@091727d46420a3d7468ef0595651488bfc3a458f
hoa/file    1.17.07.11@35cb979b779bc54918d2f9a4e02ed6c7a1fa67ca
hoa/iterator    2.17.01.10@d1120ba09cb4ccd049c86d10058ab94af245f0cc
hoa/math    1.17.05.16@7150785d30f5d565704912116a462e9f5bc83a0c
hoa/protocol    1.17.01.14@5c2cf972151c45f373230da170ea015deecf19e2
hoa/regex   1.17.01.13@7e263a61b6fb45c1d03d8e5ef77668518abd5bec
hoa/stream  1.17.02.21@3293cfffca2de10525df51436adf88a559151d82
hoa/ustring 4.17.01.16@e6326e2739178799b1fe3fdd92029f9517fa17a0
hoa/visitor 2.17.01.16@c18fe1cbac98ae449e0d56e87469103ba08f224a
hoa/zformat 1.17.01.10@522c381a2a075d4b9dbb42eb4592dd09520e4ac2
illuminate/cache    v6.12.0@e75f1a222cea581deb1da3072440eaba965b7283
illuminate/contracts    v6.12.0@f1326dfae72c646a8598138b446347954f5e991e
illuminate/support  v6.12.0@0c6bf7cd56a63e46358e6443f90293e429546bc8
intervention/image  2.5.1@abbf18d5ab8367f96b3205ca3c89fb2fa598c69e
jdorn/sql-formatter v1.2.17@64990d96e0959dff8e059dfcdc1af130728d92bc
jms/metadata    2.1.0@8d8958103485c2cbdd9a9684c3869312ebdaf73a
jms/serializer  3.4.0@e2d3c49d9322a08ee32221a5623c898160dada79
jms/serializer-bundle   3.5.0@5793ec59b2243365a625c0fd78415732097c11e8
kevinpapst/adminlte-bundle  3.1.2@ef9b9bec1ffcc47ab8cde30e705c08e82262fd53
kimai/kimai2-composer   0.1@7ff68f4270d2e48920309a3c1530f4d247a24905
laminas/laminas-ldap    2.10.1@52d67bbe6095da4e7e3578407e44322a6d7874ce
laminas/laminas-zendframework-bridge    1.0.1@0fb9675b84a1666ab45182b6c5b29956921e818d
laravolt/avatar 3.0.6@bec46869822ffa85284216c839ab41c9c967ff9d
league/csv  9.5.0@b348d09d0d258a4f068efb50a2510dc63101c213
markbaker/complex   1.4.7@1ea674a8308baf547cbcbd30c5fcd6d301b7c000
markbaker/matrix    1.2.0@5348c5a67e3b75cd209d70103f916a93b1f1ed21
monolog/monolog 1.25.3@fa82921994db851a8becaf3787a9e73c5976b6f1
mpdf/mpdf   v7.1.9@a0fc1215d2306aa3b4ba6e97bd6ebe4bab6a88fb
myclabs/deep-copy   1.9.5@b2c28789e80a97badd14145fda39b545d83ca3ef
nelmio/api-doc-bundle   v3.5.0@f596adfb4d16e65d1a1941f907092a119d4c76cb
nelmio/cors-bundle  1.5.6@10a24c10f242440211ed31075e74f81661c690d9
nesbot/carbon   2.29.1@e509be5bf2d703390e69e14496d9a1168452b0a2
ocramius/package-versions   1.4.2@44af6f3a2e2e04f2af46bcb302ad9600cba41c7d
ocramius/proxy-manager  2.1.1@e18ac876b2e4819c76349de8f78ccc8ef1554cd7
pagerfanta/pagerfanta   v2.1.3@a53ff01d521648d9dbca19b93ac6bc75a59b0972
paragonie/random_compat v9.99.99@84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95
pclzip/pclzip   2.8.2@19dd1de9d3f5fc4d7d70175b4c344dee329f45fd
phpdocumentor/reflection-common 2.0.0@63a995caa1ca9e5590304cd845c15ad6d482a62a
phpdocumentor/reflection-docblock   4.3.4@da3fd972d6bafd628114f7e7e036f45944b62e9c
phpdocumentor/type-resolver 1.0.1@2e32a6d48972b2c1976ed5d8967145b6cec4a4a9
phpoffice/common    0.2.9@edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d
phpoffice/phpspreadsheet    1.10.1@1648dc9ebef6ebe0c5a172e16cf66732918416e0
phpoffice/phpword   0.15.0@dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f
psr/cache   1.0.1@d11b50ad223250cf17b86e38383413f5a6764bf8
psr/container   1.0.0@b7ce3b176482dbbc1245ebf52b181af44c2cf55f
psr/http-message    1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363
psr/log 1.1.2@446d54b4cb6bf489fc9d75f55843658e6f25d801
psr/simple-cache    1.0.1@408d5eafb83c57f6365a3ca330ff23aa4a5fa39b
ralouphie/getallheaders 3.0.3@120b605dfeb996808c31b6477290a714d356e822
sensio/framework-extra-bundle   v5.5.3@98f0807137b13d0acfdf3c255a731516e97015de
setasign/fpdi   1.6.2@a6ad58897a6d97cc2d2cd2adaeda343b25a368ea
swiftmailer/swiftmailer v6.2.3@149cfdf118b169f7840bbe3ef0d4bc795d1780c9
symfony/asset   v4.3.10@5bdbd8878b69e3be16d036890ea3081172ea28c5
symfony/cache   v4.3.10@44277074713f6959df50b857fcb43033cfc0c188
symfony/cache-contracts v1.1.7@af50d14ada9e4e82cfabfabdc502d144f89be0a1
symfony/config  v4.3.10@7b7d5d35a5ba5a62f2c6c69f574e36595e587d11
symfony/console v4.3.10@487f139d21506279eaf93d4469255daba3d8fb70
symfony/debug   v4.3.10@1eff904a9596e65aba8992671d4652deb0a22bc2
symfony/debug-bundle    v4.3.10@37f558ddd74933f0254bb5e3b6b758e1ee7ff699
symfony/debug-pack  v1.0.7@09a4a1e9bf2465987d4f79db0ad6c11cc632bc79
symfony/dependency-injection    v4.3.10@468bfb60a60b7caa03e4722c43f5359df47b4349
symfony/doctrine-bridge v4.3.10@fa0b739015d6565f080c3cbc2e65b38643a2a9c7
symfony/dotenv  v4.3.10@3e41dc2a3c517819b23cb4d1c95f5116182a8dd0
symfony/event-dispatcher    v4.3.10@75f99d7489409207d09c6cd75a6c773ccbb516d5
symfony/event-dispatcher-contracts  v1.1.7@c43ab685673fb6c8d84220c77897b1d6cdbe1d18
symfony/expression-language v4.3.10@fcc3e2085e4832f52bed94d72663962f650dfb23
symfony/filesystem  v4.3.10@fdc0ac5e64f7555818411a17993bb24be4270769
symfony/finder  v4.3.10@8174c13b932c71f10cdd8dfcd8f5e494f1e7003d
symfony/flex    v1.6.1@c497c0c77cb9018cccd9c092832ebf9826612f92
symfony/form    v4.3.10@05fac4992a100642806a50cc0c84fb4a8a326c14
symfony/framework-bundle    v4.3.10@4ea8f63e005af800e140c1bcfb1f748a006defd1
symfony/http-foundation v4.3.10@d7fde626946d8d1595bae553e2f5b6f451ed1966
symfony/http-kernel v4.3.10@fe7ab3c0abc04784a4f7ab511a6d876bc81cb4d4
symfony/inflector   v4.3.10@8c699257379098d26fa400edad29f703b380efcf
symfony/intl    v4.3.10@2d139d02ddae582c382d30cccd2ee4c814043518
symfony/mime    v4.3.10@50f65ca2a6c33702728024d33e4b9461f67623c4
symfony/monolog-bridge  v4.3.10@8c6a51c55add464d9e6ef7000f1877e4c75f9fbf
symfony/monolog-bundle  v3.5.0@dd80460fcfe1fa2050a7103ad818e9d0686ce6fd
symfony/options-resolver    v4.3.10@3438c6fe65a9794b0e9f3686d0e3771412a2c47a
symfony/orm-pack    v1.0.7@c57f5e05232ca40626eb9fa52a32bc8565e9231c
symfony/polyfill-ctype  v1.13.1@f8f0b461be3385e56d6de3dbb5a0df24c0c275e3
symfony/polyfill-intl-icu   v1.13.1@b3dffd68afa61ca70f2327f2dd9bbeb6aa53d70b
symfony/polyfill-intl-idn   v1.13.1@6f9c239e61e1b0c9229a28ff89a812dc449c3d46
symfony/polyfill-mbstring   v1.13.1@7b4aab9743c30be783b73de055d24a39cf4b954f
symfony/polyfill-php72  v1.13.1@66fea50f6cb37a35eea048d75a7d99a45b586038
symfony/polyfill-php73  v1.13.1@4b0e2222c55a25b4541305a053013d5647d3a25f
symfony/profiler-pack   v1.0.4@99c4370632c2a59bb0444852f92140074ef02209
symfony/property-access v4.3.10@28ecead27bd17937b3f904396b026a8e3915d0cd
symfony/property-info   v4.3.10@169aafe8f2a01ec50fb324f5d24bbd61a5799df1
symfony/routing v4.3.10@6cc4b6a92e3c623b2c7e56180728839b0caf8564
symfony/security-bundle v4.3.10@1cc02bd8e44eef0bd4ecfd53a8b4d7b26f675d85
symfony/security-core   v4.3.10@b22f9e7626c2d48b1431bd3db4bc9d7fed3bd0a7
symfony/security-csrf   v4.3.10@9e435026ab45f073880d1fbe0e1b17e7df6bf642
symfony/security-guard  v4.3.10@5d87ee4ffa5aa6e594008fa3cc65bc8f86ad6438
symfony/security-http   v4.3.10@2ea4960f4c402e528a855f43b32eda412b0e2077
symfony/serializer  v4.3.10@cd4f545209e1f3d408b5adda729c59bfd714a1a5
symfony/service-contracts   v1.1.8@ffc7f5692092df31515df2a5ecf3b7302b3ddacf
symfony/stopwatch   v4.3.10@4aff3715c98706ee25bdb4aced6591a9dffc3d9b
symfony/swiftmailer-bundle  v3.4.0@553d2474288349faed873da8ab7c1551a00d26ae
symfony/templating  v4.3.10@f566e0d4624eb4a4ec5847fdb46808ffc4168a0c
symfony/translation v4.3.10@46e462be71935ae15eab531e4d491d801857f24c
symfony/translation-contracts   v1.1.7@364518c132c95642e530d9b2d217acbc2ccac3e6
symfony/twig-bridge v4.3.10@9574613b74ed066f775eaf94bb15476ef58609de
symfony/twig-bundle v4.3.10@0471344717bfb081f10209ad6b8fd520ca8ebd9d
symfony/validator   v4.3.10@c380b4ab2a6d4bbc38f12b1b8f9da86aa2712a17
symfony/var-dumper  v4.3.10@c688afb42ae9f1c5ba45318ecfabc0d5e4fcc9ce
symfony/var-exporter    v4.3.10@563f728784ea09c8154ea57cf8192ae5d6f0d277
symfony/web-profiler-bundle v4.3.10@ef55f4aac938cdf8c2051ead22e18ad80ed4e4f8
symfony/webpack-encore-bundle   v1.7.2@787c2fdedde57788013339f05719c82ce07b6058
symfony/yaml    v4.3.10@8e0a95493b734ca8195acf3e1f3d89e88b957db5
twig/extensions v1.5.4@57873c8b0c1be51caa47df2cdb824490beb16202
twig/twig   v2.12.3@97b6311585cae66a26833b14b33785f5797f7d39
webmozart/assert    1.6.0@573381c0a64f155a0d9a23f4b0c797194805b925
white-october/pagerfanta-bundle v1.3.2@6df560869b5e09a3acf920890ab40598998b30ae
willdurand/jsonp-callback-validator v1.1.0@1a7d388bb521959e612ef50c5c7b1691b097e909
willdurand/negotiation  v2.3.1@03436ededa67c6e83b9b12defac15384cb399dc9
zendframework/zend-code 3.4.1@268040548f92c2bfcba164421c1add2ba43abaaa
zendframework/zend-escaper  2.6.1@3801caa21b0ca6aca57fa1c42b08d35c395ebd5f
zendframework/zend-eventmanager 3.2.1@a5e2583a211f73604691586b8406ff7296a946dd
zircote/swagger-php 2.0.15@5fd9439cfb76713925e23f206e9db4bf35784683
composer/semver 1.5.1@c6bea70230ef4dd483e6bbcab6005f682ed3a8de
composer/xdebug-handler 1.4.0@cbe23383749496fe0f373345208b79568e4bc248
dama/doctrine-test-bundle   v5.0.5@a60b0712f4659eab710c49783713b4b43e3c3149
doctrine/data-fixtures  1.4.2@39e9777c9089351a468f780b01cffa3cb0a42907
doctrine/doctrine-fixtures-bundle   3.3.0@8f07fcfdac7f3591f3c4bf13a50cbae05f65ed70
friendsofphp/php-cs-fixer   v2.16.1@c8afb599858876e95e8ebfcd97812d383fa23f02
fzaninotto/faker    v1.9.1@fc10d778e4b84d5bd315dad194661e091d307c6f
jean85/pretty-package-versions  1.2@75c7effcf3f77501d0e0caa75111aff4daa0dd48
nette/bootstrap v3.0.1@b45a1e33b6a44beb307756522396551e5a9ff249
nette/di    v3.0.3@77d69061cbf8f9cfb7363dd983136f51213d3e41
nette/finder    v2.5.2@4ad2c298eb8c687dd0e74ae84206a4186eeaed50
nette/neon  v3.1.0@0a18fc88801a14d66587932de133eeca01f7ce8e
nette/php-generator v3.3.3@a4ff22c91681fefaa774cf952a2b69c2ec9477c1
nette/robot-loader  v3.2.1@d2a100e1f5cab390c78bc88709abbc91249c3993
nette/schema    v1.0.2@febf71fb4052c824046f5a33f4f769a6e7fa0cb4
nette/utils v3.1.0@d6cd63d77dd9a85c3a2fae707e1255e44c2bc182
nikic/php-parser    v4.3.0@9a9981c347c5c49d6dfe5cf826bb882b824080dc
phar-io/manifest    1.0.3@7761fcacf03b4d4f16e7ccb606d4879ca431fcf4
phar-io/version 2.0.1@45a2ec53a73c70ce41d55cedef9063630abaf1b6
php-cs-fixer/diff   v1.3.0@78bb099e9c16361126c86ce82ec4405ebab8e756
phpspec/prophecy    v1.10.2@b4400efc9d206e83138e2bb97ed7f5b14b831cd9
phpstan/phpdoc-parser   0.3.5@8c4ef2aefd9788238897b678a985e1d5c8df6db4
phpstan/phpstan 0.11.19@63cc502f6957b7f74efbac444b4cf219dcadffd7
phpstan/phpstan-doctrine    0.11.6@77592865e167b32c7dcb4f39a35210e909a8854c
phpstan/phpstan-phpunit 0.11.2@fbf2ad56c3b13189d29655e226c9b1da47c2fad9
phpstan/phpstan-symfony 0.11.6@c7be3054c21fd472a52b1c38eb129c3f93776084
phpunit/php-code-coverage   7.0.10@f1884187926fbb755a9aaf0b3836ad3165b478bf
phpunit/php-file-iterator   2.0.2@050bedf145a257b1ff02746c31894800e5122946
phpunit/php-text-template   1.2.1@31f8b717e51d9a2afca6c9f046f5d69fc27c8686
phpunit/php-timer   2.1.2@1038454804406b0b5f5f520358e78c1c2f71501e
phpunit/php-token-stream    3.1.1@995192df77f63a59e47f025390d2d1fdf8f425ff
phpunit/phpunit 8.5.2@018b6ac3c8ab20916db85fa91bf6465acb64d1e0
sebastian/code-unit-reverse-lookup  1.0.1@4419fcdb5eabb9caa61a27c7a1db532a6b55dd18
sebastian/comparator    3.0.2@5de4fc177adf9bce8df98d8d141a7559d7ccf6da
sebastian/diff  3.0.2@720fcc7e9b5cf384ea68d9d930d480907a0c1a29
sebastian/environment   4.2.3@464c90d7bdf5ad4e8a6aea15c091fec0603d4368
sebastian/exporter  3.1.2@68609e1261d215ea5b21b7987539cbfbe156ec3e
sebastian/global-state  3.0.0@edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4
sebastian/object-enumerator 3.0.3@7cfd9e65d11ffb5af41198476395774d4c8a84c5
sebastian/object-reflector  1.1.1@773f97c67f28de00d397be301821b06708fca0be
sebastian/recursion-context 3.0.0@5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8
sebastian/resource-operations   2.0.1@4d7a795d35b889bf80a0cc04e08d77cedfa917a9
sebastian/type  1.1.3@3aaaa15fa71d27650d62a948be022fe3b48541a3
sebastian/version   2.0.1@99732be0ddb3361e16ad77b68ba41efc8e979019
symfony/browser-kit v4.3.10@66d301ce3458b522e3b1f2a76ecfccd1834dcf90
symfony/css-selector    v4.3.10@32203e7cc318dcfd1d5fb12ab35e595fc6016206
symfony/dom-crawler v4.3.10@ccf895f6f3ed9430f53ae1ce34566e9bb6c58446
symfony/maker-bundle    v1.14.3@c864e7f9b8d1e1f5f60acc3beda11299f637aded
symfony/phpunit-bridge  v4.4.3@901b0c06134b4b7c7e6dea152256b944a152117b
symfony/process v4.3.10@61ab103012c3072fb340447a34598714ba74ba6f
symfony/thanks  v1.2.5@a8a5fbe3907a52cb7e2bb704d3b0231782b4193c
symfony/web-server-bundle   v4.3.10@2338445b78f1fb212a96f4286abdc77ee1e92607
theseer/tokenizer   1.1.3@11336f6f84e16a720dae9d8e6ed5019efa85a0f9
symfony/polyfill-iconv  *@
symfony/polyfill-php71  *@
symfony/polyfill-php70  *@
symfony/polyfill-php56  *@
kevinpapst/kimai2   No version set (parsed as 1.0.0)@```

I'm still getting errors in prod log:

```[2020-01-27 17:10:13] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] php.INFO: User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. at /opt/kimai/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php:66)"} []
[2020-01-27 17:10:13] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-27 17:10:13] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] request.CRITICAL: Uncaught PHP Exception LogicException: "An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates." at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366 {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-27 17:10:13] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []```

II. Exact steps that I followed to install this repo:

  1. Created dedicated directory for kimai /srv/kimai
  2. Cloned this repo to the /srv/kimai/ with git clone https://github.com/tobybatch/kimai2.git .
  3. Modified docker-compose.yml and local.yaml as stated in the first post
  4. Logged in to the container to fix root owner/group for local.yaml inside container (kimai is working without this steps): a) docker exec -u root -it CONTAINER /bin/bash b) cd /opt/kimai/config/packages c) chown www-data local.yaml && chgrp www-data local.yml
  5. I can log in via the web interface with LDAP working to the kimai, with the same errors as stated before in prod.log, and outdated/unrecognized packages inside Doctor/Composer packages in web interface.

I'm not familiar with symphony / composer frameworks, but I would gladly provide results and test any ideas that @tobybatch and @kevinpapst might have on resolving this issue.

Thanks for the help so far guys!

vvirehead commented 4 years ago

It looks like the example docker from the main page is using 1.5 tag 🤦‍♂

I changed it inside docker-compose to fpm-alpine-1.7-prod and fpm-alpine-master-prod` but it resulted in the same error that I reported previously, so I ran instructions from update manual: https://www.kimai.org/documentation/updates.html

Upgrade log ```shell sudo docker exec -u root -it kimai_kimai_1 /bin/sh /var/www/html # cd /opt/kimai /opt/kimai # composer install --no-dev --optimize-autoloader Loading composer repositories with package information Installing dependencies from lock file Package operations: 0 installs, 0 updates, 41 removals - Removing theseer/tokenizer (1.1.3) - Removing symfony/process (v4.3.9) - Removing symfony/phpunit-bridge (v4.4.2) - Removing symfony/maker-bundle (v1.14.3) - Removing symfony/dom-crawler (v4.3.9) - Removing symfony/css-selector (v4.3.9) - Removing symfony/browser-kit (v4.3.9) - Removing sebastian/version (2.0.1) - Removing sebastian/type (1.1.3) - Removing sebastian/resource-operations (2.0.1) - Removing sebastian/recursion-context (3.0.0) - Removing sebastian/object-reflector (1.1.1) - Removing sebastian/object-enumerator (3.0.3) - Removing sebastian/global-state (3.0.0) - Removing sebastian/exporter (3.1.2) - Removing sebastian/environment (4.2.3) - Removing sebastian/diff (3.0.2) - Removing sebastian/comparator (3.0.2) - Removing sebastian/code-unit-reverse-lookup (1.0.1) - Removing phpunit/phpunit (8.5.2) - Removing phpunit/php-token-stream (3.1.1) - Removing phpunit/php-timer (2.1.2) - Removing phpunit/php-text-template (1.2.1) - Removing phpunit/php-file-iterator (2.0.2) - Removing phpunit/php-code-coverage (7.0.10) - Removing phpstan/phpstan-symfony (0.12.3) - Removing phpstan/phpstan-phpunit (0.12.6) - Removing phpstan/phpstan-doctrine (0.12.9) - Removing phpstan/phpstan (0.12.5) - Removing phpspec/prophecy (1.10.1) - Removing php-cs-fixer/diff (v1.3.0) - Removing phar-io/version (2.0.1) - Removing phar-io/manifest (1.0.3) - Removing nikic/php-parser (v4.3.0) - Removing fzaninotto/faker (v1.9.1) - Removing friendsofphp/php-cs-fixer (v2.16.1) - Removing doctrine/doctrine-fixtures-bundle (3.3.0) - Removing doctrine/data-fixtures (1.4.1) - Removing dama/doctrine-test-bundle (v5.0.5) - Removing composer/xdebug-handler (1.4.0) - Removing composer/semver (1.5.1) Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead. Package zendframework/zend-escaper is abandoned, you should avoid using it. Use laminas/laminas-escaper instead. Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead. Generating optimized autoload files ocramius/package-versions: Generating version class... ocramius/package-versions: ...done generating version class Executing script cache:clear [OK] Executing script assets:install [OK] /opt/kimai # bin/console kimai:update Kimai updates running ... ========================= Application Migrations No migrations to execute. Rebuilding your cache, please be patient ... // Clearing the cache for the prod environment with debug false [OK] Cache for the "prod" environment (debug=false) was successfully cleared. // Warming up the cache for the prod environment with debug false [OK] Cache for the "prod" environment (debug=false) was successfully warmed. [OK] Congratulations! Successfully updated Kimai 2 to version 1.7 (stable) /opt/kimai # chown -R :www-data . /opt/kimai # chmod -R g+r . /opt/kimai # chmod -R g+rw var/ /opt/kimai # chmod -R g+rw public/avatars/ ```

I could log in after changing permissions (last 4 commands), but even all that I got:


symfony/polyfill-iconv  *@
symfony/polyfill-php71  *@
symfony/polyfill-php70  *@
symfony/polyfill-php56  *@
kevinpapst/kimai2   No version set (parsed as 1.0.0)@```
vvirehead commented 4 years ago

Ok, I got one thing fixed:

  nginx:
    [...]
    healthcheck:
      test:  wget --spider http://nginx/health || exit 1
    [...]
  kimai:
    [...]
    healthcheck:
      test: wget --spider http://nginx || exit 1

Above healthchecks with default config were causing this error:

[2020-01-27 17:10:13] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\BadRequestHttpException: "Untrusted Host "nginx"." at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php line 71 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] php.INFO: User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Creating Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. at /opt/kimai/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php:66)"} []
[2020-01-27 17:10:13] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-27 17:10:13] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] request.CRITICAL: Uncaught PHP Exception LogicException: "An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates." at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366 {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []
[2020-01-27 17:10:13] request.CRITICAL: Exception thrown when handling an exception (LogicException: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php line 366) {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366)"} []
[2020-01-27 17:10:13] php.CRITICAL: Uncaught Exception: An instance of Symfony\Component\Templating\EngineInterface must be injected in FOS\RestBundle\View\ViewHandler to render templates. {"exception":"[object] (LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, LogicException(code: 0): An instance of Symfony\\Component\\Templating\\EngineInterface must be injected in FOS\\RestBundle\\View\\ViewHandler to render templates. at /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php:366, Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-kernel/HttpKernel.php:71, Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException(code: 0): Untrusted Host \"nginx\". at /opt/kimai/vendor/symfony/http-foundation/Request.php:1191)"} []

Correct configuration is to swap nginx with whatever TRUSTED_HOST you've entered, ie yourdomain :

  nginx:
    [...]
    healthcheck:
      test:  wget --spider http://yourdomain/health || exit 1
    [...]
  kimai:
    environment:
      [...]
      - TRUSTED_HOSTS=yourdomain
    [...]
    healthcheck:
      test: wget --spider http://yourdomain || exit 1

This way I got my prod.log clean. Hope this helps anybody.

Also @tobybatch perhaps it's worth considering adding some additional info about docker-compose configuration?

This still leaves me with missing Doctor entries:

symfony/polyfill-iconv  *@
symfony/polyfill-php71  *@
symfony/polyfill-php70  *@
symfony/polyfill-php56  *@
kevinpapst/kimai2   No version set (parsed as 1.0.0)@

/opt/kimai/bin/console kimai:version outputs: Kimai 2 - 1.7 stable (Ayumi) by Kevin Papst and contributors. - so I don't know what's going on or is this installation seriously broken 🤔

kevinpapst commented 4 years ago

Does it work or do you have any visible bug? I have never tested all features with docker, so maybe maybe maybe the composer information check is simply broken in the docker environment.

vvirehead commented 4 years ago

@kevinpapst another issue popped out when I released it to actual production: https://github.com/tobybatch/kimai2/issues/79

As I recall it worked when I used image: kimai/kimai2:fpm-alpine-1.5-prod - but then I had those errors with outdated composer libs.

Issue #79 happened with image: kimai/kimai2:fpm-alpine-1.7-prod and correct composer libs (aside from kimai)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.