Howto Packaging EzWeb
Introduction
Creating the Package
Remove any .pyc file from source directory
$ rm -f $(find ezweb-platform_20080125 -name "*.pyc")
Create the package data layout
$ mkdir -p debian/usr/share/ezweb-platform $ mkdir -p debian/etc/ezweb-platform $ mkdir -p debian/etc/apache2/sites-available $ mkdir -p debian/etc/apache2/sites-enabled $ mkdir -p debian/var/lib/ezweb-platform $ mkdir -p debian/DEBIAN
Move the package contents
$ cp -r ezweb-platform_20080125/* debian/usr/share/ezweb-platform/
Edit the control file
$ vim debian/DEBIAN/control
Control file contents should look like
Package: ezweb-platform Version: 20080125 Section: web Priority: optional Architecture: all Depends: python (>= 2.4), apache2 (>= 2.0), libapache2-mod-python, python-xml, python-django (>>0.96), python-pysqlite2 Maintainer: Alvaro Polo Valdenebro <apv@tid.es> Description: EzWeb Platform This package provides the EzWeb Platform, the Telefonica I+D Mashup Engine
Edit the Apache 2 virtual host config file
$ vim debian/etc/apache2/sites-available/ezweb-platform
Apache 2 config file should look like this
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /usr/share/ezweb
ErrorLog /var/log/apache2/ezweb-error.log
LogLevel warn
CustomLog /var/log/apache2/ezweb-access.log combined
ServerSignature On
<Location />
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE settings
PythonPath "['/usr/share/ezweb'] + sys.path"
</Location>
<Location /media>
SetHandler None
</Location>
</VirtualHost>
Edit the post-installation script
$ vim debian/DEBIAN/postinst
Post-installation script should look like
#!/bin/sh
###
# Set the correct file owner
#
chown -R root:root /usr/share/ezweb-platform
chown root:root /etc/apache2/sites-available/ezweb-platform
###
# Create a link to settings in /etc
#
ln -s /usr/share/ezweb-platform/settings.py /etc/ezweb-platform/settings.py
###
# Set the correct hostname for virtual host
#
while true; do
echo -n "Please, select a host name for your EzWeb site: "
read hostname
if [ -z $hostname ] ; then
echo "Invalid hostname, please try again."
else
break
fi
done
cat /etc/apache2/sites-available/ezweb-platform | sed s/localhost/$hostname/g > /tmp/ezweb-postinst
mv /tmp/ezweb-postinst /etc/apache2/sites-available/ezweb-platform
ln -s /etc/apache2/sites-available/ezweb-platform /etc/apache2/sites-enabled/010-ezweb-platform
###
# Initialize the database
#
mkdir -p /var/lib/ezweb-platform
cd /usr/share/ezweb-platform
python manage.py syncdb
chown -R www-data:www-data /var/lib/ezweb-platform
###
# Restart apache 2 web server
###
/etc/init.d/apache2 restart
Create the package
$ dpkg-deb --build debian ezweb-platform_20080125.deb
Attachments
- ezweb-platform_20080125.deb (0.9 MB) -
Basic deb package
, added by apoloval on 01/28/08 17:41:58. - python-django_0.97~svn6996-1_all.deb (2.3 MB) -
Django 0.97svn
, added by apoloval on 01/28/08 17:42:36. - python-support_0.7.6_all.deb (26.0 kB) -
Python support package (needed by python-django_0.97svn)
, added by apoloval on 01/28/08 17:44:27. - create-deb.sh (1.0 kB) -
Simple script to create the debian package
, added by apoloval on 01/28/08 17:47:24. - apache-vhost (0.5 kB) -
Simple apache 2 virtual host config file
, added by apoloval on 01/28/08 17:47:42. - debian-control (365 bytes) -
Simple debian control file
, added by apoloval on 01/28/08 17:48:00. - debian-postinst (1.0 kB) -
Simple debian post-installation script
, added by apoloval on 01/28/08 17:48:17.
