Menu Chiudi

Pillola #58: Installazione / Configurazione – RT Request Tracker

Per quale motivo scegliere request tracker https://bestpractical.com/rt/ ?

Pro:
– open-source
– ben documentato
– esiste una mailing-list e un wiki (non esiste un forum)
– tradotto in Italiano
– applicativo web utilizzabile con qualsiasi browser
– interfaccia web ottimizzato per tablet e palmari
– i ticket si possono aprire sia tramite interfaccia web che tramite posta elettronica
– i ticket possono essere “alimentati” con ulteriori informazioni sia tramite interfaccia web che tramite posta elettronica
– è possibile aggiungere commenti, allegati e rispondere ai vari ticket
– è possibile assegnare la risoluzione dei ticket
– è possibile spostare i ticket tra i vari servizi/uffici/code
– interfaccia abbastanza chiara e semplice da utilizzare
– dashboard personalizzabile per ogni utente
– ricerche semplici e avanzate memorizzabili direttamente dall’utente finale
– gestisce la cronostoria di TUTTO
– consente di collegare i ticket a ticket già esistenti
– mostra dei grafici (utili ad esempio ai responsabili di servizio)
– gestisce i permessi di accesso in maniera decente (non eccezionale !)
– integrabile per l’autenticazione LDAP (es. quello di AD)
– svariate operazioni (es. invio di e-mail, creazione di ticket, possono essere scriptate direttamente tramite la shell)

Contro:
– non è possibile gestire i permessi di accesso a livello di singolo ticket
– non semplicissimo da installare/configurare se vogliamo l’ultima versione (che è altamente consigliata)

Link utile http://binarynature.blogspot.it/2013/10/install-request-tracker-4-on-ubu…

Note tecniche relative all’installazione di Request Tracker.

NB. in realtà non ho spiegato come configurare https, in quanto uso un reverse-proxy perimetrale che si occupa di gestire le connessioni https e girarle verso il server RT che si trova in una DMZ !

Request Tracker è stato installato direttamente dai sorgenti in quanto la versione di Debian 7.5 riporta una versione obsoleta di RT.

Pacchetti installati per soddisfare le dipendenze:

apt-get install mysql-server mysql-client libmysqlclient-dev
apt-get install apache2 libapache2-mod-fcgid libssl-dev libyaml-perl libgd2-xpm-dev libgd-gd2-perl libgraphviz-perl
apt-get install build-essential

Aggiungere al file /etc/mysql/my.cnf il seguente parametro

innodb_buffer_pool_size = 256M

Eseguire lo script “mysql_secure_installation” per mettere in sicurezza mysql

Riaviare il servizio

service mysql restart

Utenti e Gruppi

adduser --system --group rt
usermod -aG rt www-data

Scaricare la versione 4.2 di RT

cd /root
wget https://download.bestpractical.com/pub/rt/release/rt-4.2.5.tar.gz
tar -xzvf rt-4.2.5.tar.gz
rm rt-4.2.5.tar.gz

Configurare i sorgenti per l’utilizzo di postgresql

cd /root/rt-4.2.5
./configure --with-web-user=www-data --with-web-group=www-data --enable-graphviz --enable-gd

Configuro CPAN

cpan

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] 
...
Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes] 
...
cpan[1]> o conf prerequisites_policy follow
cpan[2]> o conf build_requires_install_policy yes
cpan[3]> o conf commit
cpan[4]> q

Sistemo le dipendenze perl mancanti

make fixdeps
make testdeps

Installo RT

make install

Creo il database

make initialize-database

Configurazione di apache

# cat /etc/apache2/sites-available/default
<VirtualHost *:80>
        # Request Tracker
        ServerName rt.corp.example.com:443
        AddDefaultCharset UTF-8
        DocumentRoot /opt/rt4/share/html
        Alias /NoAuth/images/ /opt/rt4/share/html/NoAuth/images/
        ScriptAlias / /opt/rt4/sbin/rt-server.fcgi/
        <Location />
            ## Apache version < 2.4 (e.g. Debian 7.2)
            Order allow,deny
            Allow from all
            ## Apache 2.4
            # Require all granted
        </Location>
        <Directory "/opt/rt4/sbin">
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        LogLevel warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Imposto la password mysql per l’utente rt_user

mysql -u root -p
SET PASSWORD FOR 'rt_user'@'localhost' = PASSWORD('**PASSWORD**');
service mysql restart

Modifico il contenuto del file /opt/rt4/etc/RT_SiteConfig.pm

# Any configuration directives you include  here will override
# RT's default configuration file, RT_Config.pm
#
# To include a directive here, just copy the equivalent statement
# from RT_Config.pm and change the value. We've included a single
# sample value below.
#
# This file is actually a perl module, so you can include valid
# perl code, as well.
#
# The converse is also true, if this file isn't valid perl, you're
# going to run into trouble. To check your SiteConfig file, use
# this command:
#
#   perl -c /path/to/your/etc/RT_SiteConfig.pm
#
# You must restart your webserver after making changes to this file.

Set( $rtname, 'rt.dominio.pubblico.it');
Set( $Organization, 'rt.dominio.pubblico.it');
Set( $Timezone, 'Europe/Rome');
Set( $WebDomain, 'rt.dominio.pubblico.it');
Set( $WebPort, 443);
Set( $WebPath, '');
Set( $DatabasePassword, '**PASSWORD**');
Set( $CanonicalizeRedirectURLs, 1);

# You must install Plugins on your own, this is only an example
# of the correct syntax to use when activating them:
#     Plugin( "RT::Extension::SLA" );
#     Plugin( "RT::Authen::ExternalAuth" );

1;

NB. per ogni modifica apportata al file “/opt/rt4/etc/RT_SiteConfig.pm” è necessario riavviare apache.

Modificare il contenuto del file “/etc/apache2/mods-available/fcgid.conf” aggiungendo la seguenti righe:

  # Request Tracker
  FcgidMaxRequestLen 1073741824

Questo l’elenco dei parametri configurabili per il singolo sito:
https://bestpractical.com/docs/rt/latest/RT_Config.html

L’interfaccia web è accessibile all’indirizzo http://rt.dominio.locale
Le credenziali di accesso predefinite sono:
root
password

Imposto i template in modalita’ testo piatto:

/opt/rt4/etc/upgrade/switch-templates-to text

per passare alla modalita’ HTML

/opt/rt4/etc/upgrade/switch-templates-to html

Gestire l’autenticazione tramite LDAP
– installare il plugin necessario a gestire l’autenticazione

cd /root
- scaricare l'ultima del plugin dal sito https://metacpan.org/release/RT-Authen-ExternalAuth
tar -xvzf RT-Authen-ExternalAuth-X.XX.tar.gz
rm RT-Authen-ExternalAuth-X.XX.tar.gz
cd RT-Authen-ExternalAuth-X.XX
perl Makefile.PL
make
make install
cpan install Net::LDAP
cp /opt/rt4/local/plugins/RT-Authen-ExternalAuth/etc/RT_SiteConfig.pm /opt/rt4/etc/autenticazioneLDAP.pm

– aggiungere le seguenti righe a /opt/rt4/etc/RT_SiteConfig.pm

# You must install Plugins on your own, this is only an example
# of the correct syntax to use when activating them:
#     Plugin( "RT::Extension::SLA" );
#     Plugin( "RT::Authen::ExternalAuth" );
Plugin( "RT::Authen::ExternalAuth" );
do "autenticazioneLDAP.pm";

– personalizzare il contenuto del file /opt/rt4/etc/autenticazioneLDAP.pm in base alle proprie esigenze

Configurare la gestione della creazione dei ticket tramite posta elettronica:
– installare postfix
– configurare il file /etc/aliases in questo modo

#
# configuro gli indirizzi di posta elettronica connessi alle code di RT Request Tracker
#
rtsistemainformativo: "|/opt/rt4/bin/rt-mailgate --queue 'NOMEDELLACODA' --action correspond --url http://localhost"

NB. ad ogni modifica del file /etc/aliases è necessario eseguire:

newaliases

per eseguire un test di creazione ticket tramite posta elettronica:

cat messaggio.eml |/opt/rt4/bin/rt-mailgate --queue 'NOMEDELLACODA' --action correspond --url / --debug

Rendere obbligatoria la compilazione del campo oggetto
Installare l’apposito plugin

cd /root
wget http://search.cpan.org/CPAN/authors/id/E/EL/ELACOUR/RT-Extension-Mandato...
tar -xzvf RT-Extension-MandatorySubject-0.05.tar.gz
rm RT-Extension-MandatorySubject-0.05.tar.gz
cd RT-Extension-MandatorySubject-0.05
perl Makefile.PL
make
make test
make install

e attivarlo modificando il contenuto del file /opt/rt4/etc/RT_SiteConfig.pm

# Obbligo gli utenti a compilare il campo oggetto delle richieste
Plugin( "RT::Extension::MandatorySubject" );

Gestione delle priorita’ visualizzate come stringa
wget http://search.cpan.org/CPAN/authors/id/A/AL/ALEXMV/RT-Extension-Priority…

cd /root
wget http://search.cpan.org/CPAN/authors/id/A/AL/ALEXMV/RT-Extension-Priority...
tar -xzvf RT-Extension-PriorityAsString-1.00.tar.gz
rm RT-Extension-PriorityAsString-1.00.tar.gz
cd RT-Extension-PriorityAsString-1.00/
perl Makefile.PL
make
make install

modificare il contenuto del file /opt/rt4/etc/RT_SiteConfig.pm

# Gestione delle priorita' visualizzate come stringa
Plugin( "RT::Extension::PriorityAsString" );
    # Specify a mapping between priority strings and the internal
    # numeric representation
    Set(%PriorityAsString, (Bassa => 0, Media => 50, Alta => 100));

    # Fine-tuned control of the order of priorities as displayed in the
    # drop-down box; usually this computed automatically and need not be
    # set explicitly.  It can be used to limit the set of options
    # presented during update, but allow a richer set of levels when
    # they are adjusted automatically.
    # Set(@PriorityAsStringOrder, qw(Low Medium High));

    # Uncomment if you want to apply different configurations to
    # different queues.  Each key is the name of a different queue;
    # queues which do not appear in this configuration will use RT's
    # default numeric scale.
    # This option means that %PriorityAsString and
    # @PriorityAsStringOrder are ignored (no global override, you must
    # specify a set of priorities per queue). You can safely leave them
    # out of your RT_SiteConfig.pm to avoid confusion.
    # Set(%PriorityAsStringQueues,
    #    General => { Low => 0, Medium => 50, High => 100 },
    #    Binary  => { Low => 0, High => 10 },
    # );

svuoto la cache e riavvio apache

rm -rf /opt/rt4/var/mason_data/obj
apache2ctl restart

Abilitazione dei diagrammi di Gantt

cd /root/
wget https://github.com/bestpractical/rt-extension-jsgantt/archive/master.zip
unzip master.zip
rm master.zip
cd rt-extension-jsgantt-master/
perl Makefile.PL
make
make install

modificare il contenuto del file /opt/rt4/etc/RT_SiteConfig.pm

# Gestione diagrammi di gant
Plugin( "RT::Extension::JSGantt" );
Set(
            %JSGanttOptions,
            DefaultFormat => 'day', # or week or month or quarter
            ShowOwner     => 1,
            ShowProgress  => 1,
            ShowDuration  => 1,

            # define your own color scheme:
            # ColorScheme => ['ff0000', 'ffff00', 'ff00ff', '00ff00', '00ffff', '0000ff'],

            # we color owners consistently by default, you can disable it via:
            # ColorSchemeByOwner => 0,

            # you can specify colors to use, unspecified owners will be
            # assigned to some color automatically:
            # ColorSchemeByOwner => { root => 'ff0000', foo => '00ff00' },

            # if can't find both start and end dates, use this color
            NullDatesColor => 333,

            # to caculate day length
            WorkingHoursPerDay => 8,

            # used to set start/end if one exists but the other does not
            DefaultDays => 7,
        );

svuoto la cache e riavvio apache

rm -rf /opt/rt4/var/mason_data/obj
apache2ctl restart

Abilitare esportazione ricerche in formato XLS

cpan install Spreadsheet::WriteExcel
cd /root/
wget http://search.cpan.org/CPAN/authors/id/E/EL/ELACOUR/RT-Extension-SearchR...
tar -xzvf RT-Extension-SearchResults-XLS-0.08.tar.gz
rm RT-Extension-SearchResults-XLS-0.08.tar.gz
cd RT-Extension-SearchResults-XLS-0.08/
perl Makefile.PL
make
make test
make install

modifico il contenuto del file /opt/rt4/etc/RT_SiteConfig.pm

# Gestione esportazione ricerche in formato XLS
Plugin( "RT::Extension::SearchResults::XLS" );

riavvio il servizio Apache

apache2ctl restart

Come gestire l’invio di e-mail in base ai promemoria impostati dagli utenti ?
http://requesttracker.wikia.com/wiki/Reminders
– creare un nuovo Template/Modello

Nome: Promemoria invio email
Descrizione: Invia email due giorni prima della scadenza di un promemoria
Tipo:Perl
Contenuto:
To: { $Target = $Ticket->RefersTo->First->TargetObj; ($Argument eq 'TicketOwner' ? $Target : $Ticket)->OwnerObj->EmailAddress }

Il promemoria: {$Ticket->Subject} scadra' in data {$Ticket->DueAsString}
   
Ticket: {RT->Config->Get('WebURL')}Ticket/Display.html?id={$Target->Id}

– modificare il contenuto del file /etc/cron.d/rt-reminder

#
# questo script si occupa di inviare una e-mail per tutti i reminder/promemoria impostati da ogni singolo utente
# NB. lo script invia una e-mail per ogni giorno (in questo caso 2) che precedono la data del reminder/promemoria
#
0 6 * * * root /opt/rt4/bin/rt-crontool \
                  --search RT::Search::FromSQL \
                  --search-arg 'Type = "reminder" and (Status = "open" or Status = "new")' \
                  --condition RT::Condition::BeforeDue \
                  --condition-arg 2d \
                  --action RT::Action::SendEmail \
                  --action-arg Owner \
                  --transaction first \
                  --template 'Promemoria invio email'

Abilitare lo strumento “Distruttore di ticket”
https://bestpractical.com/docs/rt/4.2/rt-shredder.html

mkdir /opt/rt4/var/data
mkdir /opt/rt4/var/data/RT-Shredder
chown www-data.www-data /opt/rt4/var/data -R

Abilitare un utente all’uso di RT Request Tracker

- selezionare Admin / Utenti / Crea
- compilare il campo "Username" con COGNOMENOME
- abilitare il flag "Consenti la concessione di diritti espliciti a questo utente (Privilegiato)"
- selezionare il pulsante "Crea"
- selezionare "Appartenenza a gruppi" dal menu orizzontale
- abilitare il flag "Utenti Comune"
- confermare con il pulsante "Aggiornamento"

il tutto puo’ essere automatizzato con uno script:

# cat ./rtaggiungiutente.pl
#!/usr/bin/perl -w
my ($utente) = @ARGV;

use strict;
use lib "/opt/rt4/lib";
use RT;
use RT::Interface::CLI qw( CleanEnv );

CleanEnv();
RT::LoadConfig();
RT::Init();

# creo un nuovo utente
my $User = RT::User->new ( $RT::SystemUser );
$User->Create( Name => $utente );

# aggiungo l'utente agli utenti privilegiati
$User->SetPrivileged( 1 );

# associo al gruppo 'Utenti Comune' il nuovo utente
my $Group = RT::Group->new ( $RT::SystemUser );
$Group->LoadUserDefinedGroup( 'Utenti Comune' );
$Group->AddMember( $User->PrincipalObj->Id );

per aggiungere un nuovo utente (che dovrà essere presente sia in AD che in Zimbra):

./rtaggiungiutente.pl COGNOMENOME

Personalizzazione dell’interfaccia Web
E’ possibile apportare modifiche ai template dell’interfaccia web SENZA toccare il core dell’applicativo.

Tutti i template html si trovano in /opt/rt4/share/html/

Per modificare un template:
– ricreare la struttura che si vuole modificare in /opt/rt4/local/html
– copiare il file desiderato in /opt/rt4/local/html/CARTELLA
– svuotare la cache

rm -rf /opt/rt4/var/mason_data/obj

– riavviare il servizio di apache

apache2ctl restart

Migliorare la traduzione da Inglese a Italiano
– apportare le modifiche tramite launchpad (NB. è necessario avere un utente di launchpad)

https://translations.launchpad.net/rt/4.2/+pots/rt/it/+translate

– scaricare il file po e renderlo operativo

cd /opt/rt4/share/po
wget http://launchpadlibrarian.net/XXXXXX/share_po_rt-it.po
mv share_po_rt-it.po it.po
chown root.bin it.po
rm -rf /opt/rt4/var/mason_data/obj
apache2ctl restart

Come eseguire un upgrade ad una nuova versione
– eseguire un backup di tutto
– scaricare l’ultima versione disponibile
– scompattare il file tar.gz
– leggere bene il contenuto del file README

Aggiornamento da 4.2.5 a 4.2.6

cd /root
wget https://download.bestpractical.com/pub/rt/release/rt-4.2.6.tar.gz
tar -xzvf rt-4.2.6.tar.gz
rm rt-4.2.6.tar.gz
cd rt-4.2.6
./configure --with-web-user=www-data --with-web-group=www-data --enable-graphviz --enable-gd
make fixdeps
make testdeps
service apache2 stop
make upgrade
make upgrade-database

/usr/bin/perl -I/opt/rt4/local/lib -I/opt/rt4/lib sbin/rt-setup-database --action upgrade --prompt-for-dba-password
In order to create or update your RT database, this script needs to connect to your  mysql instance on localhost (port '') as root
Please specify that user's database password below. If the user has no database
password, just press return.

Password:
Working with:
Type:   mysql
Host:   localhost
Port:
Name:   rt4
User:   rt_user
DBA:    root
Enter RT version you're upgrading from: 4.2.5

Going to apply following upgrades:
* 4.2.6

Enter RT version if you want to stop upgrade at some point,
  or leave it blank if you want apply above upgrades:

IT'S VERY IMPORTANT TO BACK UP BEFORE THIS STEP

Proceed [y/N]:y
Processing 4.2.6
Now populating database schema.
Now inserting data.
Done.

Scaricare la versione aggiornata della lingua da launchpad e aggiornare il relativo file it.po
https://translations.launchpad.net/rt/4.2/+pots/rt/it/+translate
- scaricare il file po e renderlo operativo
cd /opt/rt4/share/po
wget http://launchpadlibrarian.net/XXXXXX/share_po_rt-it.po
mv share_po_rt-it.po it.po
chown root.bin it.po
rm -rf /opt/rt4/var/mason_data/obj
apache2ctl restart
WordPress Appliance - Powered by TurnKey Linux