Jump to: navigation, search

Reddwarf-dev-env

Revision as of 11:44, 7 April 2013 by Dror-kagan (talk | contribs)

Reddwarf API and Redstack Dev Environment Set Up on Mac OS X

Intro

This article describes how to point a local running Reddwarf instance to a Devstack/Redstack deployment in a VM or Cloud instance. You should be able to debug and test your changes without having to deploy.

Prerequisites

Installing VMWare Fusion and Reddwarf services

VM

  1. In order to run reddwarf/redstack in a local VM, you need to start by installing a guest with Ubuntu 12.04 server. Download an image file from Ubuntu's web site (http://www.ubuntu.com/download/server) and create a new guest from it in your preferred virtualization solution (VMWare fusion, VirtualBox, Parallels, etc.)
    1. Recommended version ubuntu-12.04.1-server-amd64.iso
    2. Recommended RAM size is 2GB, but could probably work with 1GB if needed
    3. It seems no special network settings are needed in order to be able to access the guest from the host, the defaults work just fine
    4. It seems there is no need for the VMWare tools. They don't solve the copy/paste (or make working with the terminal any easier...) and we simply recommend using ssh instead. see details below.
    5. For better performance, make sure you go to the VM Settings -> Processors & Memory -> Advanced Options and check the "Enable hypervisor applications in this virtual machine" (see more about this at the bottom of this page: https://github.com/stackforge/reddwarf-integration)
    6. The full description of installing Redstack is described here: https://github.com/stackforge/reddwarf-integration/blob/master/README.md but we recommend you follow this path:
      1. When you set up the guest ubuntu, either create is with the 'ubuntu' user or add it:
        $ adduser ubuntu
        $ visudo
        1. Add this line to the file below the root user
          $ ubuntu  ALL=(ALL:ALL) ALL
          **OR use this if you dont want to type your password to sudo a command**
          $ ubuntu  ALL=(ALL:NOPASSWD) ALL
      2. Install ssh server on the guest:
        $ sudo apt-get install ssh (or openssh)
      3. Now, you can run ifconfig on the guest and get it's IP. Use that to ssh (as ubuntu) to it from your mac and continue working from there, it's easier ...
      4. Get git:
        $ apt-get update
        $ apt-get install git-core -y
      5. This is a good point to take a snapshot of this guest
      6. Clone this repo:
        $ git clone https://github.com/stackforge/reddwarf-integration.git
      7. Go into the scripts directory:
        $ cd reddwarf-integration/scripts/
        1. Install all the dependencies and then install reddwarf via devstack (this Brings up reddwarf (rd-api rd-tmgr) and initializes the reddwarf database)
          $ ./redstack install
      8. Since latest merges of Redstack in to Devstack, i'm not sure what is the exact state of the system at this point, since the screen session is already showing reddwarf-api and reddwarf-taskmanager as running in two of the screens. In any case you can "initialize" reddwarf by:
        1. running this, which encapsulate several calls:
          $ ./redstack kick-start mysql
        2. or running the steps manually:
          $ ./redstack build
          $ ./redstack test-init (used to be "initialize"?)
          $ ./redstack build-image mysql (or "percona")
        3. And starting it:
          $ ./redstack start
      9. For more information and usage see here: https://github.com/stackforge/reddwarf-integration/blob/master/README.md
    7. There used to be an issue with precise getting jammed. We're not sure if this is still the case, but if you get into such issues, please check the workaround described here:
      1. Installing Ubuntu Precise on VMWare Fusion http://wiki.openstack.org/vmware-fusion-precise (just use defaults)

Local Dev The main idea here, is to have reddwarf-api and/or reddwarf-taskmanager running locally on your mac (in a console or through your IDE so you can actually debug the code) but working against keystone/nova/swift/rabbit-mq/mysql that are all installed on your redstack node (installed above)

  1. First, get the code:
    $ git clone https://github.com/stackforge/reddwarf.git
  2. You'll need the have mysql client installed. If you don't have it already, install it using homebrew (running $ sudo pip install mysql-python would fail otherwise)
    1. Installing homebrew https://github.com/mxcl/homebrew/wiki/Installation
    2. Then install mysql
      $ brew install mysql
  3. You're going to use a dedicated python virtual env. Set it up and "activate" it like this:
    $ reddwarf/reddwarf/tools/install_venv.py
    $ source ./venv/bin/activate
  4. In your new env, install python-swiftclient and mysql-python:
    $ sudo pip install python-swiftclient
    $ sudo pip install mysql-python
  5. Due to some issue with openssl and cms (that doesn't work properly on a mac by default) you'll have to apply this fix:
    1. Download the openssl tar ball from http://www.openssl.org/source/
      1. openssl-1.0.1e.tar.gz seems to work fine: http://www.openssl.org/source/openssl-1.0.1e.tar.gz
    2. unzip it ($ tar xvzf filename) and follow the instruction here:
      1. Installing openssl on Mac OS X with cms enabled http://stackoverflow.com/questions/9275786/updating-openssl-version-on-osx
        1. basically, running:
          sudo ./Configure --prefix=/usr/ darwin64-x86_64-cc enable-cms
          $ sudo make
          $ sudo make test
          $ sudo make install
    3. As an alternative you can run
      brew install openssl
      and then back up and replace
      sudo cp /usr/bin/openssl /usr/bin/openssl_old; sudo cp /usr/local/Cellar/openssl/1.0.1e/bin/openssl /usr/bin/openssl; sudo chown root:wheel /usr/bin/openssl; sudo chmod 755 /usr/bin/openssl
  6. Depends on what you've done so far, you might need to "clean up" your env. If you encounter issues with keystone (authenticating) try this:
    1. Delete all .pem files under /tmp/keystone-signing-nova
    2. Delete all .pem files under /tmp/keystone-signing-reddwarf
    3. You might also have to delete ~/.apitoken

Configuring local reddwarf files

  1. Update the host entries in reddwarf.conf.sample & reddwarf-taskmanager.conf.sample to point to the Devstack/Redstack host (i.e. nova_compute_url, nova_volume_url, notifier_queue_hostname)
  2. Update the reddwarf-guestagent.conf.sample as well if you are going to be running this locally.
  3. Update the host entries in api-paste.ini to point to the Devstack/Redstack host (i.e. keystone)

Configure python virtualenv for reddwarf project

  1. $ cd reddwarf/tools
  2. $ ./install_venv
  3. In your IDE set up the reddwarf project to use the projects .venv as the interpreter

Running the reddwarf services locally

Reddwarf scripts currently expect to be run from the project root folder. Configure your IDE to do this.

  1. $ bin/reddwarf-api --config-file=etc/reddwarf/reddwarf.conf.sample (web service)
  2. $ bin/reddwarf-taskmanager --config-file=etc/reddwarf-taskmanager.conf.sample (task manager)
  3. $ bin/reddwarf-guestagent --config-file=etc/reddwarf-guestagent.conf.sample (guest agent)

Notes

  • If the services are not run in the project root the reddwarf/extensions will not be loaded.
  • If you are developing guest agent code you will probably still have to copy files to the VM Devstack/Redstack