FogBugz Leopard and Mampstack

August 6th, 2008 by Michael Pryor

Stefan from WuffWuffWare.com sent us instructions on getting FogBugz installed with Mampstack and I wanted to make sure they were available in case someone else was attempting the same:


Install BugFogz on Leopard 10.5.4 inside Bitnamis Mampstack


  • The MacOS X machine is a vanilla machine with all the current
    software updates and a single user called admin

  • WebSharing is off, so we dont interfere with the MAMPStack

  • IP-Adress for that example is 192.168.178.199

INSTALL THE MAMPSTACK FROM BITNAMI


  • Download the current MAMPStack from www.bitnami.com

  • For this documentation we use MAMPStack 1.0-beta-1

  • Install Bitname MAMPStack to /Applications/mampstack-1.0-1

  • Give MAMPStack database a root user password



The for the sake of simplicity:
sudo ln -s /Applications/mampstack-1.0-Beta-1 /Applications/mampstack

Until FogBugz has some settings for the path of PHP:
sudo mv /usr/bin/php /usr/bin/php-orig
sudo ln -s /Applications/mampstack/php/bin/php /usr/bin/php
sudo ln -s /Applications/mampstack/php/bin/pear /usr/bin/pear
sudo ln -s /Applications/mampstack/php/etc/php.ini /etc/php.ini

In /etc/php.ini change:
- Replace all mampstack-1.0-beta-1 with mampstack

In /Applications/mampstack/apache2/conf/httpd.conf change:
- Replace all mampstack-1.0-beta-1 with mampstack
- Listen 80
- ServerName localhost:80

In /Applications/mampstack/ctlscript.sh change:
- Replace all mampstack-1.0-beta-1 with mampstack

In /Applications/mampstack/apache2/scripts/ctl.sh search for 8080 and 
change the message to “httpd started”

Change into /Application/mampstack
cd /Applications/mampstack
sudo ctlscript.sh stop
sudo ctlscript.sh start apache

The apache-Daemon is started as super user, so it can bind port 80 !

In a web browser: go to http://192.168.178.199 and the BitNami Welcome 
message should be shown to you

Now we start mysql with:
cd /Applications/mampstack
./ctlscript.sh start mysql


Be aware, that the server is now only started manually: to make this 
happen at system startup and without being logged in: see below.

INSTALL FOGBUGZ

Now we continue with the installation instructions of fogbugz at:


  1. PHP requirements

    http://www.fogcreek.com/FogBugz/docs/60/topics/setup/MacSystemRequirements.html

    create that test.php file in /Applications/mampstack/apache2/htdocs

    The page http://192.168.178.199 should display the required content.

    You might have to add a php after <? to make it work)
    also the echo -r – stuff should return the required value in the shell

  2. CURL requirements
    : Curl is installed (on my machine with curl 7.16.3

  3. The MONO framework: Download it from the given web page and
    install it


FIX THE FOGBUGZ INSTALLATION

Now download FogBugz from your order. I used version 6.1.30 for Macintosh.


Try to install it.


The install will fail. Now we have to fix that following the instructions in
http://www.fogcreek.com/FogBugz/docs/60/topics/setup/MacWhatSetupDoes.html


  • Go to /Library/WebServer/fogbugz.install


    • cd /Library/WebServer/fogbugz.install

    • sudo ./install.sh and answer the questions of PEAR for installation
      with y

    • the automatic restart of apache and the changes to /etc/apache2/
      httpd.conf will fail: We have to fix that manually

    • you have to stop the web sharing with sudo apachectl stop

  • Edit /Applications/mampstack/apache2/conf/httpd.conf and add the following line:


    • Include "/opt/fogbugz/Accessories/fogbugz.conf"

  • Make fogutil.so available:


    • mkdir /Applications/mampstack/php/lib/php/extensions

    • cp /opt/fogbugz/Accessories/fogutil.php5.2-mac-dynamic.so /
      Applications/mampstack/php/lib/php/extensions/fogutil.so

  • Fix the permissions a little. In my case:


    • sudo chmod -R admin /opt/fogbugz

    • sudo chmod u+x /opt/fogbugz

    • sudo chmod -R o-wx /opt/fogbugz/Website

    • sudo chmod -R u-w /opt/fogbugz/Website

    • sudo chmod -R o-wx /opt/fogbugz/Accessories

    • sudo chmod 554 /opt/fogbugz/Accessories/fogbugzmaintd

    • sudo chmod 444 /opt/fogbugz/Accessories/fogbugzmaintd.php

    • sudo chmod 664 /opt/fogbugz/Accessories/application.data
  • And then, because I am not a unix guru, and I just want this to work:

    • sudo chmod -R a+rwx /opt/fogbugz/Website

    • sudo chmod -R a+w /opt/fogbugz/Accessories

    • sudo chmod o+x /opt/fogbugz/Accessories

  • Restart apache via: sudo /Applications/mampstack/ctlscript.sh restart apache

  • Go to a browser and open http://192.168.178.199/fogbugz/install1.php


    • If this returns an error: the systems web server is runnung you have
      to stop that via sudo apachectl stop

    • If this returns an error: “Forbidden”, then the permissions are not
      set correctly

  • Follow the instructions, which should succeed

  • Fogbugz showed me an arror with my PHP settings about:

    • max_allowed_packet

    • Add the following line in /Applications/mampstack/mysql/my.cnf after

      [mysqld]

      max_allowed_packet=50M


MAKE IT STARTING AT SYSTEM STARTUP TIME

a.) Create a file as super user at /Library/LaunchDaemons/com.bitnami-apache.service.plist


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.bitnami-apache.services</string>
        <key>LaunchOnlyOnce</key>
        <true/>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>/Applications/mampstack/apache2/scripts/ctl.sh</string>
                <string>start</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>root</string>
</dict>
</plist>

b.) Create a file as super user at /Library/LaunchDaemons/com.bitnami-mysql.service.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>KeepAlive</key>
        <true/>
        <key>Label</key>
        <string>com.bitnami-mysql.services</string>
        <key>Program</key>
        <string>/Applications/mampstack/mysql/bin/mysqld</string>
        <key>ProgramArguments</key>
        <array>
                <string>–user=admin</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>Umask</key>
        <integer>7</integer>
        <key>UserName</key>
        <string>admin</string>
        <key>WorkingDirectory</key>
        <string>/Applications/mampstack/mysql</string>
</dict>
</plist>

c.) Create a file as super user at /Library/LaunchDaemons/com.bitnami-fogbugz.service.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.bitnami-apache.services</string>
        <key>LaunchOnlyOnce</key>
        <true/>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>/Applications/mampstack/apache2/scripts/ctl.sh</string>
                <string>start</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>root</string>
</dict>
</plist>

d.) Load the files into launchd via:
sudo launchd load -w /Library/LaunchDaemons/com.bitnami-apache.service.plist
sudo launchd load -w /Library/LaunchDaemons/com.bitnami-mysql.service.plist
sudo launchd load -w /Library/LaunchDaemons/com.bitnami-fogbugzd.service.plist