[Webapps-common-discuss] [commit] r113 - in webapps-common/trunk: debian dpkg examples/webapp-apache-dbapp-example examples/webapp-apache-dbapp-example/debian templates
seanius at alioth.debian.org
seanius at alioth.debian.org
Thu Jun 21 11:58:42 UTC 2007
Author: seanius
Date: 2007-06-21 11:58:42 +0000 (Thu, 21 Jun 2007)
New Revision: 113
Modified:
webapps-common/trunk/debian/changelog
webapps-common/trunk/dpkg/common
webapps-common/trunk/dpkg/postinst
webapps-common/trunk/examples/webapp-apache-dbapp-example/apache_template.conf
webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst
webapps-common/trunk/templates/apache-inline.conf
webapps-common/trunk/templates/apache.conf
Log:
first shot at per-instance config files
Modified: webapps-common/trunk/debian/changelog
===================================================================
--- webapps-common/trunk/debian/changelog 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/debian/changelog 2007-06-21 11:58:42 UTC (rev 113)
@@ -6,6 +6,8 @@
* take a first shot at the final obstacle for experimental, dbconfig-common
support on a per-instance basis. requires a versioned dependency on
dbconfig-common. still a little rough around the edges...
+ * related to the above, support per-instance config-file generation.
+ XXX still need to finalize document this.
* updates to the templated virtualhost configuration, including a fix
from Jan-Pascal van Best.
Modified: webapps-common/trunk/dpkg/common
===================================================================
--- webapps-common/trunk/dpkg/common 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/dpkg/common 2007-06-21 11:58:42 UTC (rev 113)
@@ -126,6 +126,7 @@
sed -e "s,_WC_WEBSITE_SUBDIRECTORY_,$dir,g" \
-e "s,_WC_WEBSITE_DOCUMENTROOT_,$wc_website_documentroot,g" \
-e "s,_WC_WEBSITE_HOSTNAME_,$site,g" \
+ -e "s,_WC_DEBIAN_SITEID_,`wc_debian_siteid $i`," \
-e "s,_WC_DOCROOT_DIRECTIVE_,$docroot_directive,g" < "$srcfile" > "$tmpconf"
output=`_wc_instance_cfg_file "$i" "$h"`
mkdir -p `dirname "$output"`
@@ -434,20 +435,23 @@
###
### map an instance name to a filename
-##
-## usage: _wc_instance_to_filename instance basedir extension
+## requires: wc_generate_include
+## wc_generate_include is in the form "mode:basedir:basename:extension"
+#
+## usage: wc_includefile_name instance
###
-_wc_instance_to_filename(){
- local instance base ext site dir
+wc_includefile_name(){
+ local instance mode based basef ext siteid
instance=$1
- base=$2
- ext=$3
+ based=`echo $wc_generate_include | cut -d: -f2`
+ based=`echo $wc_generate_include | cut -d: -f2`
+ basef=`echo $wc_generate_include | cut -d: -f3`
+ ext=`echo $wc_generate_include | cut -d: -f4`
if [ "$ext" ]; then
ext=".$ext"
fi
- site=`echo $instance | cut -d/ -f1`
- dir=`echo $instance | cut -sd/ -f2- | sed -e 's,/,%2f,g'`
- echo "$base/${wc_package}_${site}_${dir}${ext}"
+ siteid=`wc_debian_siteid $instance`
+ echo "$based/${basef}_${siteid}${ext}"
}
@@ -466,6 +470,14 @@
}
###
+### output an id unique to a specific instance
+##
+## usage: wc_debian_siteid instance
+wc_debian_siteid(){
+ echo $1 | md5sum
+}
+
+###
### output the name of where a symlink to the instance cfg file should be
##
## usage: _wc_instance_cfg_link instance httpd
Modified: webapps-common/trunk/dpkg/postinst
===================================================================
--- webapps-common/trunk/dpkg/postinst 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/dpkg/postinst 2007-06-21 11:58:42 UTC (rev 113)
@@ -56,6 +56,7 @@
}
wc_postinst_dbapp_support(){
+ local includefile
if [ "$wc_dbapp" ]; then
_wc_debug "postinst configuring database(s): "
instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true
@@ -68,6 +69,9 @@
. /usr/share/dbconfig-common/dpkg/postinst
fi
_wc_debug dbc_go $i $wc_command $wc_oldversion
+ if [ "$wc_generate_include" ]; then
+ dbc_generate_include=`wc_includefile_name $i`
+ fi
dbc_go $i $wc_command $wc_oldversion
done
fi
Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/apache_template.conf
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/apache_template.conf 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/apache_template.conf 2007-06-21 11:58:42 UTC (rev 113)
@@ -12,5 +12,8 @@
_WC_DOCROOT_DIRECTIVE_
<Directory /usr/share/webapp-apache-dbapp-example/www>
+ # the following line is required for multi-instance supporting apps.
+ # otherwise, you could omit it.
+ SetEnv X_DEBIAN_SITEID _WC_DEBIAN_SITEID_
# other stuff could be done here...
</Directory>
Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst 2007-06-21 11:58:42 UTC (rev 113)
@@ -6,7 +6,7 @@
. /usr/share/webapps-common/dpkg/postinst
wc_dbapp="yes"
wc_dbtype="mysql"
-dbc_generate_include="php:/etc/webapp-apache-dbapp-example/settings.php"
+wc_generate_include="php:/etc/webapp-apache-dbapp-example:settings-:php"
dbc_generate_include_args="-O root:www-data -m 640"
wc_go webapp-apache-dbapp-example $@
Modified: webapps-common/trunk/templates/apache-inline.conf
===================================================================
--- webapps-common/trunk/templates/apache-inline.conf 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/templates/apache-inline.conf 2007-06-21 11:58:42 UTC (rev 113)
@@ -1,7 +1,6 @@
_WC_DOCROOT_DIRECTIVE_
-SetEnvIf REQUEST_URI '^http://_WC_WEBSITE_HOSTNAME_/_WC_WEBSITE_SUBDIRECTORY_' X_DEBIAN_SITEID=_WC_WEBSITE_HOSTNAME_/_WC_WEBSITE_SUBDIRECTORY_
-
<Directory _WC_WEBSITE_DOCUMENTROOT_>
+ SetEnv X_DEBIAN_SITEID=_WC_DEBIAN_SITEID_
</Directory>
Modified: webapps-common/trunk/templates/apache.conf
===================================================================
--- webapps-common/trunk/templates/apache.conf 2007-06-19 13:42:00 UTC (rev 112)
+++ webapps-common/trunk/templates/apache.conf 2007-06-21 11:58:42 UTC (rev 113)
@@ -1,3 +1,5 @@
_WC_DOCROOT_DIRECTIVE_
-SetEnvIf REQUEST_URI '^http://_WC_WEBSITE_HOSTNAME_/_WC_WEBSITE_SUBDIRECTORY_' X_DEBIAN_SITEID=_WC_WEBSITE_HOSTNAME_/_WC_WEBSITE_SUBDIRECTORY_
+<Directory _WC_WEBSITE_DOCUMENTROOT_>
+ SetEnv X_DEBIAN_SITEID=_WC_DEBIAN_SITEID_
+</Directory>
More information about the Webapps-common-discuss
mailing list