paketo-buildpacks / php-web

Apache License 2.0
6 stars 7 forks source link

is it possible to reload procmgr process without restarting the container? #221

Open dmitry-mightydevops opened 2 years ago

dmitry-mightydevops commented 2 years ago

hi Guys,

So I have a docker container build with paketo PHP buildpack that runs the following command under PID 1

procmgr /layers/paketo-buildpacks_php-web/php-web/procs.yml

is it possible to reload the configs passed into procmgr somehow?

🐳  [DEV] backend-v1-7476cc6cfd-l68p2 app # 
ps aufx
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
cnb         30  1.0  0.0  18648  3444 pts/0    Ss   03:22   0:00 bash
cnb         77  0.0  0.0  34412  2944 pts/0    R+   03:22   0:00  \_ ps aufx
cnb          1  0.0  0.1 1013616 4096 ?        Ssl  03:20   0:00 procmgr /layers/paketo-buildpacks_php-web/php-web/procs.yml
cnb         24  0.0  0.7 323596 31260 ?        Ss   03:20   0:00 php-fpm: master process (/layers/paketo-buildpacks_php-web/php-web/etc/php-fpm.conf)
cnb         28  0.3  0.6 330252 24112 ?        S    03:20   0:00  \_ php-fpm: pool www
cnb         29  0.1  0.6 330016 23900 ?        S    03:20   0:00  \_ php-fpm: pool www
cnb         25  0.0  0.1  25132  5648 ?        S    03:20   0:00 nginx: master process nginx -p /workspace/app -c /workspace/app/nginx.conf
cnb         26  0.0  0.0  25132  1988 ?        S    03:20   0:00  \_ nginx: worker process
cnb         27  0.0  0.0  25132  1988 ?        S    03:20   0:00  \_ nginx: worker process

🐳  [DEV] backend-v1-7476cc6cfd-l68p2 app # 
cat /layers/paketo-buildpacks_php-web/php-web/procs.yml
processes:
  nginx:
    command: nginx
    args:
    - -p
    - /workspace/app
    - -c
    - /workspace/app/nginx.conf
  php-fpm:
    command: php-fpm
    args:
    - -p
    - /layers/paketo-buildpacks_php-web/php-web
    - -y
    - /layers/paketo-buildpacks_php-web/php-web/etc/php-fpm.conf
    - -c
    - /layers/paketo-buildpacks_php-web/php-web/etc
dmikusa commented 2 years ago

Procmgr is pretty basic it doesn't support reloading. It loads the config and fires off the sub-processes monitoring them. If one dies, it'll kill the others. There's not an option to reload the process configs and I'm not sure how that would work exactly. If you change the config, we'd pretty much have to restart all of the processes in the container to be safe.

At this point in time, you'd need to reload the container.

What are you trying to accomplish? What is the need to do this? Just trying to understand your use case. Thanks

dmitry-mightydevops commented 2 years ago

So some times I need to quickly change config files (let's say nginx or php-fpm) inside the working container. So I don't stop/start it.