Packaging Web Applications and Modules for Apache HTTPD 2.4 in Wheezy

This Wiki page is intended to give practical hands on experience how to package modules and web applications in Debian. Wheezy is supposed to ship Apache HTTP 2.4 which requires a major rework of reverse dependencies in Debian.

General instructions

Generally, instructions for packaging modules and are documented in the PACKAGING file included within the apache2 binary package. The latest revision is also available in our version control system under

http://anonscm.debian.org/gitweb/?p=pkg-apache/apache2.git;a=blob;f=debian/PACKAGING;hb=next

Please refer there for the reference documentation. This Wiki page is meant as a practical hands-on tutorial extended by some more explanations. It does not replace the packaging hints.

Upgrading notes

Maintainer scripts

Aside of changed dependencies, the biggest change involves maintainer scripts. We intend to consolidate behavior of maintainer scripts, to make it predictable and configurable how modules and web applications behave after the installation.

To achieve this, you should not decide yourself when and if to enable a given piece of configuration or whether or not to restart the web server after installation of your configuration snippet. Likewise, do not decide yourself whether or not to enable a particular module you install in your package.

Instead, call our helper scripts which will behave in a predictable and configurable behavior. In the end, we want to let the site administrator to decide how modules and web applications should behave. Thus, see our documentation how to use apache2-maintscript-helper.

Packaging Modules and Web Applications

Below you find some simple tutorials to get started to build packages which shall depend on apache2 in one or another way.

Modules

Modules should really use dh_apache2 to get things right. It makes packaging Apache2 modules easy, otherwise you need to be especially careful to get dependencies right. Take special care not to depend' on apache2 or apache2-bin. Your module binary package must depend on the virtual API version package we provide instead. In a nutshell, this is how to create a module package:

Web applications

If you are upgrading your package from Squeeze you probably need to move your configuration files from /etc/apache2/conf.d/yourpackage to /etc/apache2/conf-available/yourpackage.conf. You can use dpkg-maintscript-helper(1) to move configuration files properly. It supports a mv_conffile function you can call. If you are using debhelper, consult dh_installdeb(1) how to automate interaction with dpkg-maintscript-helper.

You can, but you don't need to install your configuration files yourself. It is suggested to use dh_apache2 instead by build-depending on dh-apache2. Don't worry if this pulls apache2-dev for now, dh_apache2 should be shipped within the regular debhelper at some point if everything goes well.

Do not interact with Apache wrapper scripts in your maintainer scripts directly. It can be complex and complicated to decide when to enable a particular piece of configuration. You should use apache2-maintscript-helper instead. Doing that you do not need to worry whether and when to enable a given configuration. If you are using dh_apache2 it does the job for you. Be careful when writing your own maintainer scripts, web applications generally should not depend unconditionally on apache2. Thus, neither our maintscript-helper nor our a2enmod and friends tool will be available at runtime.

Web Applications in a nutshell (without dh_apache2)

Web Applications in a nutshell (with dh_apache2)

Changes to modules' source code

Some hints are available at http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html . Even if your module compiles and works without changes, you should at least add the APLOG_USE_MODULE statement described in that page to take advantage of per-module loglevel configuration.