<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>BundleWorks Forums - Tips &amp; Techniques</title>
        <description>Share your BundleWorks tips &amp; techniques</description>
        <link>http://www.bundleworks.com/forums/list.php?8</link>
        <lastBuildDate>Thu, 09 Sep 2010 13:33:30 -0400</lastBuildDate>
        <generator>Phorum 5.2.2-beta</generator>
        <item>
            <guid>http://www.bundleworks.com/forums/read.php?8,4,4#msg-4</guid>
            <title>Setting Up Drupal with BundleWorks (no replies)</title>
            <link>http://www.bundleworks.com/forums/read.php?8,4,4#msg-4</link>
            <description><![CDATA[ This post describes my recent experience with creating a test environment for the <a rel="nofollow"  href="http://www.drupal.org">Drupal content management platform</a> using BundleWorks. It involved some upfront work to package Drupal, but now I can very easily create independent Drupal environments for development and testing.<br />
<br />
<strong class="bbcode">Creating the Bundles</strong><br />
<br />
For my Drupal environment, I needed bundles for Apache, PHP, MySQL and for Drupal itself. For Apache and MySQL, I already had BundleWorks bundles, which were created with the <strong class="bbcode">bw bundle</strong>. For PHP, I had a bundle already created, but I needed to rebuild PHP to support the gd and mbstrings modules. So I used the loadable-source bundler to create my PHP bundle as follows:<br /><pre class="bbcode">
bw bundle loadable-source /opt/bundles none
Enter directory containing source: php-5.2.5
Enter bundle name [php]: php
Enter bundle version [5.2.5]: 5.2.5
Enter any arguments for configure: --with-mysql=/opt/bundles/mysqlserver/5.0.45/linux-ppc
   --enable-cli --enable-fastcgi --enable-force-cgi-redirect
   --with-zlib --with-gd --enable-mbstring</pre>
<br />
For the Drupal bundle, I created a custom bundle with two scripts inside the &quot;actions&quot; directory: install.sh and cron.sh. <br />
<br />
The install script sets up the Drupal 'work' directory as follows:<br />
<br />
1. Creates 'files' and 'tmp' directories for Drupal to keep each Drupal installation separate.<br />
2. Copies an Apache conf file into a 'config' directory to be included inside Apache's main httpd.conf. This conf file contains all the directives needed for Drupal, including directives for mod_fcgi used to run PHP with FastCGI.<br />
3. Copies the Drupal distribution into a 'root' directory which is referenced in the conf file using the Apache Alias and Directory commands.<br />
4. Creates an 'actions' directory with a load script that sets DRUPAL_HOST and DRUPAL_PORT used when running the Drupal cron job.<br />
<br />
The cron.sh simply calls the Drupal cron URL as follows:<br /><pre class="bbcode">
#!/bin/sh

wget -O - -q -t 1 [url]http://$DRUPAL_HOST:$DRUPAL_PORT/cron.php[/url] \
   &gt;$WORK_DIR/drupal_cron.out 2&gt;$WORK_DIR/drupal_cron.err</pre>
<br />
This cron.sh script is then called periodically from an entry in the cron table as follows:<br /><pre class="bbcode">
30 * * * * /srv/bundleworks/work/bin/bw /srv/env/cms/drupal cron</pre>
<br />
<strong class="bbcode">Deploying the Bundles</strong><br />
<br />
After adding these bundles to /opt/bundles, I used the following BundleWorks commands to create an environment and deploy all the bundles.<br />
<br /><pre class="bbcode">
bw envcreate /srv/env/cms
bw deploy /opt/bundles/mysqlserver/5.0.45 /srv/env/cms
bw deploy /opt/bundles/apache/2.2.6 /srv/env/cms
bw deploy /opt/bundles/php/5.2.5 /srv/env/cms
bw deploy /opt/bundles/drupal/5.5 /srv/env/cms</pre>
<br />
In the case of the mysqlserver and apache deployments, I was prompted to enter port numbers. By choosing unique port numbers, I can run multiple independent instances of these applications, each with their own 'work' directory.<br />
<br />
<strong class="bbcode">Running the Environment</strong><br />
<br />
Once the bundles were deployed, running Apache and MySQL was a snap:<br />
<br /><pre class="bbcode">
use cms
mysqlserver start
apache start</pre>
<br />
<strong class="bbcode">Drupal Setup</strong><br />
<br />
Setting up Drupal was straightforward at this point. I first created a Drupal table in the MySQL instance by running the 'mysql' client at the command line. I then used Drupal's setup wizard and administrative interface to configure Drupal (including setting the 'tmp' and 'files' to point into the environment). Finally I wired up the cron.sh script as shown above.<br />
<br />
I then had a completely independent instance of Drupal running on my server, as well as a way to create other Drupal environments very easily.]]></description>
            <dc:creator>rsauers</dc:creator>
            <category>Tips &amp; Techniques</category>
            <pubDate>Sat, 08 Dec 2007 06:43:05 -0500</pubDate>
        </item>
    </channel>
</rss>
