Request Tracker: Difference between revisions

From Alpine Linux
m (more)
m (nowiki'd hypothetical URLs.)
 
(23 intermediate revisions by 8 users not shown)
Line 1: Line 1:
Note: This document has been tested on Alpine Linux 2.2.2, but contains some packages which are currently in the [[http://wiki.alpinelinux.org/wiki/Upgrading_to_Edge edge/testing repository]].<br />
This guide will get [https://bestpractical.com/request-tracker Request Tracker] 4 setup working, with support for emails sent to an mlmmj mailing list to be inserted first into the ticket system, then sent on to mlmmj.  It is intended for a HelpDesk-type deployment.  This howto assumes that you have a working postfix setup already. <br />
 
Note: This document has been tested on Alpine Linux 2.2.2, but contains some packages which are currently in the [[Repositories#Edge|edge]] repository.<br />
Note: Use a computer with at least 512MB of RAM.<br />
Note: Use a computer with at least 512MB of RAM.<br />


== RT with basic email support ==
== Initial package installation and setup ==
This guide will get a basic rt4 setup working that will allow inbound emails to create/update issues, and assumes that you have a working postfix setup already. <br />
 
* add edge/main and edge/testing repos to /etc/apk/repositories
* add edge/main repository to /etc/apk/repositories
{{Cmd|printf "http://nl.alpinelinux.org/alpine/edge/main\nhttp://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
{{Cmd|printf "https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
  apk update}}
  apk update}}
* {{Cmd|apk add lighttpd fcgi postgresql rt4 php php-cli postfix postfix-pcre msmtp}}
* {{Cmd|apk add lighttpd fcgi postgresql rt4 postfix postfix-pcre mlmmj}}
* Edit ''/etc/lighttpd/lighttpd.conf'' and enable fastcgi
* Edit ''/etc/lighttpd/lighttpd.conf'' and enable fastcgi
* {{Cmd|/etc/init.d/postgresql setup}}
* {{Cmd|/etc/init.d/postgresql setup}}
* {{Cmd|/etc/init.d/postgresql start}}
* {{Cmd|/etc/init.d/postgresql start}}
* {{Cmd|su - postgres -c "createuser -P"}}
* {{Cmd|su - postgres -c "createuser -P rt_user"}}
 
Enter name of role to add: '''rt_user'''
  Enter password for new role: '''''rtpass'''''
  Enter password for new role: '''''rtpass'''''
  Enter it again: '''''rtpass'''''
  Enter it again: '''''rtpass'''''
Line 20: Line 20:
  Shall the new role be allowed to create more new roles? (y/n) '''y'''
  Shall the new role be allowed to create more new roles? (y/n) '''y'''


== Setup RT4 environment ==
* {{Cmd|cp /etc/rt4/RT_Config.pm /etc/rt4/RT_SiteConfig.pm}}
* {{Cmd|cp /etc/rt4/RT_Config.pm /etc/rt4/RT_SiteConfig.pm}}
* {{Cmd|chmod 644 /etc/rt4/RT_SiteConfig.pm}}
* {{Cmd|chmod 644 /etc/rt4/RT_SiteConfig.pm}}
* /etc/rt4/RT_SiteConfig.pm change to use Pg instead of mysql and change DatabasePassword to correspond to the password created for '''rt_user''' in postgresql.
* Setup RT_SiteConfig.pm with proper queue name, link to your organization's homepage, support postgresql, set outbound email defaults.
* {{Cmd|/usr/sbin/rt-setup-database --action init}}
** /etc/rt4/RT_SiteConfig.pm:
Set($rtname, 'support');
Set($Organization, 'example.com');
Set($WebDomain, 'fqdn.in.example.com');
Set($OwnerEmail, 'RTAdmin@example.com');
Set($LogoLinkURL, '<nowiki>https://www.example.com/</nowiki>');
Set($LogoAltText, 'Example.com Support');
# Set($LogoURL, '');
Set($DatabaseType, 'Pg');
Set($DatabaseUser, 'rt_user');
Set($DatabasePassword, 'rtpass');
Set($DatabaseName, 'support_rt');
Set($LogToSyslog, 'warning');
Set($MailCommand, 'sendmailpipe');
Set($SendmailArguments , '-fpostmaster@example.com -oi -t');
Set($ParseNewMessageForTicketCCs, 1);
Set($UseTransactionBatch, 1);
Set($CorrespondAddress, 'support@example.com');
Set($CommentAddress, 'support@example.com');
Set($RecordOutgoingEmail, 0);
Set($ForwardFromUser, 1);
Set($SetOutgoingMailFrom, 1);
Set($FriendlyFromLineFormat, '"%s" <%s>');
* {{Cmd|/usr/sbin/rt-setup-database --action init --dba postgres}}
* {{Cmd|rt-server}}
* {{Cmd|rt-server}}
* Test and make sure that you can access rt using the built-in webserver first.
* Test and make sure that you can access rt using the built-in webserver first.
* Tools -> Configuration -> Queues -> Create... Give it a name like 'support', which you'll use in the next sections (including the email address)
** Tools -> Config -> Users -> Create
** Username: Support-lists, Email: support-lists@example.com, etc -> Create
** Tools -> Config -> Groups -> Create
** Name: Support Users, etc -> Create
** Tools -> Configuration -> Queues -> Create... Give it a name like 'support', and set support-list@example.com to be both reply and comment addresses.  Remember the name 'support' which you'll use in the next sections (including the email address)
 
== Modify Postfix Configuration for RT4 and mlmmj ==
 
* adduser mlmmj
* mkdir /var/spool/mlmmj
* mlmmj-make-ml.sh -L support-list
* Support sending bcc to list
** touch /var/spool/mlmmj/support-list/control/tocc
* Allow support@example.com to send to list without being subscribed to it
** mlmmj-sub -L /var/spool/mlmmj/support-list -a support@example.com -n
* Add to ''/etc/postfix/master.cf'':
rt4    unix  -      n      n      -      -      pipe flags=DORhu user=lighttpd argv=/usr/bin/rt-mailgate --queue $nexthop --action correspond --url <nowiki>http://fqdn.in.example.com/</nowiki>
mlmmj  unix  -      n      n      -      -      pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop
* Add to ''/etc/postfix/main.cf'':
* Add to ''/etc/postfix/main.cf'':
  virtual_alias_maps = regexp:/etc/postfix/rt4-aliases
  myhostname = mx1.example.com
  transport_maps = regexp:/etc/postfix/rt4-transport
mydomain = mx1.example.com
* Create /etc/postfix/rt4-aliases (replacing example.com):
relay_domains = example.com
  /^(.*)@example.com$/  $1
recipient_delimiter = +
* Create /etc/postfix/rt4-transport:
  transport_maps = hash:/etc/postfix/transport
  /^support$/            rt4-support:
* Create ''/etc/postfix/transport'' (and run "postmap transport" after editing):
* Add to /etc/postfix/master.cf:
  support@example.com       rt4:support
  rt4-support  unix    -      n      n      -      -      pipe    flags=DORhu    user=postgres    argv=/usr/bin/rt-mailgate --queue support --action correspond --url http://ip.addr.of.interface/
  support-list@example.com  mlmmj:support-list
postmaster@example.com    local:
  example.com                error:No such mailbox.
* Edit ''/etc/postfix/aliases'' for the postmaster alias (and run "newaliases")
* Allow users to create tickets by email by checking all General Rights for group Everyone in Tools -> Configuration -> Global -> Group Rights
* Allow users to create tickets by email by checking all General Rights for group Everyone in Tools -> Configuration -> Global -> Group Rights
* Setup outbound emails:
 
* /etc/rt4/RT_SiteConfig.pm:
== Lighttpd configuration ==
Set($MailCommand, "sendmailpipe");
 
Set($SendmailPath, "/usr/sbin/sendmail");
{{Warning|Instructions below this warning haven't yet been tested}}
* Stop rt-server
* Stop rt-server
* /etc/lightttpd/lighttpd.conf:
include "rt4.conf"
* /etc/lighttpd/rt4.conf:
server.modules += ("mod_fastcgi")
$HTTP["host"] == "fqdn.in.example.com" {
        server.document-root = "/usr/share/rt4/html"
        index.file-names = ( "index.html" )
        fastcgi.server = ( "/" =>
              ((
                "bin-path"      => "/usr/sbin/rt-server.fcgi",
                "socket"        => "/var/run/lighttpd/rt4.socket",
                "check-local"  => "disable",
                "fix-root-scriptname" => "enable"
              )),
          )
}
* {{Cmd|/etc/init.d/lighttpd start}}
* {{Cmd|/etc/init.d/lighttpd start}}
* /etc/lighttpd/lighttpd.conf (add to the end):
fastcgi.server = ( "/rt" =>
        ( "localhost" =>
                  (
                            "port" => 80,
                            "bin-path" => "/usr/sbin/rt-server.fcgi",
                            "check-local" => "disable"
                  )
        )
)


== Final RT4 configuration ==
* Login to <nowiki>http://fqdn.in.example.com</nowiki> (your RT server)
** Add AdminCC for Support Users to support queue
** New template called 'Support Users Correspondence' (anyone you add to Support Users group will have their outbound email rewritten to 'Support Team' instead of their realname
{
  my $output = undef;
  my $groups = $Transaction->CreatorObj->OwnGroups();
  while( my $group = $groups->Next ) {
    my $queue = $Ticket->QueueObj;
    my $realname = $queue->Description;
    my $email = $queue->CorrespondAddress || RT->Config->Get('CorrespondAddress');
    $output = 'From: "' . $realname . '" <' . $email . '>' if $group->Name eq 'Support Team';
  }
  $output;
}
RT-Attach-Message: yes
{$Transaction->Content()}
** Edit Resolved template and add the following to the end:
{
  my $old_user = $Ticket->CurrentUser;
  $Ticket->CurrentUser( $RT::SystemUser );
  my $batch = $Ticket->TransactionBatch;
  my $comment;
  if( !$batch || !ref($batch) ) {
    $RT::Logger->info("TransactionBatch stage is disabled,
                      fallback to last comment.
                      Turn on TransactionBatch stages for acurate results.");
    my $transactions = $Ticket->Transactions;
    $transactions->Limit( FIELD => 'Type', VALUE => 'Comment' );
    $transactions->OrderByCols( { FIELD => 'Created',
                                  ORDER => 'DESC' },
                                  { FIELD => 'id',
                                    ORDER => 'DESC' } );
    $transactions->RowsPerPage(1);
    $comment = $transactions->First;
  } else {
    $comment = (grep { ($_->Type eq 'Comment')? 1: 0;} @$batch)[0];
  }
  $OUT = " ";
  if ( $comment ) {
    $OUT = "Resolution:\n";
    $OUT .= ("-"x76) ."\n";
    $OUT .= $comment->Content;
  }
  $Ticket->CurrentUser( $old_user );
}
* Test that inbound and outbound emails, creating tickets by email and replying to ticket emails works as expected:
** Emails from end-users should be sent to support@example.com
** Those emails are either created as a new ticket in RT, or if the subject line contains a ticket ID, then it's inserted into the appropriate ticket
** Ticket comments and correspondence will be sent on to support-list@example.com, which is an mlmmj list, which can be subscribed to using support-list+subscribe@example.com
** The RT4 web interface is available at <nowiki>http://fqdn.in.example.com</nowiki>
[[Category:Mail]]
[[Category:Server]]
[[Category:Programming]]


== Optional: Mlmmj support ==
== Upgrading RT ==
{{Warning|This section hasn't yet been tested}}
Upgrading the web interfaces should be easy as upgrading any Alpine package
* apk add mlmmj
{{Cmd|apk add -u rt4}}
* adduser mlmmj
Now upgrade the database:
* mkdir /var/spool/mlmmj
{{Cmd|rt-setup-database --dba postgres --datadir /etc/rt4/upgrade --action upgrade}}
* mlmmj-make-ml.sh -L support
Answers to the questions asked.
* /etc/postfix/main.cf:
virtual_alias_maps = regexp:/etc/postfix/rt4-aliases,
  regexp:/etc/postfix/mlmmj-lists
transport_maps = regexp:/etc/postfix/rt4-transport,
  regexp:/etc/postfix/mlmmj-transport
* /etc/postfix/mlmmj-lists:
/^(support1.*)@example.com/  $1
* /etc/postfix/mlmmj-transport:
/^(support1).*$/            mlmmj-support:
* /etc/postfix/master.cf:
mlmmj-support              unix    -       n      n      -      -      pipe    flags=DORhu    user=mlmmj      argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/support/
* set outbound default email for tickets to be support1@example.com
Tools -> Configuration -> Queues -> Select -> Support
Change "reply address" and "comment address" to support1@example.com (replacing support@example.com)

Latest revision as of 03:34, 25 August 2023

This guide will get Request Tracker 4 setup working, with support for emails sent to an mlmmj mailing list to be inserted first into the ticket system, then sent on to mlmmj. It is intended for a HelpDesk-type deployment. This howto assumes that you have a working postfix setup already.

Note: This document has been tested on Alpine Linux 2.2.2, but contains some packages which are currently in the edge repository.
Note: Use a computer with at least 512MB of RAM.

Initial package installation and setup

  • add edge/main repository to /etc/apk/repositories

printf "https://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories apk update

  • apk add lighttpd fcgi postgresql rt4 postfix postfix-pcre mlmmj

  • Edit /etc/lighttpd/lighttpd.conf and enable fastcgi
  • /etc/init.d/postgresql setup

  • /etc/init.d/postgresql start

  • su - postgres -c "createuser -P rt_user"

Enter password for new role: rtpass
Enter it again: rtpass
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) y

Setup RT4 environment

  • cp /etc/rt4/RT_Config.pm /etc/rt4/RT_SiteConfig.pm

  • chmod 644 /etc/rt4/RT_SiteConfig.pm

  • Setup RT_SiteConfig.pm with proper queue name, link to your organization's homepage, support postgresql, set outbound email defaults.
    • /etc/rt4/RT_SiteConfig.pm:
Set($rtname, 'support');
Set($Organization, 'example.com');
Set($WebDomain, 'fqdn.in.example.com');
Set($OwnerEmail, 'RTAdmin@example.com');
Set($LogoLinkURL, 'https://www.example.com/');
Set($LogoAltText, 'Example.com Support');
# Set($LogoURL, );

Set($DatabaseType, 'Pg');
Set($DatabaseUser, 'rt_user');
Set($DatabasePassword, 'rtpass');
Set($DatabaseName, 'support_rt');

Set($LogToSyslog, 'warning');

Set($MailCommand, 'sendmailpipe');
Set($SendmailArguments , '-fpostmaster@example.com -oi -t');
Set($ParseNewMessageForTicketCCs, 1);
Set($UseTransactionBatch, 1);
Set($CorrespondAddress, 'support@example.com');
Set($CommentAddress, 'support@example.com');
Set($RecordOutgoingEmail, 0);
Set($ForwardFromUser, 1);
Set($SetOutgoingMailFrom, 1);
Set($FriendlyFromLineFormat, '"%s" <%s>');
  • /usr/sbin/rt-setup-database --action init --dba postgres

  • rt-server

  • Test and make sure that you can access rt using the built-in webserver first.
    • Tools -> Config -> Users -> Create
    • Username: Support-lists, Email: support-lists@example.com, etc -> Create
    • Tools -> Config -> Groups -> Create
    • Name: Support Users, etc -> Create
    • Tools -> Configuration -> Queues -> Create... Give it a name like 'support', and set support-list@example.com to be both reply and comment addresses. Remember the name 'support' which you'll use in the next sections (including the email address)

Modify Postfix Configuration for RT4 and mlmmj

  • adduser mlmmj
  • mkdir /var/spool/mlmmj
  • mlmmj-make-ml.sh -L support-list
  • Support sending bcc to list
    • touch /var/spool/mlmmj/support-list/control/tocc
  • Allow support@example.com to send to list without being subscribed to it
    • mlmmj-sub -L /var/spool/mlmmj/support-list -a support@example.com -n
  • Add to /etc/postfix/master.cf:
rt4    unix  -       n       n       -       -       pipe flags=DORhu user=lighttpd argv=/usr/bin/rt-mailgate --queue $nexthop --action correspond --url http://fqdn.in.example.com/
mlmmj  unix  -       n       n       -       -       pipe flags=DORhu user=mlmmj argv=/usr/bin/mlmmj-recieve -F -L /var/spool/mlmmj/$nexthop
  • Add to /etc/postfix/main.cf:
myhostname = mx1.example.com
mydomain = mx1.example.com
relay_domains = example.com
recipient_delimiter = +
transport_maps = hash:/etc/postfix/transport
  • Create /etc/postfix/transport (and run "postmap transport" after editing):
support@example.com        rt4:support
support-list@example.com   mlmmj:support-list
postmaster@example.com     local:
example.com                error:No such mailbox.
  • Edit /etc/postfix/aliases for the postmaster alias (and run "newaliases")
  • Allow users to create tickets by email by checking all General Rights for group Everyone in Tools -> Configuration -> Global -> Group Rights

Lighttpd configuration

  • Stop rt-server
  • /etc/lightttpd/lighttpd.conf:
include "rt4.conf"
  • /etc/lighttpd/rt4.conf:
server.modules += ("mod_fastcgi")

$HTTP["host"] == "fqdn.in.example.com" {
        server.document-root = "/usr/share/rt4/html"
        index.file-names = ( "index.html" ) 

        fastcgi.server = ( "/" =>
             ((
                "bin-path"      => "/usr/sbin/rt-server.fcgi",
                "socket"        => "/var/run/lighttpd/rt4.socket",
                "check-local"   => "disable",
                "fix-root-scriptname" => "enable"
              )),
          )
}
  • /etc/init.d/lighttpd start

Final RT4 configuration

  • Login to http://fqdn.in.example.com (your RT server)
    • Add AdminCC for Support Users to support queue
    • New template called 'Support Users Correspondence' (anyone you add to Support Users group will have their outbound email rewritten to 'Support Team' instead of their realname
{ 
  my $output = undef;
  my $groups = $Transaction->CreatorObj->OwnGroups();
  while( my $group = $groups->Next ) {
    my $queue = $Ticket->QueueObj;
    my $realname = $queue->Description;
    my $email = $queue->CorrespondAddress || RT->Config->Get('CorrespondAddress');
    $output = 'From: "' . $realname . '" <' . $email . '>' if $group->Name eq 'Support Team';
  }
  $output;
}
RT-Attach-Message: yes 

{$Transaction->Content()} 
    • Edit Resolved template and add the following to the end:
{
 my $old_user = $Ticket->CurrentUser;
 $Ticket->CurrentUser( $RT::SystemUser );
 my $batch = $Ticket->TransactionBatch;
 my $comment;
 if( !$batch || !ref($batch) ) {
   $RT::Logger->info("TransactionBatch stage is disabled,
                     fallback to last comment.
                     Turn on TransactionBatch stages for acurate results.");
   my $transactions = $Ticket->Transactions;
   $transactions->Limit( FIELD => 'Type', VALUE => 'Comment' );
   $transactions->OrderByCols( { FIELD => 'Created',
                                 ORDER => 'DESC' },
                                 { FIELD => 'id',
                                   ORDER => 'DESC' } );
   $transactions->RowsPerPage(1);
   $comment = $transactions->First;
 } else {
   $comment = (grep { ($_->Type eq 'Comment')? 1: 0;} @$batch)[0];
 }
 $OUT = " ";
 if ( $comment ) {
   $OUT = "Resolution:\n";
   $OUT .= ("-"x76) ."\n";
   $OUT .= $comment->Content;
 }
 $Ticket->CurrentUser( $old_user );
} 
  • Test that inbound and outbound emails, creating tickets by email and replying to ticket emails works as expected:
    • Emails from end-users should be sent to support@example.com
    • Those emails are either created as a new ticket in RT, or if the subject line contains a ticket ID, then it's inserted into the appropriate ticket
    • Ticket comments and correspondence will be sent on to support-list@example.com, which is an mlmmj list, which can be subscribed to using support-list+subscribe@example.com
    • The RT4 web interface is available at http://fqdn.in.example.com

Upgrading RT

Upgrading the web interfaces should be easy as upgrading any Alpine package

apk add -u rt4

Now upgrade the database:

rt-setup-database --dba postgres --datadir /etc/rt4/upgrade --action upgrade

Answers to the questions asked.