请求跟踪器

来自 Alpine Linux

本指南将帮助您设置运行 Request Tracker 4,并支持将发送到 mlmmj 邮件列表的电子邮件首先插入到工单系统,然后再发送到 mlmmj。 它旨在用于帮助台类型的部署。 本操作指南假定您已经有一个可用的 postfix 设置。

注意:本文档已在 Alpine Linux 2.2.2 上测试过,但包含一些当前位于 edge 仓库中的软件包。
注意:使用至少 512MB 内存的计算机。

初始软件包安装与设置

  • 添加 edge/main 仓库到 /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

  • 编辑 /etc/lighttpd/lighttpd.conf 并启用 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

设置 RT4 环境

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

  • chmod 644 /etc/rt4/RT_SiteConfig.pm

  • 设置 RT_SiteConfig.pm,配置正确的队列名称、指向您组织主页的链接、PostgreSQL 支持,并设置出站电子邮件默认值。
    • /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

  • 首先测试并确保您可以使用内置的 Web 服务器访问 rt。
    • 工具 -> 配置 -> 用户 -> 创建
    • 用户名:Support-lists,电子邮件:support-lists@example.com,等等 -> 创建
    • 工具 -> 配置 -> 组 -> 创建
    • 名称:Support Users,等等 -> 创建
    • 工具 -> 配置 -> 队列 -> 创建... 给它一个像 'support' 这样的名称,并将 support-list@example.com 设置为回复和评论地址。 记住名称 'support',您将在接下来的部分中使用它(包括电子邮件地址)。

修改 Postfix 配置以支持 RT4 和 mlmmj

  • adduser mlmmj
  • mkdir /var/spool/mlmmj
  • mlmmj-make-ml.sh -L support-list
  • 支持向列表发送 bcc
    • touch /var/spool/mlmmj/support-list/control/tocc
  • 允许 support@example.com 发送到列表,即使未订阅
    • mlmmj-sub -L /var/spool/mlmmj/support-list -a support@example.com -n
  • 添加到 /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
  • 添加到 /etc/postfix/main.cf
myhostname = mx1.example.com
mydomain = mx1.example.com
relay_domains = example.com
recipient_delimiter = +
transport_maps = hash:/etc/postfix/transport
  • 创建 /etc/postfix/transport(并在编辑后运行 "postmap transport")
support@example.com        rt4:support
support-list@example.com   mlmmj:support-list
postmaster@example.com     local:
example.com                error:No such mailbox.
  • 编辑 /etc/postfix/aliases 以配置 postmaster 别名(并在编辑后运行 "newaliases")
  • 允许用户通过电子邮件创建工单,方法是在 工具 -> 配置 -> 全局 -> 组权限 中为 Everyone 组选中所有常规权限

Lighttpd 配置

  • 停止 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

最终 RT4 配置

  • 登录到 http://fqdn.in.example.com(您的 RT 服务器)
    • 为 Support Users 添加 AdminCC 到 support 队列
    • 新建名为 'Support Users Correspondence' 的模板(任何添加到 Support Users 组的用户,他们的出站电子邮件都将被重写为 'Support Team',而不是他们的真实姓名)
{ 
  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()} 
    • 编辑 Resolved 模板,并在末尾添加以下内容
{
 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 );
} 
  • 测试入站和出站电子邮件、通过电子邮件创建工单以及回复工单电子邮件是否按预期工作
    • 来自最终用户的电子邮件应发送到 support@example.com
    • 这些电子邮件要么在 RT 中创建为新工单,要么如果主题行包含工单 ID,则将其插入到相应的工单中
    • 工单评论和通信将发送到 support-list@example.com,这是一个 mlmmj 列表,可以使用 support-list+subscribe@example.com 订阅
    • RT4 Web 界面可在 http://fqdn.in.example.com 访问

升级 RT

升级 Web 界面应该像升级任何 Alpine 软件包一样容易

apk add -u rt4

现在升级数据库

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

对所提问题的回答。