Jump to: navigation, search

Difference between revisions of "Tuskar/Devtest"

(Instructions)
(Instructions: Remove option 1)
Line 6: Line 6:
  
 
== Instructions ==
 
== Instructions ==
 +
 +
=== Setup devtest ===
 
All commands (unless otherwise specified) should be run as root, in a dedicated machine you will use for TripleO development. We will call this machine "the lab machine" or "the lab server". The setup has been tested with lab machines running Fedora 19.
 
All commands (unless otherwise specified) should be run as root, in a dedicated machine you will use for TripleO development. We will call this machine "the lab machine" or "the lab server". The setup has been tested with lab machines running Fedora 19.
  
Line 50: Line 52:
 
  export MORE_MACS=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 2 | tr '\r\n' ' ')
 
  export MORE_MACS=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 2 | tr '\r\n' ' ')
  
At this point, your devtest environment is configured. To proceed, you need to install Horizon and Tuskar-UI, since they are not installed by devtest. To do this, you have 2 options:
+
At this point, your devtest environment is configured. To proceed, you need to install Horizon and Tuskar-UI, since they are not installed by devtest.
* you can install and configure Horizon and Tuskar-UI in the undercloud
 
or
 
* you can install and configure Horizon and Tuskar-UI on the lab machine
 
 
 
=== Option 1: Horizon and Tuskar-UI in the undercloud ===
 
SSH into seed machine and flush iptables rules:
 
ssh root@192.0.2.1
 
iptables -F # or set NAT masqurade in iptables http://www.revsys.com/writings/quicktips/nat.html
 
exit
 
 
 
SSH into the undercloud and enable internet there:
 
ssh heat-admin@192.0.2.2
 
sudo -i
 
echo "nameserver 192.168.122.1" >> /etc/resolv.conf
 
 
 
Install and configure Horizon and Tuskar-UI:
 
easy_install pip
 
easy_install nose
 
cd /opt/stack
 
git clone git://github.com/openstack/horizon.git
 
git clone git://github.com/openstack/tuskar-ui.git
 
cd horizon
 
python tools/install_venv.py
 
./run_tests.sh
 
cp ../tuskar-ui/local_settings.py.example openstack_dashboard/local/local_settings.py
 
tools/with_venv.sh pip install -r ../tuskar-ui/requirements.txt
 
tools/with_venv.sh pip install -e ../tuskar-ui/
 
cp ../tuskar-ui/_50_tuskar.py.example openstack_dashboard/local/enabled/_50_tuskar.py
 
 
 
Open the port 8111 since that is where we will run the development web server:
 
iptables -F # or iptables -I INPUT -p tcp --dport 8111 -j ACCEPT
 
 
 
Start the server:
 
tools/with_venv.sh ./manage.py runserver 0.0.0.0:8111
 
 
 
Create an SSH tunnel so you can see the UI from your browser. This next command should be run ''on your local machine, replacing 'lab-machine' with the hostname of your lab machine'':
 
ssh -L 8111:192.0.2.2:8111 root@lab-machine
 
 
 
Now you can see the UI from your browser (you can find credentials for dashboard in undercloud machine in /root/stackrc):
 
localhost:8111
 
 
 
The rest of this section explains how to setup the sshfs, if you want to edit your code locally. All the commands below should be run ''on your local machine, replacing 'lab-machine' with the hostname of your lab machine'''.
 
First tunnel to lab machine on port 22:
 
ssh -L 2222:192.0.2.2:22 root@lab-machine
 
# add your local machine's public key to undercloud's /root/.ssh/authorized_keys
 
 
 
Then make sshfs from your local machine:
 
yum install -y sshfs && mkdir -p ~/devtest
 
sshfs -p 2222 root@localhost:/opt/stack/ ~/devtest
 
  
=== Option 2: Horizon and Tuskar-UI on the lab machine ===
+
=== Add Horizon and Tuskar-UI ===
 
Install and configure Horizon and Tuskar-UI:
 
Install and configure Horizon and Tuskar-UI:
 
  easy_install pip
 
  easy_install pip

Revision as of 13:15, 6 February 2014

Overview

Devtest is a script that creates a development environment for TripleO / Tuskar / TuskarUI development. Below you can find step-by-step instructions for setting up the environment using devtest. If you would like more information about how devtest works as well as the script itself, see the following links

However, following the steps below should lead to a complete functioning setup.

Instructions

Setup devtest

All commands (unless otherwise specified) should be run as root, in a dedicated machine you will use for TripleO development. We will call this machine "the lab machine" or "the lab server". The setup has been tested with lab machines running Fedora 19.

Note: You might want to move the location of the default libvirt storage pool. The default location is /var/lib/libvirt/images. Depending on your file system / partitions setup, there might not be enough space for images at this default location. To be on the safe side, you can move it to another location which has plenty of space. Below is an example how to move the default storage pool location to /home/images. If you are sure that there is enough space at the default location, you can skip this step.

mkdir /home/images
yum install -y libvirt
service libvirtd start
virsh pool-destroy default
virsh pool-undefine default
virsh pool-define-as default dir --target /home/images
virsh pool-start default
virsh pool-autostart default
service libvirtd restart

Install git and kvm. Installing kvm at this point sets the ownership of the /dev/kvm correctly (it should be owned by the root user and kvm group). If you don't do this, devtest will fail due to incorrectly set ownership of /dev/kvm.

yum -y install git kvm

Check access rights on /dev/kvm afterwards. If group is not kvm or group doesn't have rw on this file, execute the following commands and reboot:

chgrp kvm /dev/kvm
chmod g+rw /dev/kvm

Create devtest configuration file:

cat <<'EOF' > ~/.devtestrc
export NODE_CPU=1 NODE_MEM=4096 NODE_DISK=20 NODE_ARCH=amd64
export NODE_DIST="fedora selinux-permissive"
export DIB_RELEASE=19
export UNDERCLOUD_DIB_EXTRA_ARGS=""
export OVERCLOUD_DIB_EXTRA_ARGS=""
export OVERCLOUD_COMPUTESCALE=1
export TRIPLEO_CLEANUP=1
EOF

Clone the tripleo-incubator repo and run the devtest script:

export TRIPLEO_ROOT=~/tripleo
mkdir -p $TRIPLEO_ROOT
cd $TRIPLEO_ROOT
git clone https://git.openstack.org/openstack/tripleo-incubator
$TRIPLEO_ROOT/tripleo-incubator/scripts/devtest.sh --trash-my-machine
# wait around 2+ hours
# mawagner: if openvswitch fails to start, see https://bugzilla.redhat.com/show_bug.cgi?id=1006412 (or just mkdir /var/lock/subsys)

Create more baremetals, you can use their MAC addresses to register them from the UI later, so save the MACS somewhere

export MORE_MACS=$(create-nodes $NODE_CPU $NODE_MEM $NODE_DISK $NODE_ARCH 2 | tr '\r\n' ' ')

At this point, your devtest environment is configured. To proceed, you need to install Horizon and Tuskar-UI, since they are not installed by devtest.

Add Horizon and Tuskar-UI

Install and configure Horizon and Tuskar-UI:

easy_install pip
easy_install nose
mkdir -p /opt/stack && cd /opt/stack
git clone git://github.com/openstack/horizon.git 
git clone git://github.com/openstack/tuskar-ui.git
cd horizon
python tools/install_venv.py
./run_tests.sh
cp ../tuskar-ui/local_settings.py.example openstack_dashboard/local/local_settings.py
tools/with_venv.sh pip install -r ../tuskar-ui/requirements.txt
tools/with_venv.sh pip install -e ../tuskar-ui/
cp ../tuskar-ui/_50_tuskar.py.example openstack_dashboard/local/enabled/_50_tuskar.py

Copy /root/stackrc from the undercloud to the lab machine, change the OS_AUTH_URL to point to the undercloud, and source it:

ssh heat-admin@192.0.2.2 "sudo -i cat /root/stackrc" > /root/stackrc
sed -i 's/localhost:5000/192.0.2.2:5000/' /root/stackrc
source /root/stackrc

Configure OPENSTACK_HOST in horizon settings to point to the undercloud machine:

sed -i 's/OPENSTACK_HOST = "127.0.0.1"/OPENSTACK_HOST = "192.0.2.2"/' /opt/stack/horizon/openstack_dashboard/local/local_settings.py

Start the server:

tools/with_venv.sh ./manage.py runserver 0.0.0.0:8111

Now you can see the UI from your browser (you can find credentials for dashboard in undercloud machine in /root/stackrc):

lab-machine:8111

If you want to develop locally, you need only to mount the remote folder containing the code, in your local file system:

yum install -y sshfs && mkdir -p ~/devtest
sshfs root@lab-machine:/opt/stack/ ~/devtest