I was wondering if apt-get/dpkg packages (.deb's) manage downtime at all when updating?

For example, when updating nginx (assuming it's already installed) via sudo apt-get install nginx, it looks to me like there isn't any downtime.

If that's true, I want to transfer this ability to deploying a PHP application via deb files. I'd normally do a Capistrano-style deployment (build the site, get it onto a web server, and swap the old code with the new code via symlinks).

If instead I install my built application with a .deb package, should I also use a symlinking strategy to minimize downtime or will this install/update the package in a way that already minimizes this?

Assume the .deb package is just replacing code files and then calling a post-install script to reload the application gateway (php-fpm, gunicorn, unicorn, phusion, whatever the app gateway happens to be).


Debian packages don't specifically "manage" downtime. In general, packages will either:

  • Stop the service before unpacking the new version of the package, then start it again after the unpacking; or
  • Trigger a stop/start (or restart) cycle after the new version of the package has been unpacked.

Which one they choose is a function of many things, including how long since the package maintainer scripts were written or reviewed, whether the package provides other anciliary files which, if an older version of the program read newer files, would chuck a wobbly (dynamically-loadable modules, changed file formats, and what-have-you), and whether the package maintainer knows what they're doing.

All of this, though, is largely irrelevant in your situation, because you're the one writing the maintainer scripts, since it's your package, so you can do it in whichever way you see fit. However, there is no strategy that involves restarting a service (as opposed to triggering some sort of graceful reload) which isn't going to have some period of time in which the service is unavailable. The correct solution in this situation is to have some sort of redundancy available, whether that's two separate machines (which you update one at a time), or two separate copies of the service running in a single machine (which, again, you update one at a time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.