Last active
December 23, 2015 11:59
-
-
Save etoews/6632041 to your computer and use it in GitHub Desktop.
DevStack Tech Talk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# New non-root user | |
ssh root@<ip-address> | |
adduser --gecos "" stack | |
adduser stack sudo | |
exit | |
ssh stack@<ip-address> | |
# Install OpenStack Grizzly with DevStack | |
sudo apt-get install -y git | |
git clone https://github.com/openstack-dev/devstack.git -b stable/grizzly devstack/ | |
cd devstack/ | |
curl -sO https://gist.github.com/everett-toews/6629538/raw/c49ae2501ccd50147c3631f35437329397067e6e/localrc | |
more localrc | |
./stack.sh | |
# Wait...time for Q&A | |
# Go to the dashboard http://<ip-address> | |
# Username: demo | |
# Password: devstack | |
ls exercises/ | |
ls samples/ | |
ls tools/ | |
# Screen | |
screen -ls | |
screen -r stack | |
# Exit: Ctrl+a Ctrl+d | |
screen -r stack | |
# Jump to screen number: Ctrl+a <Number> | |
# Next screen: Ctrl+a Spacebar | |
# Scrollback: Ctrl+a Esc <PageUp/PageDn> | |
# Stop scrollback: Esc | |
# New screen: Ctrl+a c | |
# screen -X -S stack quit | |
# screen -c stack-screenrc | |
# Using curl & python | |
TOKEN=$(curl -s -X POST http://localhost:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"demo", "password":"devstack"}, "tenantName":"demo"}}' -H "Content-type: application/json" | python -c 'import json,sys; response=json.loads(sys.stdin.read()); print response["access"]["token"]["id"]') | |
echo $TOKEN | |
# Using curl & jq | |
sudo wget http://stedolan.github.io/jq/download/linux64/jq -O /usr/local/bin/jq | |
sudo chmod a+x /usr/local/bin/jq | |
TOKEN=$(curl -s -X POST http://localhost:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"demo", "password":"devstack"}, "tenantName":"demo"}}' -H "Content-type: application/json" | jq -r .access.token.id) | |
echo $TOKEN | |
# Using the command line interfaces | |
source /opt/stack/python-novaclient/tools/nova.bash_completion | |
source openrc demo demo | |
# Boot an instance | |
nova list | |
nova secgroup-create test test | |
nova secgroup-add-rule test TCP 22 22 0.0.0.0/0 | |
nova secgroup-add-rule test ICMP -1 -1 0.0.0.0/0 | |
nova keypair-add test > test.pem | |
chmod 400 test.pem | |
nova image-list | |
IMAGE_ID=$(nova image-list | egrep "cirros-.*-uec " | awk '{print $2}') | |
echo $IMAGE_ID | |
nova flavor-list | |
nova boot --flavor 1 --image $IMAGE_ID --key-name test --security-groups test test-vm | |
nova list | |
# For nova boot, all of the interactions that occur across services: | |
# 1. nova client makes a request over HTTP against the Identity service (keystone), passing username and password and getting a token | |
# 2. nova client makes a request over HTTP against the Compute service (nova-api) to create a new server. | |
# 3. nova-api makes a request over the message queue to nova-scheduler to run an instance. | |
# 4. nova-scheduler selects a compute host and makes a request over the message queue to nova-compute on that host to boot a new virtual machine instance. | |
# 5. nova-compute makes a request over the message queue to nova-network to do network configuration for the new instance. | |
# 6. nova-compute makes a request over HTTP against the Image Service (glance-api) for the virtual machine image file. | |
# 7. glance-api makes a request over HTTP against glance-registry to retrieve the file from the image backend. | |
ping 10.0.0.2 | |
ssh -i test.pem [email protected] | |
ls -al | |
exit | |
# Create an image | |
curl -O http://c250663.r63.cf1.rackcdn.com/centos60_x86_64.qcow2 | |
glance image-create --name="CentOS6" --container-format=bare --disk-format=qcow2 --is-public=True --file=centos60_x86_64.qcow2 | |
# Database | |
mysql -uroot -pdevstack | |
show databases; | |
use nova; | |
show tables; | |
desc instances; | |
select id, display_name from instances; | |
quit | |
# AMQP for RPC | |
sudo rabbitmqctl list_queues name | |
sudo rabbitmqctl list_exchanges name | |
# Go to the Rackspace Python SDK (pyrax) at http://developer.rackspace.com/#python | |
sudo pip install pyrax bpython | |
# To get the tenant id, paste it over <tenant-id> below | |
source openrc admin admin | |
keystone tenant-get demo | |
vim ~/.pyrax.cfg | |
[private] | |
identity_type = keystone | |
region = RegionOne | |
auth_endpoint = http://localhost:5000/v2.0/ | |
tenant_id = <tenant-id> | |
debug = True | |
bpython | |
import pyrax | |
pyrax.set_credentials("demo", "devstack") | |
pyrax.regions | |
pyrax.cloudservers.list() | |
pyrax.cloudservers.list_images() | |
# Clean up | |
source openrc demo demo | |
nova list | |
nova list | grep test | awk '{print $2}' | xargs -n 1 nova delete | |
# Swift only, start over with | |
curl -sO https://gist.github.com/everett-toews/6632691/raw/0951be59af1cd7c0d6f28b0415c82213c9f1e947/localrc | |
more localrc | |
# Going nuclear on your Cloud Files container on Rackspace | |
for region in DFW ORD IAD SYD; do export OS_REGION_NAME=$region; swift list | xargs -n 1 swift delete; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment