Joyent

Translations of this page:

Installing FogBugz 6.1 on a Joyent Accelerator

This was tested on a pristine pkgsrc 2GB accelerator. (If you're on the old blastwave accelerators, check previous versions of this page)

I assume you're running everything as root, so sudo now if you must.

Up your limits for FogBugz is hungry

You'll need to up some limits in your php.ini and my.cnf.

Edit /opt/local/etc/php.ini, change allow_call_time_pass_reference to On and change the value for memory_limit to 256MB.1)

Also, edit /opt/local/etc/my.cnf and change max_allowed_packet to 50M under both [mysqld] and [mysqldump].

Or, have perl do it for you:

# perl -i -pe 's/(allow_call_time_pass_reference = ).+/${1}On/' /opt/local/etc/php.ini# perl # perl -i -pe 's/(memory_limit = )\w+/${1}256M/' /opt/local/etc/php.ini
-i -pe 's/(max_allowed_packet = )\w+/${1}50MB/' /opt/local/etc/my.cnf 

Then restart apache and mysql

# svcadm restart mysql
# svcadm restart apache

Checking requirements

Check the requirements mentioned in the FogBugz docs.

eAccelerator and php imap are already installed, but commented out in php.ini. So edit it and uncomment the following lines by removing the semicolon.

;extension=eaccelerator.so
;extension=imap.so

Or, perl away:

# perl -i -pe 's/^;(extension=(eaccelerator|imap)\.so)/$1/' /opt/local/etc/php.ini

With that, you should be all set. Here are some commands to make sure, and their output for my accelerator.

$ php --version | head -n1
PHP 5.2.6 (cli) (built: Aug  5 2008 17:17:13) 

$ php -m | egrep '^(xml|iconv|imap|mysql|eAccelerator)$' | xargs echo
eAccelerator iconv imap mysql xml eAccelerator

$ pear version 2>&1 | head -n1
PEAR Version: 1.7.2

$ mysqladmin version | grep Server
Server version          5.0.67

$ curl --version | head -n1
curl 7.18.0 (i386-sun-solaris2) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3 libidn/1.8

Oh, wait, there's one more thing.

Installing mono

Compiling mono on the blastwave accelerators involved a lot of obscure exoterica. Thankfully it's now available on joyent's pkgsrc repository, so all you need to do is run this:

# pkg_add http://pkgsrc.joyent.com/2008Q2/All/mono-1.9.1nb4.tgz

Now we must let Apache find mono for all FogBugz diagnostics to pass:

# svccfg -s network/http:apache setenv -m start PATH \
"/opt/local/bin:/opt/local/sbin:/usr/xpg4/bin:/usr/bin:\
/usr/sbin:/usr/sfw/bin:/usr/openwin/bin:/opt/SUNWspro/bin:/usr/ccs/bin"
# svcadm refresh apache
# svcadm restart apache

Now you're all set:

$ mono --version | head -n1
Mono JIT compiler version 1.9.1 (tarball)

Installing FogBugz

Download FogBugz from FogCreek and upload it to your server. You could use scp for that. On your local machine run:

$ scp fogbugz-setup-php-6.1.38.tar.gz your-accelerator-host:

Then in your accelerator:2)

$ tar zxf fogbugz-setup-php-6.1.38.tar.gz
$ cd fogbugz/

Now, before we can run FogBugz's install.sh, we need to customize it. First off, there's something weird with the sh in my accelerator that it will not recognize some things in the script. So we'll just use bash. Edit the shebang line to be:

#!/opt/local/bin/bash

Then we'll need to change some variables.

You may want to customize the HOSTNAME variable to be the domain you'll use to access FogBugz, which might differ from the machine's hostname if you're using virtual hosts. You may also want to modify INSTALL_DIR, but I suggest you just leave it as is.

More importantly, You need to change USE_APACHE2 that to 1:

USE_APACHE2=1

Then there are a handful of findFile calls. You'll need to add your paths to these lists, because they won't know where stuff is in your accelerator. So, look for

findFile "/opt/local/apache2/conf/httpd.conf ..."

And prepend the list with your apache conf path. You'll need to do the same for apachectl:

findFile "/opt/local/etc/httpd/httpd.conf ..."
findFile "/opt/local/sbin/apachectl ..."

Lastly, the installer will fail to properly generate the filename for the solaris fogutil.so. We'll give it a little help with a more powerful regular expression to go over the output of uname -m.

Change the line

MACHINE="-`uname -m | sed -e 's:i.86:i686:'`"

to

MACHINE="-`uname -m | perl -pe 's:i.?86(pc)?:i686:'`"

Here's a bit of perl magic that'll do it all for you:

$ perl -i -pe 's|#!/bin/sh|#!/opt/local/bin/bash|' install.sh
$ perl -i -pe 's|USE_APACHE2=0|USE_APACHE2=1|' install.sh
$ perl -i -pe 's|(findFile ")(.*?httpd\.conf)|$1/opt/local/etc/httpd/httpd.conf $2|' install.sh
$ perl -i -pe 's|(findFile ")(.*?apachectl)|$1/opt/local/sbin/apachectl $2|' install.sh
$ perl -i -pe "s|sed -e 's:i.86:i686:|perl -pe 's:i.?86(pc)?:i686:|" install.sh

Now you can run install.sh.

# ./install.sh

It'll ask to install a handful of PEAR modules. Just say yes every time.

The installer will also ask to update your php.ini and httpd.conf. You can let it do it. Here's what it'll append to the files:

httpd.conf:

# Automatically added by FogBugz
Include "/opt/fogbugz/Accessories/fogbugz.conf"

php.ini:

; Automatically added by FogBugz
extension=fogutil.so
error_reporting = E_ALL & ~E_NOTICE
display_errors = Off
memory_limit = 256M

Once you're done, you can visit:

http://ACCELERATOR_IP_ADDRESS/fogbugz/install1.php

Follow the steps on the screen. It'll ask for credentials to and create a MySQL database, then it'll ask for your licenses. Finally, it'll have you configure SMTP. That should get you running, except for a couple of things:

Being reboot-safe and avoiding funny errors

FogBugz keeps two programs running on the server, the search and the maintenance daemons.

The installer put scripts in your rc directories to have them started at the appropriate times and all that. But… they won't work. So the cool Solaris thing to do is to remove them, and have the SMF handle it all for you instead. Let's start by removing them:

# rm /etc/init.d/fogbugzmaintd
# rm /etc/rc*.d/*fogbugz*

We'll keep /etc/init.d/fogbugz-search around because we'll use it in the search manifest.

Again, we'll need to change its shebang:

# perl -i -pe 's|#!/bin/sh|#!/opt/local/bin/bash|' /etc/init.d/fogbugz-search

Then we'll create and import the manifests. Copy and paste the XML code that follows into files called maintenance.xml and search.xml. You could do that with cat. After you're done pasting, press ctrl+D.

$ cat > maintenance.xml
... paste stuff
^D
$ cat > search.xml
... paste stuff
^D

maintenance.xml

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/fogbugz/maintenance' type='service' version='0'>
    <create_default_instance enabled='true'/>
    <single_instance/>
    <dependency name='fs' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <dependency name='net' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/network/loopback'/>
    </dependency>
    <dependent name='fogbugzmaintd_multi-user' restart_on='none' grouping='optional_all'>
      <service_fmri value='svc:/milestone/multi-user'/>
    </dependent>
    <exec_method name='start' type='method' exec='nohup php -d max_execution_time=0 -d allow_call_time_pass_reference=Yes ./fogbugzmaintd.php &gt;/dev/null &amp;' timeout_seconds='60'>
      <method_context working_directory='/opt/fogbugz/Accessories'>
        <method_credential user='root' group='root'/>
        <method_environment>
          <envvar name='PATH' value='/opt/local/bin:/opt/local/sbin:/usr/xpg4/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/openwin/bin:/opt/SUNWspro/bin:/usr/ccs/bin'/>
        </method_environment>
      </method_context>
    </exec_method>
    <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
      <method_context/>
    </exec_method>
    <template>
      <common_name>
        <loctext xml:lang='C'>FogBugz maintenance daemon</loctext>
      </common_name>
    </template>
  </service>
</service_bundle>
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='application/fogbugz/search' type='service' version='0'>
    <create_default_instance enabled='true'/>
    <single_instance/>
    <dependency name='fs' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <dependency name='net' grouping='require_all' restart_on='none' type='service'>
      <service_fmri value='svc:/network/loopback'/>
    </dependency>
    <dependent name='fogbugzsearch_multi-user' restart_on='none' grouping='optional_all'>
      <service_fmri value='svc:/milestone/multi-user'/>
    </dependent>
    <exec_method name='start' type='method' exec='/etc/init.d/fogbugz-search start' timeout_seconds='60'>
      <method_context working_directory='/opt/fogbugz/Accessories'>
        <method_credential user='root' group='root'/>
        <method_environment>
          <envvar name='PATH' value='/opt/local/bin:/opt/local/sbin:/usr/xpg4/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/openwin/bin:/opt/SUNWspro/bin:/usr/ccs/bin'/>
        </method_environment>
      </method_context>
    </exec_method>
    <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'>
      <method_context/>
    </exec_method>
    <template>
      <common_name>
        <loctext xml:lang='C'>FogBugz search</loctext>
      </common_name>
    </template>
  </service>
</service_bundle>

Now, import the files into the SMF. When you reboot, they'll start the daemons for you.

# svccfg import maintenance.xml
# svccfg import search.xml

In fact, you should reboot now to make sure everything is running. Use your favorite tools: svcs -vx and ps -ef | grep fog to make sure everything is there.

You might also want to run the diagnostics via your FogBugz web interface.

Help

FogCreek's customer service is superb.

If you, however, have questions about this specific guide, I opened a thread in the forums: http://discuss.joyent.com/viewtopic.php?pid=177397#p177397

Thanks

Many thanks for the countless hours the FogCreek customer support spent with me on the phone and via ssh to sort all the issues I ran into during my first installation.

Thanks to Joyent too for providing a second accelerator where I could practice these install steps and document them.

1) FogBugz will later set this anyway, but some PEAR installations might fail with the default value
2) you could probably curl/wget directly from the server, but since the code is behind some confusing urls, you might prefer to just do it like mere mortals do
 
accelerators/kb/install-fogbugz.txt · Last modified: 2008/12/24 04:54 by cch
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki