RSS

Category Archives: devstack

Swift Only with OpenStack DevStack on the Rackspace Cloud

devstackSwift is not installed by default when using OpenStack DevStack. Sometimes you want to install Swift only for some testing without all of the other services getting in the way. Here’s how to setup Swift (and Keystone for authentication) with DevStack on the Rackspace Cloud.

Instructions

  1. If you don’t have one already, Sign Up for an open cloud account
  2. Go to the Cloud Control Panel
  3. Click Create Server
    1. Name: devstack-swift
    2. Image: Ubuntu 12.04 LTS
    3. Size: 4GB RAM (you could probably get away with 2 GB)
  4. Click Create Server and note the password and IPv4 address (when it appears)
  5. When your server is Active, switch to a Terminal and run the following commands to create the stack user.
    1. ssh root@<IPv4 Address>
    2. adduser --gecos "" stack
    3. adduser stack sudo
    4. grep -q "^#includedir.*/etc/sudoers.d" /etc/sudoers || echo "#includedir /etc/sudoers.d" >> /etc/sudoers
    5. ( umask 226 && echo "stack ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/50_stack_sh )
    6. exit
  6. I create the stack user like this because I’ve found that there are permission issues with screen if you create a “dummy” stack user and just switch to the stack user from the root user.
  7. Now login as the stack user and setup Swift:
    1. ssh stack@<IPv4 Address>
    2. sudo apt-get -y update
    3. sudo apt-get -y install git
    4. git clone https://github.com/openstack-dev/devstack.git
    5. cd devstack
    6. vim localrc # copy in the contents of this one
    7. ./stack.sh
    8. screen -r stack
  8. When running stack.sh you might see an error message that reads “ERROR: at least one rpc backend must be enabled”. Don’t worry about it, Swift/Keystone doesn’t need an rpc (AMQP) backend. You can also ignore any ImportErrors.
  9. When DevStack is done you can point your OpenStack clients and jclouds dev env all at <IPv4 Address>
  10. When you’re done with your development/testing you can delete the server to save money and just start fresh next time

Coda

Just a quick post to get Swift only up and running quickly!

 
2 Comments

Posted by on February 18, 2013 in devstack, openstack, rackspace

 

OpenStack devstack on the Rackspace open cloud

devstackI’ve written about deploying devstack before in Contributing OpenStack Support to jclouds. That post covered running devstack locally in VirtualBox. I’ve been using that method for a while now but with a devstack env in VirtualBox, a jclouds dev env, browser, chat client, mail client, etc. etc. etc. all running on the same laptop it gets bogged down. I’m pretty sure I heard gears grinding and smoke was pouring out of the laptop at one point. I just don’t have the cores, RAM, and RPMs to run everything smoothly and you need smoothly or development starts to suck.

The biggest draw on resources is VirtualBox so it’s long past time to move that devstack VM to the cloud! Naturally I’m going to deploy on the Rackspace open cloud. It turns out this is significantly simpler/easier to do than deploying on VirtualBox.

Instructions

  1. If you don’t have one already, Sign Up for an open cloud account
  2. Go to the Cloud Control Panel
  3. Click Create Server
    1. Name: devstack-folsom
    2. Image: Ubuntu 12.04 LTS
    3. Size: 4GB RAM (you could probably get away with 2 GB)
  4. Click Create Server and note the password and IPv4 address (when it appears)
  5. When your server is Active, switch to a Terminal and run the following commands:
    1. ssh root@<IPv4 Address>
    2. apt-get update; apt-get install -y git
    3. git clone https://github.com/openstack-dev/devstack.git -b stable/folsom devstack/
    4. cd devstack/
    5. vim localrc # copy in the contents of this one
    6. ./stack.sh
  6. When devstack is done you can point your browser, OpenStack clients, and jclouds dev env all at <IPv4 Address>
  7. When you’re done with your development/testing you can delete the server to save money and just start fresh next time

Next

The next obvious thing to do is to automate the whole process above. I haven’t decided whether to do my own custom script or dive into something like CloudEnvy. Either way it needs to be automated but it’s always good to have the manual process documented to fall back on and understand everything end to end.

Coda

As you can see there are far fewer steps to creating a devstack env like this than on VirtualBox. There’s much less fiddling around with networking too. The big benefit for me though was the immediate increase in speed for the rest of my development tools on laptop.

 
6 Comments

Posted by on November 8, 2012 in devstack, jclouds, openstack, rackspace

 

Contributing OpenStack Support to jclouds

Guava

Update: Folsom instructions

jclouds is a popular cross-cloud toolkit that covers an impressive number of public and private cloud providers. OpenStack is among these providers and the OpenStack ecosystem benefits from good support in jclouds because it allows developers who are comfortable with Java or jclouds to easily adopt OpenStack and it enables hybrid cloud development. Likewise, jclouds benefits from good OpenStack support because OpenStack is a popular Infrastructure as a Service provider and already has deep roots in the open source community.

A number of times on the jclouds-dev mailing list and IRC I’ve seen developers who want to help contribute OpenStack support to jclouds but aren’t entirely sure about how to go about it. There are a number of things you need to get started.

  1. A jclouds development environment
  2. Some background on jclouds development
  3. An OpenStack test environment

jclouds dev env

To setup a jclouds development environment start at their Developer Resources page. From there the most relevant page is Contributing to the jclouds Code Base. If you’re an Eclipse user, you’ll want to check out Using Eclipse. Learning about Testing in jclouds is essential and the Additional References and Guides for Advanced Users also contains a wealth of design and implementation documentation. You might also want to browse through the jclouds-dev mailing list.

jclouds dev background

The foundation of jclouds is built upon Google’s general purpose library Guava and their lightweight dependency injection framework Guice. You don’t necessarily have to know these to start contributing but being aware of it and having the reference documentation on hand will be helpful. To talk to OpenStack’s RESTful web services jclouds uses the Java API for RESTful Web Services (JAX-RS).

OpenStack

For those unfamiliar with setting up an OpenStack dev/test env this can be a daunting task. There are a number of ways to do it and often it boils down to a developer’s preference on how they want to deploy it…so I’ll share my personal preference. :)

My OpenStack test env consists of VirtualBox running an Ubuntu 12.04 Server (Precise Pangolin) virtual machine with devstack. This guide assumes you’re comfortable installing Ubuntu on VirtualBox and know your way around the command line and git.

  1. Download and install VirtualBox
  2. The networking can be a bit tricky and I’ve already addressed this in the ServerFault question What is the correct network configuration for a devStack VM (virtualbox)?
  3. Download the 64-bit PC (AMD64) server install CD of Ubuntu 12.04 and create a VirtualBox VM with it
  4. Once it’s ready to go you should be able to login to it from your terminal
    1. ssh myusername@172.16.0.1
  5. Once logged in, take a break, and have a look at the instructions for devstack
  6. If you want a release branch of OpenStack (e.g. Essex, Folsom, etc.), you need to do things a little differently
    1. Essex:
    2. git clone https://github.com/openstack-dev/devstack.git -b stable/essex devstack/
    3. Folsom:
    4. git clone https://github.com/openstack-dev/devstack.git -b stable/folsom devstack/
    5. In the devstack/ directory create a localrc file that only uses release branches only
      1. Essex example
      2. Folsom example
  7. If you want the latest and greatest master branch of OpenStack, in the devstack/ directory, create a localrc file like this
  8. In both cases
    1. Change to your devstack directory
    2. Run stack.sh
    3. When it completes, configure Keystone to return the VM’s “public” IP
      1. Essex:
      2. sed -i "s#publicURL = http://10.0.2.15#publicURL = http://172.16.0.1#g" /etc/keystone/default_catalog.templates
      3. Folsom:
      4. mysql -uroot -pdevstack keystone
      5. update endpoint set extra = replace(extra, '"publicurl": "http://10.0.2.15', '"publicurl": "http://172.16.0.1') where instr(extra, '"publicurl": "http://10.0.2.15') > 0;
    4. Kill the existing screen session (that contains all of the OpenStack services)
      1. screen -X -S stack quit
    5. Restart screen (with all of the OpenStack services)
      1. screen -c stack-screenrc
  9. Outside of the VM, back on your local machine, you should now be able to follow the instructions in my post jclouds and OpenStack to verify that everything is working as expected
  10. Once you’ve verified it’s working, then port the jclouds and OpenStack example into your jclouds dev env and go from there

Coda

Clearly it’s non-trivial to get a full development/test environment like this up and running. However, the benefits are a healthier OpenStack ecosystem that’s inclusive of the many Java developers around the world.

This post was written on Mac OS X 10.7.4, Java 1.6.0, jclouds 1.5.1, and OpenStack Essex/master.

 
Leave a comment

Posted by on October 3, 2012 in devstack, java, jclouds, openstack

 
 
Follow

Get every new post delivered to your Inbox.