[katello-devel] I had a dream: announcing RPM-based development setup

Lukas Zapletal lzap at redhat.com
Thu Nov 29 11:19:45 UTC 2012


Hi all,

since Mirek packaged all our development gems as RPMs, it was one simple
step to finalize this and offer instructions about how to put production
instance into development mode very easily.

Today I want to push one another improvement - introduction of bundle.d
directory (inspiration from Foreman). If you like it, instructions will
be even more simple (and it will be first step towards modularizing
Katello).

Note I am not trying to replace your development setups, this can work
well with git checkouts either on the installed machine or on your
laptops (you can configure it to connect to the machine). I would say
this setup is complementary, but I would like to present it as the
recommended setup for the community, because it's very easy to setup and
it just works. People can start hacking katello right away, after few
issued commands.

The development setup was put alive with the bundler_ext change - I will
blog about it later this week.

https://fedorahosted.org/katello/wiki/DevelopmentSetup#RPM-basedsetup

"""
This setup installs on top of production mode adding development gems. You can
enable them and turn Katello into development mode and enjoy all the
development mode features like autoloading or logging while maintaining the
environment. Development setup can be used in conjunction with a git checkout
either on the machine or on developers laptop. The usual practice is to develop
on a laptop and then using scp/ftp/rsync to overwrite files in
/usr/share/katello testing the features on the target environment.

This development setup runs under bundler_ext just like production mode does.
In this mode, Gemfile file is renamed to Gemfile.in and Katello loads all
dependencies using bundler_ext library rather than bundler. It requires all
necessary rubygems from the system ignoring versions specified in the Gemfilein
and if a dependency is missing, it fails. There is no "bundle install" command
avaiable in this mode and bundler_ext can be put in NOSTRICT mode where it
ignores missing dependencies (logging error messages) which can be useful for
development or installation phase (database migration or seed).

This setup works on supported platforms ({{{Fedora/Red Hat and clones}}}) and
it's the officially maintained by Katello developers - that means we will make
sure it is always working and we will be able to help you with issues on lists
and IRC channels.

You need to [wiki:Install install Katello first], please check requirements
sections and make sure installation is working properly. If you prefer fully
automatic installation, just run the following on a clean machine:

{{{
git clone git://github.com/lzap/ciauciau.git
echo 'PATH=$PATH:ciauciau/bin' >> ~/.bashrc
source ~/.bashrc
ciau -p kt
}}}

This gives you nightly production installation. Now, you want to enable
development gems and put Katello into development mode:

{{{
yum -y install katello-devel-all
}}}

Hint: If you only want development gems, install {{{katello-devel}}}, if you
only need testing gems install {{{katello-devel-test}}}. Possible packages are:

 * katello-devel-all (installs all groups bellow)
 * katello-devel (development rubygem group)
 * katello-devel-test (unit testing rubygem group)
 * katello-devel-profiling (profiling rubygem group)
 * katello-devel-jshintrb (javascript analysis rubygem group)

Warning: There is a missing dependency in the katello-devel-jshintrb
metapackage. It's recommended to install without this package: {{{yum -y
install katello-devel katello-devel-test katello-devel-profiling}}} until we
resolve the issue. You will only miss javascript analysis tool which is not
needed for development.

Uncomment, edit or add the following lines in {{{/etc/sysconfig/katello}}}:

{{{
KATELLO_ENV=development
KATELLO_LOGGING=debug
BUNDLER_EXT_GROUPS="development debugging test"
BUNDLER_EXT_NOSTRICT=1
}}}

Explanation of the variables:

 * KATELLO_ENV - Sets RAILS_ENV variable, basically you turning on autoloading
and other features of the development mode of Katello.
 * KATELLO_LOGGING - Turns on more verbose logging. Watch out because this is
very verbose and can load your instance quickly. There are also other logging
options in the file (SQL logging for instance).
 * BUNDLER_EXT_GROUPS - List of space separated bundler groups you want to
load. Usually you only need "development test" there. Open
/usr/share/katello/Gemfile.in to see all groups.
 * BUNDLER_EXT_NOSTRICT=1 - Puts bundler_ext in the NOSTRICT mode, that means
if it miss a dependency, it will still continue starting up the server. This
can be very useful when you miss a dependency (e.g. package does not exist yet)
or you want to test some rubygem on your own.

You may want to review other parameters in that file and also turn off firewall
and SELinux (this is optional but recommended):

{{{
setenforce 0
service iptables stop
}}}

You can restart katello service and enjoy fully development mode (e.g.
autoloading). Many developers use their IDE via SCP/FTP or rsyncing files or
simply editing via ssh.

{{{
service katello restart
}}}

Warning: It is not recommended to start the katello server on the foreground as
root, because this will likely break your installation (pid/temp files will be
created as root). Use startup script and tail appropriate files at will. Also,
if you overwrite many files, make sure you check the installation before
upgrade if you want to return to the RPM version: {{{rpm -qa | grep katello |
xargs rpm -V}}}.

Advantages of the RPM based development setup are:

 * Easy automation - deployment can be as short as 10 minutes with snap-guest.
 * It's close to the production environment.
 * You can switch back to production.
 * Possibility to overwrite with official builds from RPMs.
 * Possibility to upgrade to other version (next day nightly).
 * You can test SELinux.
 * Easy to understand and maintain.
 * Many of the Katello team are using this - easier to find help.

-- 
Later,

 Lukas "lzap" Zapletal
 #katello #systemengine




More information about the katello-devel mailing list