Skip to content

Instantly share code, notes, and snippets.

@dtantsur
Last active August 29, 2015 13:57
Show Gist options
  • Save dtantsur/9525147 to your computer and use it in GitHub Desktop.
Save dtantsur/9525147 to your computer and use it in GitHub Desktop.
Bootstrap Tuskar and Tuskar UI
#!/bin/bash
set -ex
function checkout {
test -d $1 || git clone https://git.openstack.org/openstack/$1
cd $1
git checkout master
git pull --ff-only
cd ..
}
PASSWORD=$(grep OS_PASSWORD stackrc | cut -d= -f2)
sudo yum install python-devel swig openssl-devel python-pip mariadb-devel \
libxml2-devel libxslt-devel gcc python-virtualenv
sudo pip install tox==1.6.1 virtualenv==1.10.1 setuptools-git flake8 nose
checkout tuskar
checkout tuskar-ui
checkout horizon
checkout tripleo-heat-templates
sed "/heat_keystone/,+0a \
username = heat\n\
tenant_name = admin\n\
password=$PASSWORD\n\
auth_url = http://localhost:35357/v2.0\n\
insecure = True
/tht_local_dir/,+0a \
tht_local_dir=$(pwd)/tripleo-heat-templates
" tuskar/etc/tuskar/tuskar.conf.sample > tuskar/etc/tuskar/tuskar.conf
(
cd tuskar
tox -e py27 --notest
source .tox/py27/bin/activate
tuskar-dbsync --config-file etc/tuskar/tuskar.conf
ERR_FILE=$(mktemp)
tuskar-api --config-file etc/tuskar/tuskar.conf 2> $ERR_FILE &
sleep 1
TUSKAR_PID=$(pgrep tuskar-api)
trap "kill $TUSKAR_PID" EXIT
python tools/initial_data.py || grep -q "IntegrityError" $ERR_FILE
)
cd horizon
python tools/install_venv.py
tools/with_venv.sh pip install -r ../tuskar-ui/requirements.txt
tools/with_venv.sh pip install -e ../tuskar-ui/
cp ../tuskar-ui/local_settings.py.example openstack_dashboard/local/local_settings.py
cp ../tuskar-ui/_50_tuskar.py.example openstack_dashboard/local/enabled/_50_tuskar.py
sed -i 's/OPENSTACK_HOST = "127.0.0.1"/OPENSTACK_HOST = "192.0.2.3"/' \
openstack_dashboard/local/local_settings.py
cd ..
echo "#!/bin/sh" > run-tuskar.sh
echo "cd $(pwd)/tuskar && source .tox/py27/bin/activate && tuskar-api --config-file $(pwd)/tuskar/etc/tuskar/tuskar.conf" >> run-tuskar.sh
chmod +x run-tuskar.sh
echo "#!/bin/sh" > run-horizon.sh
echo "cd $(pwd)/horizon && tools/with_venv.sh ./manage.py runserver 0.0.0.0:8111" >> run-horizon.sh
chmod +x run-horizon.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment