]> git.mjollnir.org Git - vserverctl.git/commitdiff
stuff profile
authorPenny Leach <penny@catalyst.net.nz>
Tue, 15 Apr 2008 02:54:59 +0000 (14:54 +1200)
committerPenny Leach <penny@catalyst.net.nz>
Tue, 15 Apr 2008 02:54:59 +0000 (14:54 +1200)
12 files changed:
profile/stuff/README [new file with mode: 0644]
profile/stuff/aptsources [new file with mode: 0644]
profile/stuff/data/tnsnames.ora [new file with mode: 0644]
profile/stuff/packages [new file with mode: 0644]
profile/stuff/post-host [new file with mode: 0644]
profile/stuff/post-vserver [new file with mode: 0644]
profile/stuff/pre-host [new file with mode: 0644]
profile/stuff/pre-vserver [new file with mode: 0644]
profile/stuff/profile.conf [new file with mode: 0644]
profile/stuff/remove-host [new file with mode: 0644]
profile/stuff/templates [new file with mode: 0644]
profile/stuff/vservers.template.conf [new file with mode: 0644]

diff --git a/profile/stuff/README b/profile/stuff/README
new file mode 100644 (file)
index 0000000..af8819b
--- /dev/null
@@ -0,0 +1,3 @@
+after vserver is built
+- add 000_default.conf in /etc/apache-perl/conf.d to use NameVirtualHost *
+- add virtualhost ServerAliases to nzx & stuff configfiles.
diff --git a/profile/stuff/aptsources b/profile/stuff/aptsources
new file mode 100644 (file)
index 0000000..fb26475
--- /dev/null
@@ -0,0 +1,3 @@
+
+# Fairfax stuff
+deb http://apt.stuffnet.catalyst.net.nz nzx-testing all
diff --git a/profile/stuff/data/tnsnames.ora b/profile/stuff/data/tnsnames.ora
new file mode 100644 (file)
index 0000000..e2333f4
--- /dev/null
@@ -0,0 +1,36 @@
+STUFFDEV =
+ (DESCRIPTION =
+   (ADDRESS_LIST =
+     (ADDRESS = (PROTOCOL = TCP)(HOST = scooter.stuffnet.catalyst.net.nz)(PORT = 1521)) )
+   (CONNECT_DATA =  (SERVICE_NAME = inldev))
+)
+
+STUFFTEST =
+ (DESCRIPTION =
+   (ADDRESS_LIST =
+     (ADDRESS = (PROTOCOL = TCP)(HOST = scooter.stuffnet.catalyst.net.nz)(PORT = 1521)) )
+   (CONNECT_DATA =  (SERVICE_NAME = inltest))
+)
+
+maxine =
+ (DESCRIPTION =
+   (ADDRESS_LIST =
+     (ADDRESS = (PROTOCOL = TCP) (HOST = puppis.wgtn.cat-it.co.nz) (PORT = 1521)) )
+   (CONNECT_DATA =  (SERVICE_NAME = maxine))
+)
+
+kayla =
+ (DESCRIPTION =
+   (ADDRESS_LIST =
+     (ADDRESS = (PROTOCOL = TCP)(HOST = scooter.stuffnet.catalyst.net.nz)(PORT = 1521)) )
+   (CONNECT_DATA =  (SERVICE_NAME = kayla))
+)
+
+sj =
+ (DESCRIPTION =
+   (ADDRESS_LIST =
+     (ADDRESS = (PROTOCOL = TCP)(HOST = puppis.wgtn.cat-it.co.nz)(PORT = 1521)) )
+   (CONNECT_DATA =  (SERVICE_NAME = sj))
+)
+
+
diff --git a/profile/stuff/packages b/profile/stuff/packages
new file mode 100644 (file)
index 0000000..022a664
--- /dev/null
@@ -0,0 +1,3 @@
+stuff-nzx
+stuff-admin
+libcache-memcached-perl
diff --git a/profile/stuff/post-host b/profile/stuff/post-host
new file mode 100644 (file)
index 0000000..07f50f2
--- /dev/null
@@ -0,0 +1,5 @@
+# Add Apache Host Config
+[ -d /etc/apache2/vservers ] || mkdir -p /etc/apache2/vservers
+# Note: HOSTNAME is used here instead of HOST because HOST is templated by vserverctl
+cat /vserver/.profile/webserver/vservers.template.conf | sed "s/__IPADDR__/${VSIPADDR}/" | sed "s/__NAME__/${VSNAME}/" | sed "s/__HOSTNAME__/`hostname`/" | sed "s/__PROFILEOPTION_username__/${PROFILEOPTION_username}/" > /etc/apache2/vservers/${VSNAME}.conf
+apache2ctl graceful
diff --git a/profile/stuff/post-vserver b/profile/stuff/post-vserver
new file mode 100644 (file)
index 0000000..8294475
--- /dev/null
@@ -0,0 +1,11 @@
+echo 'NameVirtualHost *' > /etc/apache-perl/conf.d/000_default
+
+sed -i '2aServerAlias nzx.stuff.mickey.wgtn.cat-it.co.nz\n' /etc/apache-perl/conf.d/35-nzx.conf
+sed -i '2aServerAlias admin.stuff.mickey.wgtn.cat-it.co.nz\n' /etc/apache-perl/conf.d/25-admin.conf
+
+cat /etc/apache-perl/conf.d/35-nzx.conf | sed 's/nzx/bd/g' > /etc/apache-perl/conf.d/45-bd.conf
+
+apache-perlctl restart
+
+
+
diff --git a/profile/stuff/pre-host b/profile/stuff/pre-host
new file mode 100644 (file)
index 0000000..0d0441f
--- /dev/null
@@ -0,0 +1,39 @@
+mkdir /etc/vservers/${VSNAME}/scripts -p
+mkdir /vserver/${VSNAME}/data -p
+
+echo '/home' > /etc/vservers/${VSNAME}/namespace-cleanup-skip
+
+if [ -d /home/${PROFILEOPTION_username}/src/nzx/ ]; then
+    cat >/etc/vservers/${VSNAME}/scripts/pre-start << EOF
+    #!/bin/bash
+    mkdir -p /vserver/${VSNAME}/usr/share/stuff-nzx/htdocs
+    mkdir -p /vserver/${VSNAME}/usr/share/stuff-bd/htdocs
+    mkdir -p /vserver/${VSNAME}/usr/share/stuff-admin/htdocs
+    mkdir -p /vserver/${VSNAME}/usr/share/perl5/NZX
+    mkdir -p /vserver/${VSNAME}/usr/share/perl5/StuffNews
+    mkdir -p /vserver/${VSNAME}/usr/share/perl5/Stuff
+
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/nzx /vserver/${VSNAME}/usr/share/stuff-nzx/htdocs
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/business-day /vserver/${VSNAME}/usr/share/stuff-bd/htdocs
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/admin /vserver/${VSNAME}/usr/share/stuff-admin/htdocs
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/lib/NZX /vserver/${VSNAME}/usr/share/perl5/NZX
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/lib/Stuff /vserver/${VSNAME}/usr/share/perl5/Stuff
+    mount --bind /home/${PROFILEOPTION_username}/src/nzx/lib/StuffNews /vserver/${VSNAME}/usr/share/perl5/StuffNews
+
+EOF
+    chmod 755 /etc/vservers/${VSNAME}/scripts/pre-start
+
+    cat >/etc/vservers/${VSNAME}/scripts/post-stop << EOF
+    #!/bin/bash
+
+    umount /vserver/${VSNAME}/usr/share/stuff-nzx/htdocs
+    umount /vserver/${VSNAME}/usr/share/stuff-bd/htdocs
+    umount /vserver/${VSNAME}/usr/share/stuff-admin/htdocs
+    umount /vserver/${VSNAME}/usr/share/perl5/NZX
+    umount /vserver/${VSNAME}/usr/share/perl5/Stuff
+    umount /vserver/${VSNAME}/usr/share/perl5/StuffNews
+
+EOF
+    chmod 755 /etc/vservers/${VSNAME}/scripts/post-stop
+
+fi
diff --git a/profile/stuff/pre-vserver b/profile/stuff/pre-vserver
new file mode 100644 (file)
index 0000000..d47d3e9
--- /dev/null
@@ -0,0 +1 @@
+echo 'stuff-config    stuff-config/server_mode        select  preview' |  debconf-set-selections
diff --git a/profile/stuff/profile.conf b/profile/stuff/profile.conf
new file mode 100644 (file)
index 0000000..05caf3f
--- /dev/null
@@ -0,0 +1 @@
+parent               = base
diff --git a/profile/stuff/remove-host b/profile/stuff/remove-host
new file mode 100644 (file)
index 0000000..de3310b
--- /dev/null
@@ -0,0 +1,3 @@
+# Remove Host Apache Conf
+rm -f /etc/apache2/vservers/${VSNAME}.conf
+apache2ctl graceful
diff --git a/profile/stuff/templates b/profile/stuff/templates
new file mode 100644 (file)
index 0000000..1f3b680
--- /dev/null
@@ -0,0 +1 @@
+tnsnames.ora     /etc/
diff --git a/profile/stuff/vservers.template.conf b/profile/stuff/vservers.template.conf
new file mode 100644 (file)
index 0000000..3069f00
--- /dev/null
@@ -0,0 +1,28 @@
+<VirtualHost *:80>
+    ServerAdmin __PROFILEOPTION_username__@catalyst.net.nz
+    ServerName  __NAME__.__HOSTNAME__.wgtn.cat-it.co.nz
+    ServerAlias *.__NAME__.__HOSTNAME__.wgtn.cat-it.co.nz
+
+    LogLevel warn
+    ErrorLog /var/log/apache2/vserver.__NAME__.error.log
+    CustomLog /var/log/apache2/vserver.__NAME__.access.log combined
+
+    ServerSignature On
+
+    <Proxy>
+        Order allow,deny
+        Allow from all
+    </Proxy>
+
+    ProxyPreserveHost On
+    ProxyPass / http://__IPADDR__/
+</VirtualHost>
+<VirtualHost *:80>
+    ServerName __NAME__.__HOSTNAME__
+    ServerAlias *.__NAME__.__HOSTNAME__
+
+    RewriteEngine On
+
+    RewriteCond   %{HTTP_HOST} ^(.*)__NAME__.__HOSTNAME__$
+    RewriteRule   ^(.*)$       http://%1__NAME__.__HOSTNAME__.wgtn.cat-it.co.nz$1 [L,R=301]
+</VirtualHost>