Coder Social home page Coder Social logo

Comments (24)

tobybatch avatar tobybatch commented on July 30, 2024 2

@Schrolli91 I have a fix in place for this. (Very similar to your PR). I'll just check it and then push the changes. When I'm happy, I'll re-tag the images.

Do you want come on board and join me as a maintainer of the docker images? I'm pretty open to new input. If so we could maybe have a quick call sometime and just chat over how I'm doing things right now, and how we (I) could do it better.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024 1

I dont unserstand the Docker process at all.
Whats the difference between image: kimai/kimai2:apache-debian-master and image: kimai/kimai2:apache-debian-1.4?

1.4 is running but with the above described error.

master will terminates directly with the following messages on console (see also #34):

sudo docker-compose up
Starting kimai_mydb_1 ... 
Starting kimai_mydb_1 ... done
Recreating kimai_kimai_1 ... 
Recreating kimai_kimai_1 ... done
Attaching to kimai_mydb_1, kimai_kimai_1
mydb_1   | 2019-10-07 07:14:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
kimai_1  | DATABASE_URL = mysql://kimaiu:kimaip@mydb/kimai
kimai_1  | Using Mysql DB
mydb_1   | 2019-10-07 07:14:26 0 [Note] mysqld (mysqld 5.6.45) starting as process 1 ...
mydb_1   | 2019-10-07 07:14:26 1 [Note] Plugin 'FEDERATED' is disabled.
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: The InnoDB memory heap is disabled
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Memory barrier is not used
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Compressed tables use zlib 1.2.11
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Using Linux native AIO
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Using CPU crc32 instructions
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Completed initialization of buffer pool
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Highest supported file format is Barracuda.
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: 128 rollback segment(s) are active.
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: Waiting for purge to start
mydb_1   | 2019-10-07 07:14:26 1 [Note] InnoDB: 5.6.45 started; log sequence number 3038862
mydb_1   | 2019-10-07 07:14:26 1 [Note] Server hostname (bind-address): '*'; port: 3306
mydb_1   | 2019-10-07 07:14:26 1 [Note] IPv6 is available.
mydb_1   | 2019-10-07 07:14:26 1 [Note]   - '::' resolves to '::';
mydb_1   | 2019-10-07 07:14:26 1 [Note] Server socket created on IP: '::'.
mydb_1   | 2019-10-07 07:14:26 1 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
kimai_1  | Tables_in_kimai
kimai_1  | kimai2_activities
kimai_1  | kimai2_activities_meta
kimai_1  | kimai2_configuration
kimai_1  | kimai2_customers
kimai_1  | kimai2_customers_meta
kimai_1  | kimai2_customers_teams
kimai_1  | kimai2_invoice_templates
kimai_1  | kimai2_projects
kimai_1  | kimai2_projects_meta
kimai_1  | kimai2_projects_teams
kimai_1  | kimai2_tags
kimai_1  | kimai2_teams
kimai_1  | kimai2_timesheet
kimai_1  | kimai2_timesheet_meta
kimai_1  | kimai2_timesheet_tags
kimai_1  | kimai2_user_preferences
kimai_1  | kimai2_users
kimai_1  | kimai2_users_teams
kimai_1  | migration_versions
kimai_1  | /startup.sh: line 30: /opt/kimai/bin/console: No such file or directory
mydb_1   | 2019-10-07 07:14:26 1 [Warning] 'proxies_priv' entry '@ root@7a873e47fd32' ignored in --skip-name-resolve mode.
mydb_1   | 2019-10-07 07:14:26 1 [Note] Event Scheduler: Loaded 0 events
mydb_1   | 2019-10-07 07:14:26 1 [Note] mysqld: ready for connections.
mydb_1   | Version: '5.6.45'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
kimai_1  | /startup.sh: line 53: /opt/kimai/bin/console: No such file or directory
kimai_1  | /startup.sh: line 54: /opt/kimai/bin/console: No such file or directory
kimai_1  | /startup.sh: line 57: /opt/kimai/bin/console: No such file or directory
kimai_1  | Error, unknown server type
kimai_kimai_1 exited with code 0

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

@tobybatch Kimai 1.4 introduced new libs for avatar generation. The PHP extension GD was required before, but not used until now. Maybe that is the cause. Also Symfony and FosUserBundle were upgraded and the minimum password length was increased.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Thanks @kevinpapst I'll get a fix in for that ASAP

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

thanks for your effort - @tobybatch please let me know if there is a solution

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

It looks like GD is already baked in https://github.com/tobybatch/kimai2/blob/master/base/apache-debian/Dockerfile#L26

I'll take a better look when I get a second.

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

According to https://www.php.net/manual/en/function.imagettfbbox.php

Note: This function is only available if PHP is compiled with freetype support (--with-freetype-dir=DIR )

I will add a workaround in Kimai. If you can patch the source code, change this line:
https://github.com/kevinpapst/kimai2/blob/master/src/Utils/AvatarService.php#L125
from

if (!extension_loaded('gd')) {

to

if (!extension_loaded('gd') || !function_exists('imagettfbbox')) {

@tobybatch this one is older, but maybe helpful: https://stackoverflow.com/questions/49175139/trying-to-add-freetype-to-php-gd-in-docker-official-image

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

Sorry that's the automated build sending a broken build. I'll remove the 1.4 tag for the moment.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

I have tried t start the docker-compose with the kimai/kimai2:fpm-alpine-1.3
If i run this with APP_ENV=dev all looks ok an kimai starts.
But if i try to use APP_ENV=prod then i get an 500 error from the kimai page.

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

@Schrolli91 Can you share the full docker compose file with me please?

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

I have used this compose file from your repo: https://github.com/tobybatch/kimai2/blob/master/docker-compose/nginx/docker-compose.yml
Only changed the image from kimai - here is the used composer file

version: '3'
services:

  mydb:
    image: mysql:5.6
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiu
      - MYSQL_PASSWORD=kimaip
      - MYSQL_ROOT_PASSWORD=changeme
    volumes:
        - ./mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: always

  nginx:
    image: nginx:latest
    ports:
        - 8001:80
    volumes:
      - ./codebase:/opt/shared_kimai
      - ./nginx_site.conf:/etc/nginx/conf.d/default.conf

  kimai_fpm:
    image: kimai/kimai2:fpm-alpine-1.3
    environment:
        - APP_ENV=dev
        - TRUSTED_HOSTS=localhost
        - DATABASE_URL=mysql://kimaiu:kimaip@mydb/kimai
        - [email protected]
        - ADMINPASS=changeme123
    volumes:
      - ./codebase:/opt/shared_kimai
    entrypoint: /nginx-startup.sh

with APP_ENV=dev it seems to be running, but with APP_ENV=prod i get a 500 error

500error

Thats the console output after i get the 500:

kimai_fpm_1  | [07-Oct-2019 13:57:39] NOTICE: fpm is running, pid 51
kimai_fpm_1  | [07-Oct-2019 13:57:39] NOTICE: ready to handle connections
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET / HTTP/1.1" 302 304 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
kimai_fpm_1  | 172.24.0.2 -  07/Oct/2019:13:57:47 +0000 "GET /index.php" 302
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /de/homepage HTTP/1.1" 302 376 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
kimai_fpm_1  | 172.24.0.2 -  07/Oct/2019:13:57:48 +0000 "GET /index.php" 302
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /de/login HTTP/1.1" 500 7985 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
kimai_fpm_1  | 172.24.0.2 -  07/Oct/2019:13:57:48 +0000 "GET /index.php" 500
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /build/runtime.f02eb7c9.js HTTP/1.1" 304 0 "http://localhost:8001/de/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /build/0.2372f97a.js HTTP/1.1" 304 0 "http://localhost:8001/de/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /build/1.eec3372c.js HTTP/1.1" 304 0 "http://localhost:8001/de/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /build/app.21c06505.js HTTP/1.1" 304 0 "http://localhost:8001/de/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"
nginx_1      | 172.24.0.1 - - [07/Oct/2019:13:57:48 +0000] "GET /build/app.af6cd671.css HTTP/1.1" 304 0 "http://localhost:8001/de/login" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36"

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

@Schrolli91 Can you try it with docker-compoer up --build please.

I just did that (by instinct) and it worked here with your composer file. I think that if you omit the --build the old image that was configured to run with the dev env will be started and we want the newer prod env.

This is a guess but can you try it please.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

Doesn't change anything - but it do not rebuild anything, because we use pre-build images.

EDIT:
I'll try to complete re-pull the images with PROD - one moment please

EDIT2:
Won't work if i complete re-pull all the images an start it initial with PROD - only DEV is wokring

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

It's a permissions issue. I'll figure out why later but for now this should fix it:

docker-compose exec kimai_fpm chown -R www-data:www-data /opt/kimai/var/cache/

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

docker-compose exec kimai_fpm chown -R www-data:www-data /opt/kimai/var/cache/

Works! Thanks for your effort - Let me know if it is fixed

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

FYI - have seen that there now some builds for 1.4 and 1.4.1 - these builds are still broken - 1.3 works with your given permission work around

from kimai2.

kevinpapst avatar kevinpapst commented on July 30, 2024

Whats the error for 1.4.1?

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

1.4.1 -> starup.sh cannot be found - same at 1.4 - 1.3 works

mydb_1       | 2019-10-09 05:04:57 1 [Note] mysqld: ready for connections.
mydb_1       | Version: '5.6.45'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
kimai_fpm_1  | /startup.sh: line 30: /opt/kimai/bin/console: No such file or directory
kimai_fpm_1  | /startup.sh: line 53: /opt/kimai/bin/console: No such file or directory
kimai_fpm_1  | /startup.sh: line 54: /opt/kimai/bin/console: No such file or directory
kimai_fpm_1  | /startup.sh: line 57: /opt/kimai/bin/console: No such file or directory
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: fpm is running, pid 38
kimai_fpm_1  | [09-Oct-2019 05:05:02] NOTICE: ready to handle connections

from kimai2.

tobybatch avatar tobybatch commented on July 30, 2024

I know about these errors, I have an issue with the FPM images for 1.4 +

I am working to fix them but at the moment I'm working in foreign country have limited time. I have pulled the 1.4 and 1.4.1 fpm images until I can fix them. The apache ones should work.

Please bare with me.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

No problem - i thought that you are testing fixes for that because theres some >1.4 builds available again.
Was just a little Feedback post.

Maybe i can fix it myself - then i will push a PR

EDIT:
@tobybatch can you explain me, why the nginx_startup file copies the data to shared_kimai and make an symlink? I think there is the permission problems!
kimai_fpm_1 | cp: can't create '/opt/shared_kimai/CHANGELOG.md': Permission denied

I have build all images localy and now also 1.3 doesnt work.

EDIT2:
Now i understand - At the moment we mount the kimai folder, this folder is the empty one from outside. But it seems that the nginx_startup script makes the problems and after startup the container the local mounted folder is empty - so there is no kimai source anymore

I'm not sure how this can run in the past - without permissions.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

@tobybatch i have found the problem.

After mounting the folder there are no permissions because there are inherited from the host system.
Your dockerfile use the statement USER and thats the problem, because www-data has no permissions on the local codebase folder.

For example the MySQL dockerfile: https://github.com/docker-library/mysql/blob/ed0e47e48b8ca3dbc4d68d68f56384bdd1fb5cdb/5.6/Dockerfile
They dont use the USER statement and will running as root - so they can write into the local database folder.

If i remove your USER from the dockerfile the nginx_startup script has all needed permissions and can copy/link the kimai source to the right folder. After that Kimai is running.

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

Maybe thats the best solution:
https://stackoverflow.com/questions/36781372/docker-using-gosu-vs-user
https://medium.com/better-programming/running-a-container-with-a-non-root-user-e35830d1f42a

We init all with root permissions - and entrypoint script also runs as root - then the script drops the root permissions itself with gosu

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

solved (see #35 )

from kimai2.

Schrolli91 avatar Schrolli91 commented on July 30, 2024

@tobybatch as written in the PR i have asked for a maintenance partnership - so yes we can work together, to make this better ;-)

I would very happy if my PR can be a part of this.

atm im working on a smaller image - the fpm-apline build is round about 880 Mb and i have stripped it down to <200 Mb by optimizing the Dockerfile. I take a look to improve it further.

btw maybe i have some ideas to improve the build process - in fact of build-size and -time

EDIT:
Now i'm close to 140 Mb full-build-size including the complete alpine and php-fpm stack.
The layers that are needed for the complete kimai-composer install are only round about 55 Mb

from kimai2.

Related Issues (20)

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.