Commands to copy/paste to deploy LAVA

You can use this series of commands to create your own local instance of LAVA; create a default QEMU device/device-type, create sample testscript and create and schedule your first LAVA job.

It is recommended that you perform this on a clean system or in a VM as the LAVA install could overwrite some of your data. You can perform these steps in a VM (one provided below), natively on your system. It is also better to ssh into the VM to insure you can paste easily.

Ubuntu 12.04 has been tested

Commands for copy and paste

Get BZR

   1 # install bzr
   2  sudo apt-get install bzr -y


# You may want to login # bzr launchpad-login <launchpad.net login id>


Download lava-deployment-tool and install your instance

   1 # get lava-deployment-tool
   2  bzr branch lp:lava-deployment-tool
   3  cd lava-deployment-tool
   4 
   5 # setup the system
   6  ./lava-deployment-tool setup -n
   7 
   8 # install lava instance
   9  ./lava-deployment-tool install -n mylava

Create a super user (u:admin/p:admin)

   1 adminuser=admin
   2 adminpass=admin
   3 adminemail=test@email.com
   4 
   5 expect -c 'spawn ~/lava-deployment-tool/lava-deployment-tool manage mylava createsuperuser; expect "):"; send "'$adminuser'\r"; expect "address:"; send "'$adminemail'\r"; expect "Password: "; send "'$adminuser'\r"; expect "Password (again): "; send "'$adminpass'\r"; expect #;'


Install lava-tool, create and retrieve your API key

   1 # install client tools
   2  sudo apt-get install lava-tool -y
   3 
   4 ### This section creates an API key
   5 lavaaddr=localhost
   6 lavaurl=http://$lavaaddr
   7 
   8 #obtain the csrf token
   9 data=$(curl -s -c cookies.txt $lavaurl/accounts/login/  | grep -o "name=['\"]csrfmiddlewaretoken['\"] value=['\"][^'\"]*" | sed -e "s/name='//" -e "s/' value='/=/")
  10 
  11 #login
  12 login=$data\&username=$adminuser\&password=$adminpass
  13 curl -b cookies.txt -c cookies.txt -d $login -X POST $lavaurl/accounts/login/
  14 
  15 #create an api key
  16 createapi=$data\&description=autogenerated
  17 curl -b cookies.txt -c cookies.txt -d $createapi -X POST $lavaurl/api/tokens/create/
  18 
  19 #get the api key(s)
  20 curl -b cookies.txt -c cookies.txt -d $data $lavaurl/api/tokens/ | grep secret
  21 
  22 # authenticate to the API
  23 


Copy and paste one of the keys (text between <code> and </code>

   1 api= #paste api key here
   2 
   3 expect -c 'spawn lava-tool auth-add http://'$adminuser'@'$lavaaddr'/RPC2/; expect "RPC2/:"; send "'$api'\r"; expect #'


# IF you are using a desktop Ubuntu installation, python and gnome keyring can cause problems if you execute over ssh. (gnomekeyring.IO error) To get around this you can configure the keyringrc.cfg file to use a file instead.


   1 mkdir -p ~/.cache/keyring ~/.local/share/python_keyring
   2 cat > ~/.local/share/python_keyring/keyringrc.cfg << EOF
   3 [backend]
   4 default-keyring=keyring.backend.CryptedFileKeyring
   5 keyring-path=~/.cache/keyring/
   6 EOF


create a bundle stream

   1 # create bundle stream
   2 lava-tool make-stream --dashboard-url http://$lavaaddr/RPC2/ /anonymous/test/

Test your new server

Platform/LAB/Copy-Paste/Deploy-LAVA-Server (last modified 2014-04-23 15:28:05)