How do you deploy a PSGI script in Apache without restarting?

I want to deploy PSGI scripts that run on Apache2 using Plack. Apache is configured for:

<Location "/mypath">
  SetHandler perl-script
  PerlResponseHandler Plack::Handler::Apache2
  PerlSetVar psgi_app  /path/to/my/script.psgi
</Location>

When I test the script with plackup, the parameter --reloadkeeps track of updates in the file .psgi. In a production environment, it is good that Apache and Plack do not check and do not restart each change for performance reasons, but how can I explicitly tell them to restart Plack::Handler::Apache2and / or PSGI script to deploy the new version?

It seems that Plack regularly checks for some changes, but I don't know when. In addition, multiple instances are created, so sometimes I get different versions script.psgiwhen on /mypath. It would be useful to manually clear the perl response handler without having to restart Apache or wait for an unknown time.

+3
source share
3 answers

Short answer: you cannot. Therefore, we recommend that you use plackup (with -r) for rapid development and use Apache for deployment only (for use in production).

- apache, MaxRequestsPerChild , , . , , , httpd, , ( , ).

+6
+1

appache, .

FastCgiExternalServer /virtual/filename/fcgi -socket /path/to/my/socket

plackup -s FCGI --listen /path/to/my/socket --nproc 10 /path/to/my/script.psgi

, apache.

pid fcgi (-pid $pid_file) .

There is also a module that allows you to manage (start, stop, restart) all your fcgi pools: https://metacpan.org/pod/FCGI::Engine::Manager::Server::Plackup (not verified)

+1
source

All Articles