Snippets

DavidC pkgbox manual

You are viewing an old version of this snippet. View the current version.
Revised by David Cuddihy aa09acf

Set up pkgbox

Install Ubuntu 14.04 on a fresh VM

...Copy Dru's post, but:

  • Remove betabox part;
  • Make port-forwarding specifically reference -p 4022;
  • Maybe even make the hostname specific.

Set up keyless access to new VM.

...TODO.

Start VM

vboxmanage startvm aal-lpc-1-4 --type headless

Set up bbansible on host;

  1. Clone autonomy/bbansible --> cuddihyd/bbansible
  2. Check it out. (Alternative: apt-get install, have postinstall symlink /opt/bbansible/current/inventory/local to /opt/etc/me.acr/bbansible/inventory/local)
  3. cd /opt/bbansible/current

Confirm pkgbox reachable

ansible pkgbox -i inventory/local -a hostname -u ubuntu --ask-pass

Confirm that the hostname shown here matches what you expect for your VM.

Setup pkgbox

ansible-playbook -i inventory/local --ask-pass --become --ask-become-pass ./playbook.pkgbox.yml

...then enter s****t for password. Hit enter to use that for the sudo password as well.

Set up environment for packaging

use bbsage && bb-dot.sh bbsage --sync
checkoutmanage co betabox-trusty
sudo mkdir /opt/apt
sudo ln -s ${HOME}/hgdev/org.bitbucket/betabox-trusty/betabox-trusty.bitbucket.org /opt/apt/current

Add a line to /etc/apt/sources.list prior to the entry for betabox-trusty:

deb file:///opt/apt/current/ubuntu fimero main

Build Packages

First:

export FLAVOR=betabox

...Then:

  1. cd ~/hgdev/org.bitbucket/autonomy/bbsage && bb-package.sh
  2. cd ~/hgdev/org.bitbucket/autonomy/bbmint && bb-package.sh
  3. cd ~/hgdev/org.bitbucket/autonomy/bbdill && bb-package.sh
  4. cd ~/hgdev/org.bitbucket/autonomy/bbthyme && bb-package.sh
  5. cd ~/hgdev/org.bitbucket/autonomy/bbginger && bb-package.sh

Testing Packages install

sudo apt-get update
sudo apt-get install bbginger

Ensure no errors on install.

Smoke-Test Pystack

Try a few pystack commands to make sure it passes basic smoke-test:

use bbginger
use bbruntime

publish-list

export BBDILL_TX_HOST=rest.knyc.acr.lab
tx-get-quotable-id dl.fx.dxy

Unit-Test Pystack

Now that we have a clean VM with the dependencies as per the latest pystack-deb-packages only, we can unit-test:

  1. cd ~/hgdev/org.bitbucket/autonomy/bbmint/content/ && make opt-bbmint && make test
  2. cd ~/hgdev/org.bitbucket/autonomy/bbdill/content/ && make opt-bbdill && make test
  3. cd ~/hgdev/org.bitbucket/autonomy/bbthyme/content/ && make opt-bbthyme && make test
  4. cd ~/hgdev/org.bitbucket/autonomy/bbginger/content/ && make opt-bbginger && make test

Assuming you've already created a standard VM in which to do this work, here are the steps:

Prepare your work environment

These steps will turn your raw Ubuntu VM into a machine tuned for testing and packaging the pystack components.

  1. Make your VM comfortable -- Make yourself an account, add your SSH-keys for Bitbucket, install your favorite dev tools, etc.
  2. Install bbsage -- sudo apt-get install bbsage bbansible -- this will include all of the tools you need to build and package the pystack debs.
  3. Sync bbsage dotfiles -- You'll customize this VM for packaging so sync the bbsage dotfiles into your working directory: use bbsage && bb-dot bbsage --sync
  4. Retrieve betabox-trusty tree --
    1. cd ~/hgdev/org.bitbucket
    2. mkdir betabox-trusty
    3. hg clone ssh://hg@bitbucket.org/betabox-trusty/betabox-trusty.bitbucket.org
  5. Add local betabox-trusty tree to your /etc/apt/sources.list
    1. sudo mkdir /opt/apt
    2. `sudo ln -s ${HOME}/hgdev/org/bitbucket/betabox-trusty/ /opt/apt/current;
    3. Add a line prior to the other betabox-trusty entries like: deb file:///opt/apt/current/ubuntu fimero main
    4. sudo apt-get update
    5. sudo apt-get install bbginger

Test Packaging

We'll testing the packaging step first to ensure we have all of the prerequisite libraries install properly.

  1. Retrieve pystack source packages checkoutmanager co pystack-default (this works courtesy of bbsage dotfiles)
  2. Make debs -- This will create the debs and install them in your local reprepro tree:
    1. cd ~/hgdev/org.bitbucket/autonomy/bbsage && bb-package.sh
    2. cd ~/hgdev/org.bitbucket/autonomy/bbmint && bb-package.sh
    3. cd ~/hgdev/org.bitbucket/autonomy/bbdill && bb-package.sh
    4. cd ~/hgdev/org.bitbucket/autonomy/bbthyme && bb-package.sh
    5. cd ~/hgdev/org.bitbucket/autonomy/bbginger && bb-package.sh
  3. **Install
1
2
3
4
GATHERING FACTS *************************************************************** 
<localhost> ESTABLISH CONNECTION FOR USER: ubuntu
<localhost> REMOTE_MODULE setup
<localhost> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/dcuddihy/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=4022 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 localhost /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1441827395.99-73115243646185 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1441827395.99-73115243646185 && echo $HOME/.ansible/tmp/ansible-tmp-1441827395.99-73115243646185'
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.