At Liip we have been relying on Debian and RedHat packages to deploy our web applications for some time now. For this we created or in some cases adapted some project/framework-specific solutions:
The existing solutions work very well but they're also very specific. Since we don't really want to reinvent the wheel for every new project/framework we decided to start looking for a more generic solution. The prerequisite was that it had to support Debian and Red Hat packages.
With fpm, by Jordan Sissel, we found a solution that can create either Debian or Red Hat packages. Basically, fpm just takes all the files inside a directory and creates a package from that.
Since the layout of the application in a development environment is usually different from the production system (on a dev environment you might have the project files in your home directory whereas in the production environment they should end up in /var/www/projectname) there was still some work involved beside running fpm. But we wanted something that was automated as much as possible: developers should only need to setup packaging once and after that they would only have to execute a simple command to build packages.
For this reason we decided to build a set of wrapper scripts around fpm. With these scripts, you just need to create a configuration file that defines the layout on the target system and some package parameters. Once you created the configuration file, a simple command creates a Makefile for you. After that, building your package is as easy as typing “make” in your project directory. What is really nice with this packaging solution it's that it's a) easy to use and b) platform-independent (for Debian packages at least) since you can use fpm on any platform you want.
We made the scripts available on github so other people can benefit from them. To help people get into it and demonstrate some of the possibilities of this solution, we created a demo project that you can try to package and deploy. If you just want to build Debian packages you can just install fpm and you should be good to go (it even works on OS X, so you don't need a Debian machine to create packages). For rpm packages you unfortunately still need rpmbuild.