Jump to: navigation, search

Difference between revisions of "Tuskar/Devtest"

Line 53: Line 53:
 
  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.
+
At this point, your devtest environment is configured. To proceed, you need to install Tuskar, Horizon and Tuskar-UI, since they are not installed by devtest.
  
 
=== Install Tuskar ===
 
=== Install Tuskar ===
Line 66: Line 66:
 
  easy_install pip
 
  easy_install pip
 
  easy_install nose
 
  easy_install nose
 +
cd /opt/stack
 
  git clone git://github.com/openstack/horizon.git  
 
  git clone git://github.com/openstack/horizon.git  
 
  git clone git://github.com/openstack/tuskar-ui.git
 
  git clone git://github.com/openstack/tuskar-ui.git
Line 77: Line 78:
  
 
Copy /root/stackrc from the undercloud to the lab machine, change the OS_AUTH_URL to point to the undercloud, and source it:
 
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
+
  ssh heat-admin@192.0.2.3 "sudo -i cat /root/stackrc" > /root/stackrc
  sed -i 's/localhost:5000/192.0.2.2:5000/' /root/stackrc
+
  sed -i 's/localhost:5000/192.0.2.3:5000/' /root/stackrc
 
  source /root/stackrc
 
  source /root/stackrc
  
 
Configure OPENSTACK_HOST in horizon settings to point to the undercloud machine:
 
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
+
  sed -i 's/OPENSTACK_HOST = "127.0.0.1"/OPENSTACK_HOST = "192.0.2.3"/' /opt/stack/horizon/openstack_dashboard/local/local_settings.py
  
 
Start the server:
 
Start the server:

Revision as of 16:21, 17 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

source $TRIPLEO_ROOT/tripleorc
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 Tuskar, Horizon and Tuskar-UI, since they are not installed by devtest.

Install Tuskar

mkdir -p /opt/stack && cd /opt/stack
git clone https://git.openstack.org/openstack/tuskar

Follow the instructions here to complete the install: https://github.com/openstack/tuskar/blob/master/docs/INSTALL.rst. Make sure that you create the initial data.

Add Horizon and Tuskar-UI

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

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.3 "sudo -i cat /root/stackrc" > /root/stackrc
sed -i 's/localhost:5000/192.0.2.3: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.3"/' /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