Git Product home page Git Product logo

Comments (2)

davidalger avatar davidalger commented on May 26, 2024

Dug into this a little bit more. This is due to running the container as www-data user and the pkg install owning/grouping a bunch of things with default php-fpm user, which normally if container was executed as root, would work. Notice the difference when the container is run as root: the php-fpm workers are running as php-fpm user vs www-data user. That would be good in production, but not in a local dev environment. :)

davidalger:04:04 PM:~$ docker run --rm -d --name test-01 davidalger/warden:mage2-fpm-7.2
77e5a0cb324dfada7e3bb519ca9496480b85875c05ee7ce6b88bb08042a35a43
davidalger:04:05 PM:~$ docker exec -it test-01 bash
www-data@77e5a0cb324d:10:05 PM:/var/www/html$ grep 'group = ' /etc/php-fpm.d/www.conf 
group = php-fpm
;listen.group = root
www-data@77e5a0cb324d:10:05 PM:/var/www/html$ ps uax
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data     1  0.3  0.1 832776 35292 ?        Ss   22:05   0:00 php-fpm: master process (/etc/php-fpm.conf)
www-data    14  0.0  0.0 832776  7636 ?        S    22:05   0:00 php-fpm: pool www
www-data    15  0.0  0.0 832776  7636 ?        S    22:05   0:00 php-fpm: pool www
www-data    16  0.0  0.0 832776  7636 ?        S    22:05   0:00 php-fpm: pool www
www-data    17  0.0  0.0 832776  7640 ?        S    22:05   0:00 php-fpm: pool www
www-data    18  0.0  0.0 832776  7640 ?        S    22:05   0:00 php-fpm: pool www
www-data    19  0.3  0.0  12764  4000 pts/0    Ss   22:05   0:00 bash
www-data    44  0.0  0.0  51752  3416 pts/0    R+   22:05   0:00 ps uax
www-data@77e5a0cb324d:10:05 PM:/var/www/html$ sudo -i
root@77e5a0cb324d:10:05 PM:~# ls -lhd /var/lib/php/fpm/*
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/opcache
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/session
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/wsdlcache
root@77e5a0cb324d:10:05 PM:~# logout
www-data@77e5a0cb324d:10:05 PM:/var/www/html$ exit
davidalger:04:05 PM:~$ docker kill test-01
test-01
davidalger:04:05 PM:~$ docker run --rm -d --name test-01 --user root  davidalger/warden:mage2-fpm-7.2
c3a0cab469f4019df8ef5567f8c3c2473da0b736595620e24d197039dcf79652
davidalger:04:06 PM:~$ docker exec -it test-01 bash
root@c3a0cab469f4:10:06 PM:/var/www/html# ls -lhd /var/lib/php/fpm/*
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/opcache
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/session
drwxrwx--- 2 root php-fpm 4.0K Oct 24 19:58 /var/lib/php/fpm/wsdlcache
root@c3a0cab469f4:10:06 PM:/var/www/html# ps uax
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.4  0.1 832776 35444 ?        Ss   22:06   0:00 php-fpm: master process (/etc/php-fpm.conf)
php-fpm     13  0.0  0.0 832776 12728 ?        S    22:06   0:00 php-fpm: pool www
php-fpm     14  0.0  0.0 832776 12728 ?        S    22:06   0:00 php-fpm: pool www
php-fpm     15  0.0  0.0 832776 12728 ?        S    22:06   0:00 php-fpm: pool www
php-fpm     16  0.0  0.0 832776 12732 ?        S    22:06   0:00 php-fpm: pool www
php-fpm     17  0.0  0.0 832776 12736 ?        S    22:06   0:00 php-fpm: pool www
root        18  0.5  0.0  12880  4032 pts/0    Ss   22:06   0:00 bash
root        41  0.0  0.0  51752  3480 pts/0    R+   22:06   0:00 ps uax
root@c3a0cab469f4:10:06 PM:/var/www/html# exit

Going to work on a couple updates to the startup script in the base fpm image to own/group any files owned/grouped as php-fpm to the user container is started as if the user is not root.

from warden.

davidalger avatar davidalger commented on May 26, 2024

File based sessions should now work as expected. The resolution here was to remove setup of www-data from base (generic) fpm images (making them more portable as a base really, and usable on production setups in the future) and move that into the Warden specific fpm images. Once I did that, fixing this was as simple and as complicated as resolving the owner/group on files in /var/log and /var/lib which need to be owned/grouped by the user which php-fpm workers run under.

Big thank you to @martinssu, @adexandros, and @vbuck for bringing this issue to my attention. I've tested this on a local fresh install of Magento 2.3.3, but let me know if you guys see this again (although I would still recommend using redis sessions as a matter of std practice, even on local).

To fix the issue on local environments, simply run the following command to pull updated images and recreate affected containers:

warden env pull && warden env up -d && warden sync start

from warden.

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.