Diff for "yellow/ParallelTestingSetupForDataCentre"

Not logged in - Log In / Register

Differences between revisions 2 and 6 (spanning 4 versions)
Revision 2 as of 2012-07-31 15:38:53
Size: 3823
Editor: bac
Comment:
Revision 6 as of 2012-07-31 16:16:59
Size: 4102
Editor: bac
Comment:
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
 1. Setup host using puppet (as above)
=== Setup host as root ===
Line 20: Line 22:
Make buildbot user/group as needed
# Some versions of LXC require the user to have a group. Bug #942850.
addgroup buildbot
usermod --gid buildbot buildbot
usermod -s /bin/sh buildbot
  1. Make buildbot user/group as needed<<BR>>{{{
    # Some versions of LXC require the user to have a group. Bug #942850.
    addgroup buildbot
    usermod --gid buildbot buildbot
    usermod -s /bin/sh buildbot
    }}}
  1. Generate ssh keys for buildbot user named {{{launchpad_lxc_id_rsa}}}
  1. {{{ssh-keyscan -t rsa bazaar.launchpad.net >> ~buildbot/.ssh/known_hosts}}}
  1. Add new public key to {{{~buildbot/.ssh/authorized_keys}}}
  1. Set up bzr whoami: {{{bzr whoami “Launchpad PQM <launchpad-pqm@canonical.com>“}}}
  1. Disable apparmor profiles for lxc:<<BR>>{{{
    ln -s /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/disable/
    apparmor_parser -R /etc/apparmor.d/usr.bin.lxc-start}}}
  1. Create /etc/lxc/lp-setup.conf:<<BR>>{{{
    lxc.network.type = veth
    lxc.network.link = lxcbr0
    lxc.network.flags = up
    }}}
  1. Create an LXC named “lptests”: {{{lxc-create -t ubuntu -n lptests -f /etc/lxc/lp-setup.conf -- -r lucid -a i386 -b buildbot}}}
  1. Authorize root connections to the LXC: <<BR>>{{{
    mkdir /var/lib/lxc/lptests/rootfs/root/.ssh
    cp ~buildbot/.ssh/authorized_keys /var/lib/lxc/lptests/rootfs/root/.ssh/
    }}}
  1. Append to {{{/var/lib/lxc/lptests/fstab}}} the line <<BR>>{{{
    none dev/shm tmpfs defaults 0 0}}}<<BR>>
  This step must be removed when {{{lucid}}} is no longer used as the LXC OS.
  1. Start the lxc: {{{lxc-start -n lptests -d}}}
  1. Wait for the LXC to start and accept connections.
  1. Install the three scripts needed by buildbot: {{{lp-setup-lxc-build, lp-setup-lxc-cleanup, and lp-setup-lxc-test}}}. They will go into /usr/local/bin.
  1. Create {{{/etc/sudoers.d/launchpad-buildbot}}} with the line<<BR>>{{{
 buildbot ALL = (ALL) NOPASSWD: /usr/local/bin/lp-setup-lxc-cleanup,
/usr/local/bin/lp-setup-lxc-build, /usr/local/bin/lp-setup-lxc-test}}}
  1. {{{chmod 0440 /etc/sudoers.d/launchpad-buildbot}}}
  1. Disable hardlink restriction (remove when Bug:944386 is resolved): <<BR>>{{{
    echo 0 > /proc/sys/kernel/yama/protected_nonaccess_hardlinks}}}
Line 26: Line 58:
Generate ssh keys for buildbot user named {{{launchpad_lxc_id_rsa}}}
{{{ssh-keyscan -t rsa bazaar.launchpad.net >> ~buildbot/.ssh/known_hosts}}}
Add new public key to {{{~buildbot/.ssh/authorized_keys}}}
Set up bzr whoami: {{{bzr whoami “Launchpad PQM <launchpad-pqm@canonical.com>“}}}
Disable apparmor profiles for lxc:
 {{{ln -s /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/disable/}}} and {{{apparmor_parser -R /etc/apparmor.d/usr.bin.lxc-start}}}

Create /etc/lxc/lp-setup.conf:
 {{{
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
}}}

Create an LXC named “lptests”: {{{lxc-create -t ubuntu -n lptests -f /etc/lxc/lp-setup.conf -- -r lucid -a i386 -b buildbot}}}
Authorize root connections to the LXC:
{{{
mkdir /var/lib/lxc/lptests/rootfs/root/.ssh
cp ~buildbot/.ssh/authorized_keys /var/lib/lxc/lptests/rootfs/root/.ssh/
}}}
Append to {{{/var/lib/lxc/lptests/fstab}}}
{{{
none dev/shm tmpfs defaults 0 0
}}}
This step must be removed when {{{lucid}}} is no longer used as the LXC OS.

Start the lxc: {{{lxc-start -n lptests -d}}}
Wait for the LXC to start and accept connections.
Install the three scripts needed by buildbot: {{{lp-setup-lxc-build, lp-setup-lxc-cleanup, and lp-setup-lxc-test}}}. They will go into /usr/local/bin.
Create {{{/etc/sudoers.d/launchpad-buildbot}}} with
 {{{buildbot ALL = (ALL) NOPASSWD: /usr/local/bin/lp-setup-lxc-cleanup,
/usr/local/bin/lp-setup-lxc-build, /usr/local/bin/lp-setup-lxc-test}}}

{{{chmod 0440 /etc/sudoers.d/launchpad-buildbot}}}
Disable hardlink restriction:
{{{echo 0 > /proc/sys/kernel/yama/protected_nonaccess_hardlinks}}}
 Remove when bug=lp:944386 is resolved.

Install lpsetup:
 {{{
=== Inside container as root ===
  1. Install lpsetup:<<BR>>{{{
Line 72: Line 66:
  1. Now use lpsetup to finish the provisioning of the container:<<BR>>{{{
    lp-setup init-host --yes -u buildbot -S launchpad_lxc_id_rsa --skip-steps setup_home}}}
Line 73: Line 69:
Now use lpsetup to finish the provisioning of the container:
{{{lp-setup init-host --yes -u buildbot -S launchpad_lxc_id_rsa --skip-steps setup_home}}}
=== Inside container as buildbot ===
  1. {{{lp-setup init-repo --yes --use-http --no-checkout}}}
  1. {{{lp-setup update ~buildbot/launchpad/lp-branches/devel --use-http}}}
Line 76: Line 73:
Inside container as buildbot
{{{lp-setup init-repo --yes --use-http --no-checkout}}}
{{{lp-setup update ~buildbot/launchpad/lp-branches/devel --use-http}}}
Inside container as root:
{{{lp-setup finish-init-host ~buildbot/launchpad/lp-branches/devel --user buildbot --yes}}}
{{{poweroff}}} If that doesn’t work {{{lxc-stop -n lptests}}} in the host.
=== Inside container as root, again ===
  1. {{{lp-setup finish-init-host ~buildbot/launchpad/lp-branches/devel --user buildbot --yes}}}
  1. {{{poweroff}}} If that doesn’t work {{{lxc-stop -n lptests}}} in the host.

Setting up the Launchpad machine for parallel testing

The Yellow Squad has developed a tool called lpsetup to replace the original rocketfuel-* scripts that were used by Launchpad developers to get the required pieces needed to begin contributing to Launchpad. While rocketfuel was written for that single purpose, lpsetup has another mission, which is to allow the complete set up and running of buildbot for parallel testing on EC2 or locally on LXC.

Create buildbot slave?

Assumptions

  • No use of the juju charms at all.
  • lpsetup can only be run inside the LXC.
  • Root changes on the host will only be done via puppet scripts written by IS.

Steps

Setup host as root

  1. Install required packages and PPAs

         apt-add-repository ppa:yellow/ppa
         apt-add-repository deb http://us.archive.ubuntu.com/ubuntu/ lucid main universe
         apt-get install ssh bzr apache2.2-common buildbot/lucid testrepository haveged subunit lxc libvirt-bin
  2. Install buildbot from lp:~launchpad/lpbuildbot/public/

  3. Make buildbot user/group as needed

        # Some versions of LXC require the user to have a group.  Bug #942850.
        addgroup buildbot
        usermod --gid buildbot buildbot
        usermod -s /bin/sh buildbot
  4. Generate ssh keys for buildbot user named launchpad_lxc_id_rsa

  5. ssh-keyscan -t rsa bazaar.launchpad.net >> ~buildbot/.ssh/known_hosts

  6. Add new public key to ~buildbot/.ssh/authorized_keys

  7. Set up bzr whoami: bzr whoami “Launchpad PQM  <launchpad-pqm@canonical.com>“

  8. Disable apparmor profiles for lxc:

        ln -s /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/disable/
        apparmor_parser -R /etc/apparmor.d/usr.bin.lxc-start
  9. Create /etc/lxc/lp-setup.conf:

        lxc.network.type = veth
        lxc.network.link = lxcbr0
        lxc.network.flags = up
  10. Create an LXC named “lptests”: lxc-create -t ubuntu -n lptests -f  /etc/lxc/lp-setup.conf -- -r lucid -a i386 -b buildbot

  11. Authorize root connections to the LXC:

        mkdir /var/lib/lxc/lptests/rootfs/root/.ssh
        cp ~buildbot/.ssh/authorized_keys /var/lib/lxc/lptests/rootfs/root/.ssh/
  12. Append to /var/lib/lxc/lptests/fstab the line

        none dev/shm tmpfs defaults 0 0


    This step must be removed when lucid is no longer used as the LXC OS.

  13. Start the lxc: lxc-start -n lptests -d

  14. Wait for the LXC to start and accept connections.
  15. Install the three scripts needed by buildbot: lp-setup-lxc-build, lp-setup-lxc-cleanup, and lp-setup-lxc-test. They will go into /usr/local/bin.

  16. Create /etc/sudoers.d/launchpad-buildbot with the line

            buildbot ALL = (ALL) NOPASSWD: /usr/local/bin/lp-setup-lxc-cleanup, 
    /usr/local/bin/lp-setup-lxc-build, /usr/local/bin/lp-setup-lxc-test
  17. chmod 0440 /etc/sudoers.d/launchpad-buildbot

  18. Disable hardlink restriction (remove when 944386 is resolved):

        echo 0 > /proc/sys/kernel/yama/protected_nonaccess_hardlinks

Inside container as root

  1. Install lpsetup:

            apt-get install python-software-properties
            add-apt-repository ppa:yellow/ppa
            apt-get clean && apt-get update
            apt-get upgrade
            apt-get install lpsetup
  2. Now use lpsetup to finish the provisioning of the container:

        lp-setup init-host --yes -u buildbot -S  launchpad_lxc_id_rsa --skip-steps setup_home

Inside container as buildbot

  1. lp-setup init-repo --yes --use-http --no-checkout

  2. lp-setup update ~buildbot/launchpad/lp-branches/devel --use-http

Inside container as root, again

  1. lp-setup finish-init-host ~buildbot/launchpad/lp-branches/devel --user buildbot --yes

  2. poweroff If that doesn’t work lxc-stop -n lptests in the host.

yellow/ParallelTestingSetupForDataCentre (last edited 2012-08-29 16:14:54 by frankban)