Saturday 8 June 2013

Setting up a Cloudstack Development environment

This process is detailed for Windows, OSX, Ubuntu and CentOS on the Cloudstack website. However I hit some issues when following them. Below I have documented my setup for future reference purposes.

My development environment is running on CentOS 6.4 which is installed within virtualbox. It has a host-only interface for communication with other VMs and the host, it has a NAT interface for getting internet access.

So lets start of by installing some required tools and dependencies:

 $ sudo yum install git java-1.6.0-openjdk java-1.6.0-openjdk-devel mysql mysql-server tomcat6 mkisofs gcc python python-setuptools openssh-clients wget

Add mysql server to auto start:

 $ sudo chkconfig mysqld start
 $ sudo service mysqld start

Install Maven:

 $ cd /usr/local/
 $ sudo wget http://www.us.apache.org/dist/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
 $ sudo tar -zxvf apache-maven-3.0.4-bin.tar.gz

Set environmental variables:

 $ echo export CATALINA_BASE=/usr/share/tomcat6 >> ~/.bashrc
 $ echo export CATALINA_HOME=/usr/share/tomcat6 >> ~/.bashrc
 $ echo export M2_HOME=/usr/local/apache-maven-3.0.4
 $ echo export PATH=${M2_HOME}/bin:${PATH} >> ~/.bashrc

Set maven options:

 $ echo export MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx1g" >> ~/.bashrc

Fix permissions:

 $ chown -R <user>:<group> $CATALINA_HOME

Generate ssh keys:

 $ ssh-keygen

Install python modules:

 $ sudo easy_install pip
 $ sudo pip install requests
 $ sudo pip install mysql-connector-python

Grab the code:

 $ mkdir ~/projects
 $ cd ~/projects
 $ git clone https://git-wip-us.apache.org/repos/asf/cloudstack.git

Build it:

 $ cd ~/projects/cloudstack
 $ mvn -P developer,systemvm clean install

Deploy the devcloud database:

 $ mvn -P developer -pl developer,tools/devcloud -Ddeploydb

If you have a root mysql password set just copy utils/conf/db.properties to utils/config/db.properties.override and insert it.

Run the management server:

 $ mvn -pl :cloud-client-ui jetty:run

Browse to http://localhost:8080/client and you should be able to login with the default credentials of admin and password.

Bring up devcloud:

If you haven't already done so create a host-only adapter on virtualbox and  disable its DHCP server.

Download the devcloud virtual appliance, import it and check that PAE/NX mode is enabled. Launch it and check that you can ping it on 192.168.56.10 on from your development box.

Deploy the devcloud configuration:

Make sure your management server and devcloud is running and execute the following from inside your Cloudstack source folder:

 $ mvn -P developer -pl tools/devcloud -Ddeploysvr

This will deploy the settings defined in tools/devcloud/devcloud.cfg. If you open the management ui and navigate over to the System VMs you should see them starting to come up.

I found having the http_proxy environmental variable set broke this from executing successfully. As a work around I just unset it before executing, export http_proxy="".

For more information see: https://cwiki.apache.org/CLOUDSTACK/devcloud.html

2 comments:

  1. Thanks for the detailed guide, think the cloudstack wiki is missing the steps for python modules
    ```
    $ sudo yum easy_install pip
    $ sudo pip install requests
    $ sudo pip install mysql-connector-python
    ```

    ReplyDelete
  2. Yeah that's spot on tsp, the OSX instructions mention it in the troubleshooting section.
    I found in some places it had the incorrect order for the starting of the management server and the deployment of the devcloud config.

    ReplyDelete