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
These still need to be written...
Modules
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)
Make your package being compliant to the Debian policy manual § 11.5.
Install your application, chances are it ends up in /usr/share/yourapplication
Declare your relationship against the Apache2 web server. Do not depend on it unconditionally. Instead do something like:
Recommends: apache2 | other-webservers-you-want-to-support | http
Make your Apache configuration file, e.g. in your source package as debian/yourapplication.conf. It should look like this:
- Alias /yourapplication /usr/share/yourapplication
<Directory /usr/share/yourapplication>
- ..
</Directory>
- Alias /yourapplication /usr/share/yourapplication
Install the configuration file to /etc/apache2/conf-available/yourapplication.conf.
In your postinst maintainer script invoke the enconf handler on fresh installations. Do not omit the conditional unless your package dependencies guarantee apache2 is installed (it shouldn't).
- if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
- /usr/share/apache2/apache2-maintscript-helper apache2_invoke enconf yourapplication.conf
- if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
Likewise, in postrm do upon purge:
- if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
- /usr/share/apache2/apache2-maintscript-helper apache2_invoke disconf yourapplication.conf
- if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
Web Applications in a nutshell (with dh_apache2)
Make your package being compliant to the Debian policy manual § 11.5.
Install your application, chances are it ends up in /usr/share/yourapplication
Build depend on dh-apache2
Add ${misc:Recommends} to your Recommends in debian/control.
Make your Apache configuration file, e.g. in your source package as debian/yourapplication.conf. It should look like this:
- Alias /yourapplication /usr/share/yourapplication
<Directory /usr/share/yourapplication>
- ..
</Directory>
- Alias /yourapplication /usr/share/yourapplication
Add a dh_apache2 debhelper configuration file to your source package (e.g. to debian/yourpackage.apache2) with the following contents
- conf debian/yourapplication.conf optionally_other_webservers_you_support