Coder Social home page Coder Social logo

tobybatch / kimai2 Goto Github PK

View Code? Open in Web Editor NEW
183.0 9.0 96.0 884 KB

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.

License: MIT License

Dockerfile 44.81% Shell 28.85% PHP 9.37% Makefile 16.97%
docker docker-compose kimai2 helm-chart kimai kubernetes

kimai2's Introduction

Kimai Dockers

After 6 years of maintaining a separate repo for this project we have, as of Jan 8th 2024 officially folded the docker files into the main Kimai repo.

The built images are still pushed to docker hub

Documentation is available as part of the core Kimai docker documentation

Issues can now be raised on the issues page of the main Kimai repo.

The old README is here just in case you wanted it.

kimai2's People

Contributors

addosolutions avatar birkenstab avatar blissini avatar danielvandenberg95 avatar dependabot[bot] avatar dom6770 avatar dreiekk avatar drustan avatar hexxone avatar jfowl avatar julianpedro avatar kevinpapst avatar kimar avatar kurgol avatar lberruti avatar liaraalis avatar moritzgloeckl avatar pbek avatar robjuz avatar stranljip avatar thronryzer avatar timlegge avatar tobybatch avatar tstrohmeier avatar wanoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kimai2's Issues

Rename repo?

This might be a stupid question, but could you rename the repository to kimai2-docker?
The naming is a bit misleading and forking it creates a repository called kimai2-1, at least if someone already has Kimai2 cloned.

Links not working

Hey @tobybatch,

just noticed that all links in the prod README are not working, I guess you mixed up the order of parameters for them [ name of the link ]( followed by the url )

500: Internal Server Error on on registering new user in prod

i tried to register a new user with the following settings:

image prod
no settings changed, all default ports exposed.

image prod with mysql database and only 8080 exposed (why is 80 and 8001 exposed by default? only 8080 works for me)

upon clicking register new user or forgot password after running kimai, i get:

(
http://xxxxx:xxxx/de/resetting/request
http://xxxx:xxxx/de/register/
)

Oops! Ein Fehler ist aufgetreten.
500: Internal Server Error
Ein unerwarteter Fehler ist aufgetreten. Möglicherweise haben Sie einen Bug gefunden, daher kontaktieren Sie bitte ihren Administrator wenn der Fehler nach einem erneuten Versuch immer noch vorhanden sein sollte.

Log says:

192.168.1.106 - - [23/Jan/2019:09:40:47 +0000] "GET /de/register/ HTTP/1.1" 500 810 "http://xxxx:xxxx/de/login" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0"

[BUG] LDAP not supported in latest docker version

Describe the bug
LDAP not supported in latest docker version

To Reproduce
Steps to reproduce the behaviour:

  1. Start the container '...'
  2. fails to start
  3. review logs
  4. See error

kimai_1 | [19-Dec-2019 17:09:29] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'l dap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so (Error loading shared library libldap -2.4.so.2: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so)), /u sr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so.so (Error loading shared library /usr/local/lib/php/ext ensions/no-debug-non-zts-20180731/ldap.so.so: No such file or directory)) in Unknown on line 0
postfix_1 | 2019-12-19 17:09:29,773 INFO spawned: 'postfix' with pid 94
postfix_1 | 2019-12-19 17:09:29,773 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Desktop (please complete the following information):
Unrelated

Command used to run the container
/usr/local/bin/docker-compose up

Docker compose file (with passwords redacted)

services:

  mydb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimai
      - MYSQL_PASSWORD=############
      - MYSQL_ROOT_PASSWORD=############
    volumes:
        - mysql:/var/lib/mysql:z
    networks:
        - kimai2-network
    command: --default-storage-engine innodb
    restart: always

  kimai:
    image: kimai/kimai2:fpm-alpine-1.5-prod
    environment:
        - APP_ENV=dev
        - TRUSTED_HOSTS=localhost
        - DATABASE_URL=mysql://kimai:#######@mydb/kimai
        - ADMINMAIL=##############
        - ADMINPASS=###############
    volumes:
        - ./local.yaml:/opt/kimai/config/packages/local.yaml:z
        - ./ldap:/etc/ldap:z
    networks:
        - kimai2-network
    depends_on:
        - mydb
    ports:
        - 8001:8001
    restart: always

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: example.com
      smtp_user: kimai:kimai
    networks:
      - kimai2-network
    restart: unless-stopped
    restart: always

volumes:
  mysql:

networks:
  kimai2-network:

Additional context
Add any other context about the problem here.

Database password needs to be url encoded (prod docker)

I had that problem now a coupe of times and sooner or later it will rise here as well:
if the database passwords contains special character like /, \ or @ Kimai will not work, as the DATABASE_URL is then invalid / can't be parsed by Doctrine.

So you might want to adjust that in the startup.sh

And while you are on it, I saw that you are using both /opt/kimai/ and /var/www/html/ in the startup.sh script. I guess its a symlink, but that maybe confusing to others.

1.5 released

1.5 has been released 15 days ago but pulling the apache-debian-master image is not updating it.

CC @kevinpapst

[FEATURE] Better docs for trusted hosts

Is your feature request related to a problem? Please describe.
We need better explanation of how to set trusted hosts so there isn't a security error

Additional context
See #65

Stuck at UTC time - Not using docker container time?

I am stuck with UTC time when running kimai as a docker instance. I have ensured that both my kimai and mysql docker instance is in the correct timezone and not UTC.

I have tried using both -v /etc/localtime:/etc/localtime:ro and -e "TZ=Continent/City" as well as using tzdata, not that either should give a different result.

How to repeat:
(Use Amsterdam timezone as an example which is +1 hour of utc time)
docker run --rm -ti -p 8080:8080 --name kimai2 kimai/kimai2 -e "TZ=Europe/Amsterdam" (... etc)

How to use a local.yaml?

Hi @tobybatch,
how I can use a config/packages/local.yaml with the boxes?
Could you maybe document that ... or explain it to me and I will test it and sent you a PR for updating the README?

Run as unprivileged user mapped to a host user/group

It would be great if these images supported right off the shelf to run as an unprivileged user. One potential option to do this is to use a similar RUN entrypoint as linuxserver.io images use:

https://docs.linuxserver.io/general/understanding-puid-and-pgid

Right now, it should not be too difficult to leverage FPM through a socket which another container or host reverse proxy can use to serve the static content and actual PHP processing. This would significantly enhance the 'default' security of the application, so as long as the container itself is properly initialized and configured, saving major Docker-specific vulnerabilities.

:-)

Unable to use mysql

Hello,
Thank you for this tool. I really like it and it will come in handy!

I am having an issue using mysql.
I started by cloning your git repo and ran the following:

docker build -t kimai/kimai2:prod --build-arg "TAG=1.0" --rm tags/1.0

In my docker-compose I have:
DATABASE_URL: mysql://kimai:SimpleTestPassword@mysql/kimai

But when I bring things up with docker-compose up I see:
kimai_1 | DATABASE_URL = sqlite:///%kernel.project_dir%/var/data/kimai.sqlite
kimai_1 | Using non mysql DB

Any ideas?

Thank you.

KimaiV2 as Docker container with email setup

Hi Toby,

in my docker-compose.yml I've override the environment for MAILER_URL and MAILER_FROM but when I check the SwiftmailerBundle, there are still shown the default values.

docker-compose.yml

kimai:
  ...
  environment:
    ...
    - MAILER_URL=smtp://username%40domain.com:[email protected]:587?encryption=tls&auth_mode=login
    - MAILER_FROM=username%40domain.com

docker exec kimai bin/console debug:config SwiftmailerBundle

Current configuration for "SwiftmailerBundle"
=============================================

swiftmailer:
    default_mailer: default
    mailers:
        default:
            url: '%env(MAILER_URL)%'
            spool:
                type: memory
                path: '%kernel.cache_dir%/swiftmailer/spool'
                id: null
            transport: smtp
            command: '/usr/sbin/sendmail -bs'
            username: null
            password: null
            host: localhost
            port: null
            timeout: 30
            source_ip: null
            local_domain: null
            encryption: null
            auth_mode: null
            delivery_addresses: {  }
            logging: false
            delivery_whitelist: {  }

Should my overwritten environment be visible in this output?

Thanks,
Michael

[BUG] Unable to load dynamic library 'ldap.so'

Describe the bug
Clean installation reports LDAP missing:

kimai_1    | PHP Warning:  PHP Startup: Unable to load dynamic library 'ldap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so (Error loading shared library libldap-2.4.so.2: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so.so: No such file or directory)) in Unknown on line 0

To Reproduce
Steps to reproduce the behaviour:

  1. pull the repo
  2. run docker-compose up
  3. observe error in console

Desktop (please complete the following information):

  • OS: Ubuntu 18.0.4
  • Docker version: 19.03.1
  • Docker compose version: 1.22.0

Command used to run the container

  • docker-compose up

Docker compose file (with passwords redacted)

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#### -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=localhost
      - TRUSTED_HOSTS=kimai.example.net
      - [email protected]
      - ADMINPASS=####
    volumes:
      #- ./opt/kimai:/opt/kimai
      - 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:

Additional context
I've read the https://www.kimai.org/documentation/ldap.html, and also tried to modify dockerfile (prod section at the bottom) - with same error output:

    composer install --working-dir=/opt/kimai --no-dev --optimize-autoloader && \
    composer clearcache && \
    composer require --working-dir=/opt/kimai laminas/laminas-ldap && \
    chown -R www-data:www-data /opt/kimai
USER www-data```

replaced laminas with `composer require zendframework/zend-ldap` in configurations with --working-dir and without.

How do I add configurations which have to be placed in the local configs (local.yaml)?

ℹ️ The kimai documentation says that configurations which can't be done by env vars should be placed in the file config/packages/local.yaml.

❓ How do I add such configurations to this docker installation?

👁️ Example config/packages/local.yaml from the docs:

An example config/packages/local.yaml file might look like this:

kimai:
   timesheet:
       rounding:
           default:
               begin: 15
               end: 15
admin_lte:
   options:
       default_avatar: build/apple-touch-icon.png

How to debug failing schema updates?

How should I / can I debug this?

www-data@e9c8135da38b:/opt/kimai$ bin/console -n doctrine:schema:update
13:18:02 ERROR     [console] Error thrown while running command "-n doctrine:schema:update". Message: "An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory" ["exception" => Doctrine\DBAL\Exception\ConnectionException { â¦},"command" => "-n doctrine:schema:update","message" => "An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory"]

In AbstractMySQLDriver.php line 113:
                                                                                     
  An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory  
                                                                                     

In PDOConnection.php line 50:
                                                    
  SQLSTATE[HY000] [2002] No such file or directory  
                                                    

In PDOConnection.php line 46:
                                                    
  SQLSTATE[HY000] [2002] No such file or directory  
                                                    

doctrine:schema:update [--complete] [--dump-sql] [-f|--force] [--em [EM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

The database connection is fine, because on startup the container shows some tables.

DATABASE_URL = mysql://kimai:<secret>@172.17.0.1/kimai
Using Mysql DB
Tables_in_kimai
<other tables in database shown here but removed because not relevant here>
kimai2_activities
kimai2_customers
kimai2_invoice_templates
kimai2_projects
kimai2_timesheet
kimai2_user_preferences
kimai2_users

Fatal Error with docker-compose sample script

Hello everyone,

i used the sample docker compose script for production from https://hub.docker.com/r/kimai/kimai2.
After i started this, first i get an error because the password is to short (at least 8 chars).
So i changed it to pass1234.

Now i can start the containers successfully. But after connect to the webserver and try to login with [email protected] and pass1234 i will get this error message:

Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedFunctionException: Attempted to call function "imagettfbbox" from namespace "Intervention\Image\Gd". in /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php:86 Stack trace: #0 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php(141): Intervention\Image\Gd\Font->getBoxSize() #1 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php(30): Intervention\Image\Gd\Font->applyToImage(Object(Intervention\Image\Image), 50, 50) #2 /opt/kimai/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(94): Intervention\Image\Commands\TextCommand->execute(Object(Intervention\Image\Image)) #3 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Image.php(108): Intervention\Image\AbstractDriver->executeCommand(Object(Intervention\Image\Image), 'text', Array) #4 /opt/kimai/vendor/laravolt/avatar/src/Avatar.php(412): Intervention\Image\Image->__call('text', Array) #5 /opt/kimai/vendor/laravol in /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php on line 86

Do you have any idea whats going wrong with this?

Kimai crashes when I do export pdf

After updating kimai 0.8.1 to version kimai / kimai2: apache-debian-1.4.1 I encounered with one more error.
I open menu "Export", enter some data, choose "PDF format" and press "export".

export

I get the pdf file, but after that Kimai crashed and I get the message below:

Error

To restore Kimai I need to use the command:
sudo docker-compose up -d --force-recreate

KimaiV2 as Docker container with LDAP

In an email i received:

Hi Toby,

thanks for your work on Kimai with Docker.

I've started a successfull new Kimai setup. It's all working OK. Next
step would be the integration of my LDAP server.

I've found this KB article: https://www.kimai.org/documentation/ldap.html

Unforunately I am not sure, Kimai as Docker container is working fine
with the ZendFramework LDAP library.

Is there a example setup for Kimai as Docker with LDAP?

Many thanks and greetings from Germany,
Michael

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

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):

  • OS: Ubuntu 18.04
  • Docker version: 19.03.1
  • Docker compose version: 1.22.0,

Command used to run the container

  • docker-compose up

Docker compose file (with passwords redacted)

docker-compose.yml
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=###
      - [email protected]
      - 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
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] 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.

Error 500 When I click on "My profile"

Hey. We used kimai 0.8.1 built on the basis of docker. 10/10/2019 We updated to version kimai / kimai2: apache-debian-1.4.1.

When I click on "My profile" I get an error:
My profile

What logs to show me?

Document Secure LDAP configuration

Just some notes on how to configure working secure LDAP (636 SSL or 389 STARTTLS)

  1. Create ldap directory
  2. In docker-compose.yaml mount local.yaml and ldap directory under kimai volumes:
    • ./local.yaml:/opt/kimai/config/packages/local.yaml:z
    • ./ldap:/etc/ldap:z
  3. Copy /etc/ldap/ldap.conf to local ldap directory
  4. Create certs directory in local ldap directory
  5. Copy Root Certificate for LDAP Server Certificate to local ldap/certs/ directory as ROOT-CA.pem
  6. Add the following to the bottom of local ldap/ldap.conf
    TLS_CACERT /etc/ldap/certs/ROOT-CA.pem
  7. specify useSsl: true or useStartTls: true in local.yaml file

Start Kimai with docker-compose up

Issues to look for:

  1. In local.yaml the host: can be the domain name (example.com)
  2. If that results in intermittent failures examine the SSL certificate of the server. One or more of the servers may be providing a certificate without the domain (example.com) in the Subject Alternative Name (Windows randomly selects the certificate if there are multiple)

error after upgrade to 1.4

Hi,
after upgrading from apache-debian-1.3 to apache-debian-1.4 I receive the following error after logging in:

Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedFunctionException: Attempted to call function "imagettfbbox" from namespace "Intervention\Image\Gd". in /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php:86 Stack trace: #0 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php(141): Intervention\Image\Gd\Font->getBoxSize() #1 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php(30): Intervention\Image\Gd\Font->applyToImage(Object(Intervention\Image\Image), 50, 50) #2 /opt/kimai/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php(94): Intervention\Image\Commands\TextCommand->execute(Object(Intervention\Image\Image)) #3 /opt/kimai/vendor/intervention/image/src/Intervention/Image/Image.php(108): Intervention\Image\AbstractDriver->executeCommand(Object(Intervention\Image\Image), 'text', Array) #4 /opt/kimai/vendor/laravolt/avatar/src/Avatar.php(412): Intervention\Image\Image->__call('text', Array) #5 /opt/kimai/vendor/laravol in /opt/kimai/vendor/intervention/image/src/Intervention/Image/Gd/Font.php on line 86

any idea?

[BUG] LDAP Libs won't build in the alpine container

Describe the bug
LDAP Libs won't build in the alpine container

To Reproduce

Check out bugfix/fpm-ldap-library-ext

Build the FPM dev container:

  1. docker build -t test-fpm --build-arg BASE=fpm-alpine --target=base .
  2. docker run --rm -ti --entrypoint "/bin/sh" test-fpm:latest
  3. php -m
  4. No LDAP module

Build the debian container

  1. docker build -t test-deb --build-arg BASE=apache-debian --target=base .
  2. docker run --rm -ti --entrypoint "/bin/sh" test-deb:latest
  3. php -m
  4. LDAP module present

Desktop (please complete the following information):

  • OS: ubuntu 19.10
  • Docker version: 19.03.2, build 6a30dfca03
  • Docker compose version: 1.21.0, build unknown

Additional context
The alpine dev container does not have these file, I can't see why:

/var/www/html # find / |grep ldap
/usr/lib/libldap_r.so
/usr/lib/libldap-2.4.so.2
/usr/lib/libldap_r.a
/usr/lib/libldap.a
/usr/lib/libldap_r-2.4.so.2
/usr/lib/libldap.so
/usr/lib/openldap
/usr/lib/openldap/pw-pbkdf2.a
/usr/lib/openldap/mqtt.a
/usr/lib/libldap-2.4.so.2.10.11
/usr/lib/libldap_r-2.4.so.2.10.11
/usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini
/usr/include/ldap_utf8.h
/usr/include/ldap_features.h
/usr/include/ldap_schema.h
/usr/include/openldap.h
/usr/include/ldap_cdefs.h
/usr/include/ldap.h
/etc/openldap
/etc/openldap/ldap.conf

Working with reverse proxy

I have a nginx-proxy docker-based reverse proxy server w/ SSL enabled that is in front of the docker container running the Kimai2 server.

I can successfully run the docker-compose file of kimai2 itself with no problem, however when I integrate it with jwilder/nginx-proxy setup things don't work at all. I am greeted with Bad gateway by nginx.

docker-compose.yml.log

I tried to mount the /opt/kimai as a volume, but that doesn't get mounted either (I suspect this is due to some permission issue) which causes app to crash.

kimai2.log

I am using another similar app that is built on Symfony framework called wallabag that defines bunch of SYMFONY related variables to work behind a reverse proxy. I tried setting these up as well without luck.

Any ideas?
Best regards,
noble

Apache keeps restarting

kimai_1 | AH00534: apache2: Configuration error: No MPM loaded.
kimai_1 | Action '-D FOREGROUND' failed.
kimai_1 | The Apache error log may have more information.

Using the docker-compose.yaml file and getthe error above. The container continues to restart

Building nginx ERROR: Cannot locate specified Dockerfile: Dockerfile

docker-compose up results in

Building nginx
ERROR: Cannot locate specified Dockerfile: Dockerfile

docker-compose.yml
version: '3.5'
services:

sqldb:
image: mysql:5.7
environment:
- MYSQL_DATABASE=kimai
- MYSQL_USER=kimaiuser
- MYSQL_PASSWORD=kimaipassword
- MYSQL_ROOT_PASSWORD=changemeplease
volumes:
- /var/lib/mysql
command: --default-storage-engine innodb
restart: unless-stopped
healthcheck:
test: mysqladmin -pchangemeplease ping -h localhost
interval: 20s
start_period: 10s
timeout: 10s
retries: 3

nginx:
build: compose
ports:
- 8001: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

kimai:
image: kimai/kimai2:fpm-alpine-1.5-prod
environment:
- APP_ENV=prod
- TRUSTED_HOSTS=localhost
- ADMINMAIL=[email protected]
- ADMINPASS=changemeplease
volumes:
- 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

postfix:
image: catatnight/postfix
environment:
maildomain: neontribe.co.uk
smtp_user: kimai:kimai
restart: unless-stopped
restart: always

volumes:
var:
public:

bin/console fails with SQLSTATE[HY000] [2002]

I'm using Docker version 18.06.1-ce, build e68fc7a on a Debian system.

First I've adapted Your Docker-Compose file:
https://github.com/tobybatch/kimai2/blob/master/docker-compose.yml

After running into problems, I used it unchanged with the same result.

The web interface is working fine.
First test to create a user was fine.

Then using the console to import my Kimai V1 data, I tested to create a user.
But it fails with:
[ERROR] Reason: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

image

Also I can not import the data, same error.

Any ideas? Thanks

[BUG] Additional properties are not allowed ('start period' was unexpected) when using docker-compose

This may not fully be a bug, but instead a case of User Error. However, if it's not, then the issue I'm running into may be remedied with better instructions.

Describe the bug
When starting the docker containers with the command 'docker-compose up -d' docker states that the docker-compose file is invalid because all three services with healthcheck parameters defined in the docker-compose, have invalid syntax.

To Reproduce
Steps to reproduce the behaviour:

  1. sudo git clone https://github.com/tobybatch/kimai2.git kimai
  2. sudo cd /opt/kimai
  3. docker-compose up -d
  4. Notice the following errors are displayed:

ERROR: The Compose file './docker-compose.yml' is invalid because: > services.kimai.healthcheck value Additional properties are not allowed ('start_period' was unexpected)
services.nginx.healthcheck value Additional properties are not allowed ('start_period' was unexpected)
services.sqldb.healthcheck value Additional properties are not allowed ('start_period' was unexpected)

Desktop (please complete the following information):

  • OS: Ubuntu 18.04 bionic
  • Docker version: 19.03.5
  • Docker compose version: 1.17.1

Command used to run the container

  • docker-compose up -d

Docker compose file (with passwords redacted)

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - /var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -pchangemeplease ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  nginx:
    build: compose
    ports:
      - 8001: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 

  kimai:
    image: kimai/kimai2:fpm-alpine-1.5-prod
    environment:
      - APP_ENV=prod
      - TRUSTED_HOSTS=localhost
      - [email protected]
      - ADMINPASS=changemeplease
    volumes:
      - 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

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: neontribe.co.uk
      smtp_user: kimai:kimai
    restart: unless-stopped
    restart: always

volumes:
    var:
    public:

Additional context
Commenting out the start_period parameter made docker correctly pull, build and start kimai

[BUG] Pagination does not work

Describe the bug
The pagination does not work.

To Reproduce
Steps to reproduce the behaviour:

  1. clone repo
  2. change kimai version from 1.5 to 1.6
  3. run docker-compose
  4. add more than 51 activities to generate a button for page 2
  5. click button to change to page 2
  6. error: page does not change

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Docker version 19.03.5, build 633a0ea
  • Docker compose version: 1.24.1, build 4667896b

Command used to run the container

  • docker-compose up -d

Docker compose file (with passwords redacted)

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - /var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -pchangemeplease ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  nginx:
    build: compose
    ports:
      - 8001: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 

  kimai:
    image: kimai/kimai2:fpm-alpine-1.6-prod
    environment:
      - APP_ENV=prod
      - TRUSTED_HOSTS=localhost
      - [email protected]
      - ADMINPASS=changemeplease
    volumes:
      - 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

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: neontribe.co.uk
      smtp_user: kimai:kimai
    restart: unless-stopped
    restart: always

volumes:
    var:
    public:

Additional context
Changing the page via URL works like a charm:
http://localhost:8001/en/admin/activity/page/2

Am I missing some configuration?

Update to 1.0 breaks DB schema

Related to #11, I have updated to 1.0 just using docker compose pull with the tag latest and I'm getting 500 error on some timesheet pages.

Rolling back to 0.9 worked out, but I want to update to the new 1.0, so I have to update the DB manually?

I have the DATABASE_URL set on docker-compose.yaml correctly.

thanks

Error 500 after update to 1.5

I'm getting this error 500 after updating to 1.5

imagen

I just changed the kimai image base from

kimai/kimai2:apache-debian-master

to

kimai/kimai2:apache-debian-1.5-prod

¿What I'm doing wrong?

Next update requires MySQL timezone information

Hi!

With the next version, Kimai will require the MySQL timezone information populated.
https://mariadb.com/kb/en/library/mysql_tzinfo_to_sql/

Not sure what that means for your containers. On my systems I had to import them with:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

You can check if they are pre-filled by connecting to the Mysql shell and then select * from mysql.time_zone; - if the result is empty you need to issue the above command.

[BUG] invoices are not shown - timesheet entries are not shown in calender

Describe the bug
I implemented the kimai2 docker infrastructure based on your docker images/builds. Thank you for that. To access the containers I implemented a nginx reverse proxy in front of it (see docker-compose.yml and app.conf - the nginx proxy conf).
Everything works fine (export - all variations) except the invoice generation. The invoice generation does nothing (calls "https://zeit.xxxxxx.de/en/invoice/?searchTerm=&daterange=2020-01-01+-+2020-01-31&customer=1&project=&activity=&tags=&exported=5&template=1&preview=") but nothing appears, no DOCX is downloaded.
Btw. the calender doesn't show any timesheet entry, but is displayed correctly

Thank you for your help.

To Reproduce

  • Reset docker config with docker-compose stop && docker-compose rm && docker volume prune
  • Login with superadmin,
  • generate dummy customer, project, activity, timesheet entry
  • generate dummy invoice template (one DOCX based, one twig based)
  • try to generate invoice - no output

Desktop (please complete the following information):

  • OS: Windows
  • Firefox 71

Command used to run the container

  • docker-compose up

Docker compose file (with passwords redacted)

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - /var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -pchangemeplease ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  nginx:
    build: compose
    ports:
      - 8001: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 

  kimai:
    image: kimai/kimai2:fpm-alpine-1.5-prod
    environment:
      - APP_ENV=prod
      - TRUSTED_HOSTS=*,nginx,zeit.xxxxxxxxx.de
      - [email protected]
      - ADMINPASS=changemeplease
    volumes:
      - 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

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: neontribe.co.uk
      smtp_user: kimai:kimai
    restart: unless-stopped
    restart: always
  
  nginx-frontend:
    image: nginx:1.15-alpine
    ports:
      - '80:8000'
      - '443:443'
    volumes:
      - ./nginx-proxy/nginx:/etc/nginx/conf.d
      - ./nginx-proxy/nginx/www:/var/www/zeit.xxxxxxx.de
      - ./nginx-proxy/certbot/conf:/etc/letsencrypt
      - ./nginx-proxy/certbot/www:/var/www/certbot
    depends_on:
      - nginx
    command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"


  certbot:
    image: certbot/certbot
    volumes:
      - ./nginx-proxy/certbot/conf:/etc/letsencrypt
      - ./nginx-proxy/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"



volumes:
    var:
    public:
 

Additional context
***kimai container starts with a warning:
NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'ldap.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so (Error loading shared library libldap-2.4.so.2: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20180731/ldap.so.so: No such file or directory)) in Unknown on line 0
***nginx proxy config

server {
    listen 80;
    server_name zeit.xxxxxxxxx.de;    
    location / {
        return 301 https://$host$request_uri;
    }    
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    }
}
server {
    listen 443 ssl;
    server_name zeit.xxxxxx.de;
    
    ssl_certificate /etc/letsencrypt/live/zeit.xxxxxxxx.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/zeit.xxxxxx.de/privkey.pem;    
    
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

   
    server_tokens           off;
    server_name_in_redirect off;
    ignore_invalid_headers  on;
    if_modified_since       before;
    ssi                     on;
    ssi_silent_errors       on; # testing=off
    add_header X-Frame-Options SAMEORIGIN;
    add_header Strict-Transport-Security max-age=16000000; 

    ### tcp ###
    tcp_nodelay             off;
    tcp_nopush              on;
    sendfile                on;
    keepalive_requests      100;

    ### timeouts ###
    resolver_timeout        6;
    client_header_timeout   30;
    client_body_timeout     60;
    send_timeout            60;
    keepalive_timeout       65 20;

    ### buffers ###
    client_header_buffer_size   1k;
    client_body_buffer_size     128k;
    large_client_header_buffers 4 4k;
    client_max_body_size        10m;
#    client_body_temp_path       /var/spool/nginx/client/;
    output_buffers              1 32k;
    postpone_output             1460;

    ### proxy-buffers ###
    proxy_buffering         on;
    proxy_buffer_size       8k;
    proxy_buffers           256 8k;
    proxy_busy_buffers_size    64k;
    proxy_temp_file_write_size 64k;

    ### proxy-global ###
    proxy_intercept_errors  on; # testing=off
    proxy_ignore_client_abort off;
    proxy_redirect          http:// $scheme://;

   location / {
	proxy_pass http://nginx:80;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP  $remote_addr;
	proxy_set_header Host $host;
        # Adds the required header for SSL Offloading
	proxy_set_header X-Forwarded-Proto $scheme;
    }


} 

[BUG] Zend\Ldap is missing

Describe the bug
The zend-ldap is missing. I have added it to the Dockerfile but it's not there when I start the container. I'm at a loss as to why, can you point out my stupid mistake please?

To Reproduce
Steps to reproduce the behaviour:

  1. git fetch && git checkout bugfix/fpm-ldap-library-ext
  2. docker build -t kimai/kimai2:apache-debian-1.6.2-dev --build-arg BASE=apache-debian --target=dev --no-cache .
  3. cd compose && docker-compose -f docker-compose.base.yml -f docker-compose.apache.dev.yml -f docker-compose.ldap.yml up
  4. docker exec -ti compose_kimai_1 tail -f /opt/kimai/var/log/dev.log
  5. Open the login page http://localhost:8001/
  6. Try and log in as billiy / password123
  7. The login will fail, check the logs and you will see Zend\\Ldap\\Ldap is missing, install it with \"composer require zendframework/zend-ldap\"

Additional context
I am definitely adding the extension. I must have missed something really obvious.

Importing v1 data runs out of memory

Hi

I have imported the v1 data from my v1 installation to the mydb docker database. I am running the following command to import v1 data and it hits a memory limit:

Any ideas?

bin/console doctrine:schema:drop --force && bin/console doctrine:schema:create && bin/console kimai:import-v1 "mysql://user:pwd@containerid:3306/kimai_v1?charset=latin1" "kimai_" "test123" "US" "USD"

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes) in /opt/kimai/vendor/symfony/stopwatch/StopwatchEvent.php on line 105
20:34:09 CRITICAL [php] Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes) ["exception" => Symfony\Component\Debug\Exception\OutOfMemoryException^ { …}]

In StopwatchEvent.php line 105:

Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes)

kimai:import-v1 [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] [ []]

Quick start guide for Docker not working

The instructions given in the Quick start guide under Evaluate and in the documentation are not working.

docker run --rm -ti -p 8001:8001 --name kimai2 kimai/kimai2:dev
This is working

docker exec kimai2 bin/console kimai:create-user admin [email protected] ROLE_SUPER_ADMIN admin
Gives the error:

 [ERROR] plainPassword (admin)
             This value is too short. It should have 8 characters or more.

Changing the above command with a longer password will succeed, but the next command will also fail:
docker exec kimai2 bin/console kimai:reset-dev
Fails with:

 [ERROR] Failed to create database schema: Schema-Tool failed with Error 'An
         exception occurred while executing 'CREATE TABLE kimai2_users (id
         INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT
         NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT
         NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL,
         salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL,
         last_login DATETIME DEFAULT NULL --(DC2Type:datetime)
         , confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at
         DATETIME DEFAULT NULL --(DC2Type:datetime)
         , roles CLOB NOT NULL --(DC2Type:array)
         , alias VARCHAR(60) DEFAULT NULL, registration_date DATETIME DEFAULT
         NULL --(DC2Type:datetime)
         , title VARCHAR(50) DEFAULT NULL, avatar VARCHAR(255) DEFAULT NULL,
         api_token VARCHAR(255) DEFAULT NULL)':

         SQLSTATE[HY000]: General error: 1 table kimai2_users already exists'
         while executing DDL: CREATE TABLE kimai2_users (id INTEGER PRIMARY KEY
         AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL,
         username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL,
         email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt
         VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL, last_login
         DATETIME DEFAULT NULL --(DC2Type:datetime)
         , confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at
         DATETIME DEFAULT NULL --(DC2Type:datetime)
         , roles CLOB NOT NULL --(DC2Type:array)
         , alias VARCHAR(60) DEFAULT NULL, registration_date DATETIME DEFAULT
         NULL --(DC2Type:datetime)
         , title VARCHAR(50) DEFAULT NULL, avatar VARCHAR(255) DEFAULT NULL,
         api_token VARCHAR(255) DEFAULT NULL)

Can't start the container after update to 1.4

This is what the log shows:

Using Mysql DB
Tables_in_kimai
kimai2_activities
kimai2_activities_meta
kimai2_configuration
kimai2_customers
kimai2_customers_meta
kimai2_customers_teams
kimai2_invoice_templates
kimai2_projects
kimai2_projects_meta
kimai2_projects_teams
kimai2_tags
kimai2_teams
kimai2_timesheet
kimai2_timesheet_meta
kimai2_timesheet_tags
kimai2_user_preferences
kimai2_users
kimai2_users_teams
migration_versions
/startup.sh: line 30: /opt/kimai/bin/console: No such file or directory
/startup.sh: line 53: /opt/kimai/bin/console: No such file or directory
/startup.sh: line 54: /opt/kimai/bin/console: No such file or directory
/startup.sh: line 57: /opt/kimai/bin/console: No such file or directory
Error, unknown server type

I'm using Kubuntu 18.04 as host.

[BUG] Exception\SuspiciousOperationException: Untrusted Host

Again, this may be an issue with my lack of reading documentation properly, or not having the correct setup. Are there pre-requisites that I'm not aware of? Does the docker-compose properly take care of downloading and handling nginx?

Describe the bug
After starting the docker containers with the command 'docker-compose up -d' and navigating to the IP of the host that has kimai installed, the application in any browser displays a message that the host is untrusted. This appears to be a Symfony issue that, after researching, may be related to the docker-compose file not being correctly configured?

To Reproduce
Steps to reproduce the behaviour:

  1. sudo git clone https://github.com/tobybatch/kimai2.git kimai
  2. sudo cd /opt/kimai
  3. Comment out lines in the docker-compose related to start_period (18, 36, 54) to get around #64
  4. docker-compose up -d
  5. Notice the following error is displayed:

Fatal error: Uncaught Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Untrusted Host "10.20.10.132". in /opt/kimai/vendor/symfony/http-foundation/Request.php:1191 Stack trace: #0 /opt/kimai/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php(41): Symfony\Component\HttpFoundation\Request->getHost() #1 /opt/kimai/vendor/symfony/event-dispatcher/EventDispatcher.php(298): Symfony\Component\HttpKernel\EventListener\ValidateRequestListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #2 /opt/kimai/vendor/symfony/event-dispatcher/EventDispatcher.php(260): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher{closure}(Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #3 /opt/kimai/vendor/symfony/event-dispatcher/EventDispatcher.php(235): Symfony\Component\EventDispatcher in /opt/kimai/vendor/friendsofsymfony/rest-bundle/View/ViewHandler.php on line 366

Desktop (please complete the following information):

  • OS: Ubuntu 18.04 bionic
  • Docker version: 19.03.5
  • Docker compose version: 1.17.1

Command used to run the container

  • docker-compose up -d

Docker compose file (with passwords redacted)

services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - /var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -pchangemeplease ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  nginx:
    build: compose
    ports:
      - 8001: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 

  kimai:
    image: kimai/kimai2:fpm-alpine-1.5-prod
    environment:
      - APP_ENV=prod
      - TRUSTED_HOSTS=localhost
      - [email protected]
      - ADMINPASS=changemeplease
    volumes:
      - 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

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: neontribe.co.uk
      smtp_user: kimai:kimai
    restart: unless-stopped
    restart: always

volumes:
    var:
    public:

Additional context
Fresh new virtual machine with nothing but docker and docker-compose installed. Also, excuse me if I'm missing some crucial steps. I'm new to a fair bit of this.

Error running composer

@kevinpapst We are getting this error running composer install --working-dir=/opt/kimai --optimize-autoloader

It's during the docker creation process, and I can't replicate it if shell on and run the command. Can you offer any pointers as to where I can investigate?

#33 21.44 Generating optimized autoload files
#33 22.73 ocramius/package-versions:  Generating version class...
#33 22.73 ocramius/package-versions: ...done generating version class
#33 22.75 Executing script cache:clear [KO]
#33 23.84  [KO]
#33 23.84 Script cache:clear returned with error code 1
#33 23.84 !!  
#33 23.84 !!  In srcApp_KernelProdContainer.php line 1976:
#33 23.84 !!                                                                   
#33 23.84 !!    The parameter "!k(MISSING)ernel.project_dir" must be defined.  
#33 23.84 !!                                                                   
#33 23.84 !!  
#33 23.84 !!  
#33 23.84 Script @auto-scripts was called via post-install-cmd

Database not persistent?

Hi, I want to use Kimai2 for my startup, seems like the right tool for the job. As it is a reasonably light application, and I want to run multiple services on our VPS, I wanted to use the docker-method.
When following the instructions in the docker.md file for building and starting the container using the :prod option I get the server to run. I add some entries to test, stop and restart the container and all data (including users) is gone.

Is this done by design? How do I configure the container such that the data is persistent?

Thanks!

Create tagged versions

Are there plans to create tagged versions, same as the releases at https://github.com/kevinpapst/kimai2/releases

Always running (pulling) a "latest" version can be error prone.

A current workaround for me would be to build an image from :prod which does a git checkout 0.x.y && composer install. But actually this should be done here I think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.