Packaging solution for (php-)projects

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.

Note: .. the demo project on github seems to reference so a git submodule update won’t work – i know i could just fetch the packaging part from github, but i guess the demo was not intended to work like this.

Anyway, thanks for the contribution.

Kind regards, Chris

Thanks for the feedback, this has just been fixed!

what are the requirements, will this work only for VPSs?
is there a way perhaps to make it work for sharedhosting? probably not, but then what are the alternatives to this…

I am sure it works very nicely on VPSs


You won’t be able to install packages on a shared hosting. To install packages you need root privileges which you don’t have on shared hostings. You will have to install your application through ftp or whatever access the hoster provides.

Thanks for these useful pointers! Have you ever looked at the Open Build Project?
My company is running a local instance of it which provides packages for openSUSE, Fedor and Ubuntu.

We looked into Open Build. As far as I understood you still need to have some knowledge of the inner workings of .deb and .rpm packages in order to create packages for the corresponding architecture. But we were looking for something that doesn’t force people to have to write debian control or rpm spec files.

I have a shared hosting account with multiple users. Can i use this application for the time being and switch to a dedicated hosting server later when i feel comfortable?

Please see the fourth comment. This solution is NOT for shared hosting environments.

Thanks for this blog post and fpm reference. Finally an easy way to create a damn deb package :) Cheers!

A reliable blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that characterize a blog to be a best one.
Marijuana Seeds

The international leg usually has good movies on-demand but even then staring at a teeny screen on the back of someone else’s seat isn’t always the best so here are a few tips I have for those of you who will be taking long flights.tree service