J. Mike Rollins (Sparky) [rollins@wfu.edu]
  CISSP, GIAC GPEN
Hyperbola New
My Cats New
Kitty New
Mike is on
  LinkedIn
  FaceBook
BackYardGreen.Net
HappyPiDay.com
Green Cycle Design Group
CamoTruck.Net
  Resume  
  My Stuff  
  Art  
  My Truck  
  People  
Electronics
Jacob's Ladder
Scripts
Math
Notes
My House
My Cars
My Cats New
My Jokes
Pi Poetry
pumpkin
Toro Mower
Development
Speed of a Piston
Not a Pipe
Linux
   Home Linux
   RTIR
















RTIR

RTIR: Nov 26, 2007

These are my notes from my experience installing RTIR.

Download

As of this writing, the latest version of RTIR is 1.0.5. This version works with 3.0.x versions of RT. The 3.6 version will not work with RTIR. Download rt and rtir from bestpractical.com

Prepare

I used Fedora Core 6 for this example.

RPMs

Install Apache 2, Perl, MySQL and mod-perl. I already had Apache and Perl, so I installed mod-perl, MySQL and a few other modules.
  yum install mod_perl
  yum install mysql mysql-server mysql-devel mysqlclient10 mysqlclient14
  yum install -y "gdbm*"
Initialize the MySQL database system.
  mysql_install_db
  
  service mysqld start
  mysqladmin -u root password 'new_password'
  mysqladmin -u root -h terry.goodhotdogs.com password 'new_password'
Start MySQL and Apache and configure them to start upon boot. Let's add the rt group too.
  chkconfig --levels 345 mysqld on
  chkconfig --levels 345 httpd on
  service mysqld start 
  service httpd start 

  groupadd rt

Perl

Update the CPAN module and its settings. Set up the CPAN module by invoking the CPAN the the shell. After updating the perl CPAN system, you will need to update the CPAN settings again. You may need to run o conf commit or turn on autocommit.
  perl -MCPAN -e shell
  perl -MCPAN -e 'install Bundle::CPAN'
  perl -MCPAN -e shell
  o conf commit

Install RT

Start the install process by creating a new directory to contain the source code. Create the environment variable RT to this directory path. Untar these rt and rtir code.
  mkdir rt
  cd rt
  export RT=`pwd`

  download rt and rtir

  tar xvzf rt-3.0.11.tar.gz
  tar xvzf rtir-1.0.5.tar.gz
Next, configure RT and install the many Perl modules.
  cd $RT/rt-3.0.11

  ./configure --with-web-user=apache \
              --with-web-group=apache
Run the rt-test-dependencies program to see whether any modules are missing. The --install option will install the necessary modules. I had trouble installing one module. More on this later.
   perl sbin/rt-test-dependencies \
                --with-mysql --with-modperl2

   perl sbin/rt-test-dependencies \
                --with-mysql --with-modperl2 --install

Problems: I

If you are like me, nothing works the first or second time around. I had problems with HTML::Mason and HTML::FormatText. The FormatText failed due to an error with Font::AFM.
  [root@terry rt-3.0.11]# perl -MCPAN -e shell
  CPAN: File::HomeDir loaded ok (v0.66)

  cpan shell -- CPAN exploration and modules installation (v1.9205)
  ReadLine support enabled

  cpan[1]> make Font::AFM                                                                                         
  CPAN: Storable loaded ok (v2.15)
  cpan[2]> test Font::AFM                                                                                         
  Running test for module 'Font::AFM'
  Running make for G/GA/GAAS/Font-AFM-1.19.tar.gz
  ...
  Test Summary Report
  -------------------
  t/afm.t  (Wstat: 0 Tests: 1 Failed: 1)
  Failed test number(s):  1
  ...

  cpan[3]> make Font::AFM                                                                                         
  Running make for module 'Font::AFM'
  Running make for G/GA/GAAS/Font-AFM-1.19.tar.gz
    Has already been unwrapped into directory /root/.cpan/build/Font-AFM-1.19-sKna13
    Has already been made
Change to the directory /root/.cpan/build/Font-AFM-1.19-sKna13. Run make test and see the error. The AFM module fails because it cannot find a file for the Helvetica font. I did find a file named Helvetica.afm in the htmldoc rpm. I installed this rpm and found the missing file in /usr/share/htmldoc/fonts/Helvetica.afm.

  yum install htmldoc
  ls -l /usr/share/htmldoc/fonts/Helvetica.afm
I added the directory /usr/share/htmldoc/fonts to the end of the path line on line 196 of AFM.pm. Then make test worked. So, then run make install.
  vi AFM.pm
  go to line 196
  Change: "/usr/lib/afm:/usr/local/lib/afm:/usr/openwin/lib/fonts/afm/:.";
  To:  "/usr/lib/afm:/usr/local/lib/afm:/usr/openwin/lib/fonts/afm/:/usr/share/htmldoc/fonts:.";

  make test
  make install
Then run the rt-test-dependencies again with the install parameter.
   perl sbin/rt-test-dependencies \
                --with-mysql --with-modperl2 --install
   perl sbin/rt-test-dependencies \
                --with-mysql --with-modperl2
I had an additional problem with HTML::Mason. I manually ran the install for this a few times. I generally pressed "q" when asked for the apache source. After running "install HTML::Mason" a few times, it finally installed. Hopefully, no other modules will be MISSING.
  perl -MCPAN -e shell
  install HTML::Mason     
  install HTML::Mason     
      (install a few times)

  perl sbin/rt-test-dependencies \
                --with-mysql --with-modperl2
Run the rt-test-dependencies to verify that all the modules are installed.

Install

When all the dependencies are met, you can execute the install.
  cd $RT/rt-3.0.11
  make install
Now you need to add your site-specific settings. The following worked for my install.
  vi /opt/rt3/etc/RT_SiteConfig.pm

  Set($rtname , "rt.goodhotdogs.com");
  Set($Organization , "rt.goodhotdogs.com");
  
  Set($DatabaseType , 'mysql');
  Set($DatabaseHost   , 'localhost');
  Set($DatabaseRTHost , 'localhost');
  Set($DatabasePort , '3306');
  
  Set($DatabaseName ,     'rt3');
  Set($DatabaseUser ,     'rt_user');
  Set($DatabasePassword , 'rt_pass');
  
  Set($OwnerEmail , 'rollins');
  Set($WebPath , "");
  Set($WebBaseURL , "http://rt.goodhotdogs.com");
  Set($WebURL , $WebBaseURL . $WebPath . "/");
Now we can configure the database. If you are re-installing the system, you will need to run make dropdb.
  make initialize-database

More Problems: II

There appears to be an API change in Mason that causes an older version of RT to fail. This only requires one update in the code. Tom Loeber gives a fix for this.
  The other option -- a real quick fix -- is to change
	$m->interp->resolver->comp_root_array
  to
	$m->interp->comp_root_array
  in /opt/rt3/share/html/Elements/Callback.

Apache

Install one more Perl module.
  perl -MCPAN -e'install Apache::DBI'
Add a VirtualHost entry to the httpd.conf file. I was not able use the PerlModule line provided in the instruction. I played around for a long while and found a modified version that seems to work.
  vi /etc/httpd/conf/httpd.conf

  <VirtualHost 192.168.2.9>
      ServerName rt.goodhotdogs.com
      DocumentRoot /opt/rt3/share/html
      AddDefaultCharset UTF-8
  
      PerlSetVar MasonArgsMethod CGI
      # PerlModule Apache2 Apache::compat
      PerlModule Bundle::Apache2 Apache2::compat

      RewriteEngine On
      RewriteRule ^(.*)/$ $1/index.html
  
      PerlModule Apache::DBI
      PerlRequire /opt/rt3/bin/webmux.pl
  
      <Location />
          SetHandler perl-script
          PerlHandler RT::Mason
      </Location>
  </VirtualHost>
  
Then you must restart the web server.
  service httpd restart
At this point you can point a browser at the web site and login with the username "root" and password "password".

More Problems: III

I discovered another problem with the IR install. When I looked at the Search button, I noticed some HTML code inside the button. After a few hours of tracking this down. I uncovered a difference in the comp and scomp functions from HTM::Mason::Devel. It appears that scomp should have more than one argument. There are many instances where scomp is called with just one argument. I changed these scomp calls to comp. The Search button now works.

I wrote a little quick-dirty perl script to help find these.

Here are the files that need to be updated for RT. One more file will need to be updated later for RTIR. Replace instances of scomp with one argument to comp in these files:

  cd /opt/rt3/share/html/

  vi Elements/Tabs \
     Elements/CreateTicket \
     SelfService/Elements/Tabs \
     Approvals/Elements/ShowDependency
Now, restart the web server and check the web page again.

RTIR

A few more Perl modules are needed. Install the following:
    perl -MCPAN -e shell

    install Net::Whois::RIPE
    install Business::Hours
I did not need to make any changed to the Makefile. So, I just did the following:
    cd $RT/rtir-1.0.5
    make install
Add a link to the RT_SiteConfig.pm file:
  vi /opt/rt3/etc/RT_SiteConfig.pm

  # The RTIR config file
  $RTIR_CONFIG_FILE = "/opt/rt3/etc/RTIR_Config.pm";

  require $RTIR_CONFIG_FILE
     || die ("Couldn't load RTIR config file '$RTIR_CONFIG_FILE'\n$@");
The install the database components. And, restart the web server.
  make initdb
  service httpd restart
Now you can visit the URL again, but add /RTIR to the end of the URL: http://rt.goodhotdogs.com/RTIR/

More Problems: IV and V

We have an instance of the scomp/comp issue in the RTIR code. Change the scomp entry in RTIR/Elements/Tabs to comp.
  cd /opt/rt3/share/html/

  vi RTIR/Elements/Tabs 
The file /opt/rt3/lib/RT/Tickets_Overlay.pm has an error when calling $qo->load($CF->Queue);. Change this "load" to "Load".

  vi /opt/rt3/lib/RT/Tickets_Overlay.pm

  change 
            $qo->load( $CF->Queue );
  to
            $qo->Load( $CF->Queue );

And restart the web server.

SMTP

We need to deviate from the RT instructions for the SMTP system. The Fedora system uses a restricted shell called smrsh. Create a smrsh shell script for these action in the /etc/smrsh directory. I create separate scripts since the 'Incident Reports' uses quotes and spaces. This sometimes causes problems with command line arguments.
touch /etc/smrsh/rt-mailgate-gen
touch /etc/smrsh/rt-mailgate-ir
chmod 755 /etc/smrsh/rt-mailgate-*

vi /etc/smrsh/rt-mailgate-gen

#!/bin/sh
/opt/rt3/bin/rt-mailgate --queue general $*

vi /etc/smrsh/rt-mailgate-ir

#!/bin/sh
/opt/rt3/bin/rt-mailgate --queue 'Incident Reports' $*
Update the /etc/aliases file with entries for the various RT events. Run newaliases after adding the entries.
vi /etc/aliases
rt:         "|rt-mailgate-gen --action correspond --url http://rt.goodhotdogs.com/"
rt-comment: "|rt-mailgate-gen --action comment    --url http://rt.goodhotdogs.com/"
rtir:       "|rt-mailgate-ir  --action correspond --url http://rt.goodhotdogs.com/"

newaliases
Let sendmail listen to the network interface. To do this, you will need to install the sendmail-cf rpm, update the sendmail.mc file and then run make.
  yum install sendmail-cf
  cd /etc/mail
  vi sendmail.mc

  Change:
      DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
  To: 
      dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

  vi local-host-names
  rt.goodhotdogs.com

  make
  service sendmail restart
The system should be able to deliver the message to the RT system. But, the RT system will need to allow this message to be added.
    Nov 18 19:33:58 terry RT: RT could not load a valid user, and 
    RT's configuration does not allow for the creation of a new user 
    for this email (root@bobby.goodhotdogs.com).  You might need to 
    grant 'Everyone' the right 'CreateTicket' for the queue general.
    
So, within the web interface do the following:
  • RT Home
  • Configuration
  • Queues
  • General
  • Group Rights
  • give "Everyone" the "CreateTicket" rights.
  • Submit

More Problems: VI

I had problems with report queries not working correctly. I found the solution on the RTIR mailing list. Carlos Fuentes Bermejo recommended I use DBIx::SearchBuilder version 1.31. This fixed the query issues.
  wget http://backpan.perl.org/authors/id/J/JE/JESSE/DBIx-SearchBuilder-1.31.tar.gz
  tar xvzf DBIx-SearchBuilder-1.31.tar.gz
  cd DBIx-SearchBuilder-1.31
  perl Makefile.PL    # answer y to all the optional modules
  perl Makefile.PL    # the second time it created the Makefile
  make
  make install

  service httpd restart