Search code examples
perlnginxreloadfastcgicatalyst

catalyst with nginx and fastcgi reload application without downtime


One of the benefits that's always listed when comparing mod_perl vs. fastcgi, is that for mod_perl you have to completely reload the app and have downtime, but with fastcgi you can reload the app without having downtime. However, I cannot find any examples of how to do this. Is this possible to reload a Catalyst app that's being run using fastcgi without any downtime? I followed this guide to get my Catalyst app up and running. Thanks!


Solution

  • I was able to create a script that does what I want by combining this guide's script and part of the bash script found in this answer. If you put the script in /etc/init.d and then change the appropriate vars at the top, this script can be pretty useful. Calling:

    service script reload
    

    or

    /etc/init.d/script reload
    

    Allows you to have no downtime while the new code loads up. The script can be found here. You just need to download the script, change the variables at the top, do

    chmod +x script
    

    and move it into /etc/init.d, and then you're good to go! :)