Self-contained RT using perlbrew
I have deployed Request Tracker(RT) for many different organizations and I have had to be subject to various different constraints on my approach to deployment. Therefore I am well aware that there are lots of possible approaches. This article outlines one approach that had some clear benefits over others that I have used.
- The resulting installation is easily reproducible because we end up with a single, self-contained rpm
- The process is easily repeatable when it is time to modify the installation or add to it
- Being a process means that version upgrades are straightforward from a software perspective (business needs analysis and testing are another matter)
Overview
- use perlbrew to install a new, separate perl into /opt
- use App::cpanminus (aka cpanm) to install dependency modules into it
- install the desired application also into /opt taking advantage of the perlbrewed version of perl
- package the whole lot as a mega, self-contained rpm.
Details
Ensure build dependencies are available on your buildbox, they are listed in the spec file's BuildRequires. You'll probably want at least expat-devel, gd-devel and graphviz-devel in addition to "normal".
Build a custom perl into /opt/perl5 using perlbrew:
mkdir /opt/perl5 export PERLBREW_ROOT=/opt/perl5 perlbrew init source ${PERLBREW_ROOT}/etc/bashrc perlbrew install perl-5.18.1 perlbrew switch perl-5.18.1 perlbrew install-cpanm cpanm -n DBD::mysql cpanm Starman
Download/unpack RT tarball, configure:
mkdir src && cd src wget http://download.bestpractical.com/pub/rt/release/rt.tar.gz tar -xzf rt.tar.gz && cd rt-* ./configure --with-web-handler=standalone \ --with-web-user=apache --with-web-group=apache \ --enable-gd --enable-graphviz --enable-gpg \ --with-db-type=mysql
Install all dependency modules into that perl's site-lib. This step is where you have you might have to do some manual dependency resolution; keep going with ''make testdeps'' until you get 'All dependencies have been found':
make testdeps 2>&1 |grep '\.MISSING'| sed -e 's!\.\.\.MISSING$!!' -e 's/^\t//' | sort | uniq > fulldeps.txt cpanm $(awk '{ print $1}' fulldeps.txt) && make testdeps
Comments
You will still need to create (or import/upgrade) the database
On a multicore machine, you might want to add '-j' to your perlbrew install:
perlbrew install -j $(expr $(nproc) + 1) perl-5.18.1
Example specfile of the perlbrew/megarpm approach for RT:
Name: rt Version: 4.2.0 Release: 1%{?dist} Summary: Request Tracker, the Mega-rpm, including its own perl Group: Applications/Internet License: GPLv2+ URL: http://www.bestpractical.com/rt BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: perlbrew BuildRequires: expat-devel BuildRequires: gd-devel BuildRequires: mysql-devel BuildRequires: openssl-devel Requires: mysql Requires: gd Requires: gnupg2 Requires: graphviz Requires: openldap Requires: openssl AutoReqProv: no %global RT_PREFIX /opt/rt4 %global PERL_PREFIX /opt/perl5 # NOTICE: you'll need to modify the __os_install_post macro that you can see # in your rpm --showrc output, so override it in e.g. ~/.rpmmacros. It # *shouldn't* be here because specfiles don't support multiline macro defs. # Just remove line %{_rpmconfigdir}/brp-strip-static-archive %description RT is an enterprise-grade ticketing system which enables a group of people to intelligently and efficiently manage tasks, issues, and requests submitted by a community of users. This build is with a custom perl5 install to keep it entirely separate from vendor perl. %prep %build %install rm -rf %{buildroot} echo "Copy complete perl5 base directory to buildroot" mkdir -p %{buildroot}/%{PERL_PREFIX} cp -Rp %{PERL_PREFIX}/* %{buildroot}/%{PERL_PREFIX}/ echo "Copy complete rt4 base directory to buildroot" mkdir -p %{buildroot}/%{RT_PREFIX} cp -Rp %{RT_PREFIX}/* %{buildroot}/%{RT_PREFIX}/ %clean rm -rf %{buildroot} %files #custom perl5 %defattr(644,root,root) %attr(755,root,root) %{PERL_PREFIX}/bin/* %{PERL_PREFIX}/etc/* %{PERL_PREFIX}/perls/* %{PERL_PREFIX}/Conf.pm %dir %attr(755, root, root) %{PERL_PREFIX}/bin %dir %attr(755, root, root) %{PERL_PREFIX}/etc %dir %attr(755, root, root) %{PERL_PREFIX}/perls #rt stuff #%config{noreplace} %{_sysconfdir}/init.d/rt #%config{noreplace} /opt/rt4/etc/RT_SiteConfig.pm %attr(755,root,root) %{RT_PREFIX}/bin/* %attr(755,root,root) %{RT_PREFIX}/sbin/* %attr(0644,apache,apache) %{RT_PREFIX}/etc/* %{RT_PREFIX}/lib/* %{RT_PREFIX}/share/html/* %{RT_PREFIX}/share/po/* %{RT_PREFIX}/share/fonts/* %attr(0755,apache,apache) %{RT_PREFIX}/var/log %attr(0770,apache,apache) %{RT_PREFIX}/var/mason_data %attr(0770,apache,apache) %{RT_PREFIX}/var/session_data %{RT_PREFIX}/local/* %changelog * Fri Nov 8 2013 Duncan Hutty <dhutty@allgoodbits.org>