Skip to content

Instantly share code, notes, and snippets.

@johnpmitsch
Last active February 20, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpmitsch/d9e6bf57ab027fe98f01c15098489553 to your computer and use it in GitHub Desktop.
Save johnpmitsch/d9e6bf57ab027fe98f01c15098489553 to your computer and use it in GitHub Desktop.
Katello stable box demo

Katello stable development environment

First things first

Spin up the box time vagrant up centos7-katello-devel-stable

What is it?

The katello devel stable box is a forklift box that is guaranteed to spin up successfully with the most recently working Katello development environment.

Why create it?

The problem: If the playbook installing the development environment failed for any reason (dependency issues, installer changes, db migrations, etc..), developers were not able to spin up a development environment.

A side effect of this is developers kept environments around for a long time in fear they wouldn't be able to spin up a new one, often using outdated packages and environments.

Being able to spin up a development environment is something that should always be an option.

No lost afternoons trying to to rescue a broken dev box, no "works on my machine" because of outdated packages, no 6-month old dev environments

How does it work?

Traditional workflow

Traditionally, the workflow has been:

The box definition in forklift uses an ansible playbook on top of a published vagrant CentOS image.

locally:

  • run vagrant up which
  • downloads centos7 image from vagrant cloud
  • runs ansible playbook locally installing Katello development environment
  • box is created

A working environment is created only if the playbook succeeds, else it is not fully set up.

Stable box image creation and publishing workflow

The box image itself is the development environment

With the stable box:

on a separate server or CI system:

  • automated job uses packer to build a box image from a template
  • centos7 OS is bootstrapped
  • ansible playbook is run installing Katello devel environment
  • box image is published to Vagrant cloud only if the playbook succeeds.

locally:

  • run vagrant up
  • downloads latest katello-devel image
  • katello devel environment is ready.

Things to keep in mind

Important! You must update the underlying box image on subsequent spin-ups.

vagrant destroy centos7-katello-devel-stable
vagrant box update centos7-katello-devel-stable
vagrant up centos7-katello-devel-stable

At this time any personalizations, such as github remotes, are not configured on the box itself.

Its a good idea to update git branches, gems, npm packages, etc... especially if a box image hasn't been published in a while.

Personalizations

There is now a way to customize your development environment automatically on every spin up from a git repo or local directory. https://github.com/theforeman/forklift/blob/master/docs/development.md#customizing-the-development-environment

Use for copying over config files and running a setup script

Take-aways

  • centos7-katello-devel-stable: reliable and spins up fast
  • vagrant up the first time, vagrant box update then vagrant up any time after
  • Refer to forklift docs when in doubt or for reference
  • Can customize with your own dot files and scripts

Future

  • More stable boxes, such as centos7-katello-nightly-stable theforeman/forklift#1108
  • Move packer build jobs to jenkins
  • git remote customization
  • consistent certificates (since the hostname is now stable) that can be added to system + browser
  • Make stable box the main environment for development?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment