Skip to content

Instantly share code, notes, and snippets.

@nellshamrell
Last active April 30, 2018 18:50
Show Gist options
  • Save nellshamrell/38ba48c17dac507a3936d6ecfd6d0a31 to your computer and use it in GitHub Desktop.
Save nellshamrell/38ba48c17dac507a3936d6ecfd6d0a31 to your computer and use it in GitHub Desktop.

Setup

  • Spin up c4.4xlarge instance on AWS with 120 GB disk
  • SSH into the VM
  • Create new tmux session
$ tmux new -s base_plans
  • Install Habitat
$ curl https://raw.githubusercontent.com/habitat-sh/habitat/master/components/hab/install.sh | sudo bash
  • Import current secret core key with
$ hab origin key import
  • Check out correct branches
$ mkdir habitat-sh
$ cd habitat-sh
$ git clone https://github.com/habitat-sh/habitat.git
$ git clone https://github.com/habitat-sh/core-plans.git
$ (cd core-plans && git checkout fnichol/teh-futur)

Stage One

  • Enter Stage 1 studio
$ ./core-plans/bin/bootstrap/stage1-studio.sh enter
  • Build all the base plans in order
(studio) $ ./core-plans/bin/bootstrap/stage1-build-base-plans.sh
  • Exit the studio
(studio) $ exit
  • Save the Stage 1 artifacts
$ mv ./results ./results-stage1
  • Install the just built studio
$ sudo hab install ./results-stage1/core-hab-studio-*.hart

Stage Two

  • Get FQDN of hab-backline package
$ ls -1 ./results-stage1/core-hab-backline-*.hart
  • Set env variable for hab-backline studio
$ env HAB_STUDIO_BACKLINE_PKG=core/hab-backline/version/timestamp ./core-plans/bin/bootstrap/stage2-studio.sh new
  • Enter the stage two studio
$ ./core-plans/bin/bootstrap/stage2-studio.sh enter
  • Copy all stage1 packages into the artifact cache
(studio) $ cp ./results-stage1/*.hart /hab/cache/artifacts/
  • Install all stage1 packages
(studio) $ ls -1 /hab/cache/artifacts/*.hart | while read hart; do hab pkg install $hart; done
  • Build all base plans in order
(studio) $ ./core-plans/bin/bootstrap/stage2-build-base-plans.sh
  • Exit the studio
(studio) $ exit
  • Save the Stage 2 artifacts
$ mv ./results ./results-stage2

Stage Three

  • Install Ruby
$ sudo hab pkg install core/ruby
  • Calculate build order of remaining plans and exclude base plans
$ find core-plans habitat/components -name plan.sh \
  | $(hab pkg path core/ruby)/bin/ruby ./core-plans/bin/build-order.rb --without-base \
  | cut -d ' ' -f 2 \
  | grep -v '^$' \
  > stage3_world_order
  • Make a copy of the "master" list and use the working copy for building against
$ cp stage3_world_order stage3_world_order.working
  • Get FQDN of hab-backline package
$ ls -1 ./results-stage2/core-hab-backline-*.hart
  • Set up environmental variables for the stage 3 studio
$ env HAB_STUDIO_BACKLINE_PKG=core/hab-backline/version/timestamp ./core-plans/bin/bootstrap/stage3-studio.sh new
  • Enter the stage 3 studio
$ ./core-plans/bin/bootstrap/stage3-studio.sh enter
  • Copy all stage2 packages into the artifact cache
(studio) $ cp ./results-stage2/*.hart /hab/cache/artifacts/
  • Install all stage2 packages directly from the artifact cache
(studio) $ ls -1 /hab/cache/artifacts/*.hart | while read hart; do hab pkg install $hart; done
  • Build all plans in order OR
(studio) $ ./core-plans/bin/bootstrap/stage3-build-remaining-plans.sh stage3_world_order.working
  • Build individually
(studio) $ export NO_INSTALL_DEPS=true
(studio) $ build ./core-plans/your-plan
  • Exit the studio
(studio) $ exit
  • Save the stage3 artifacts
$ mv ./results ./results-stage3

Cleanup

$ ./core-plans/bin/bootstrap/stage1-studio.sh rm
$ ./core-plans/bin/bootstrap/stage2-studio.sh rm
$ ./core-plans/bin/bootstrap/stage3-studio.sh rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment