Jump to: navigation, search

Solum/solum-development-setup

< Solum
Revision as of 17:15, 14 April 2016 by Devdattakulkarni (talk | contribs) (3) Setting up on Windows)

There are two options to setup Solum development environment. You can use Vagrant or you can directly setup Solum on Devstack. Below you will find the steps for both the options.

Our goal is to provide a consistent development environment for Solum. It has been our experience that using master branches of Solum's dependent services is not a good strategy towards our goal. In particular it has been our experience that Solum's development environment is affected by nova, nova-docker, and neutron. Therefore, in order to get a consistent development environment for Solum, we pin to specific commits of these services.

1) Vagrant

You can set up your own demo environment to run your own installation of Solum with Devstack in a vagrant box. This uses VirtualBox as the default provider, so it will work on a Mac or PC with Vagrant and VirtualBox loaded. This has been tested with the latest versions of Vagrant and VirtualBox.

1) Clone the vagrant repo: git clone https://github.com/rackerlabs/vagrant-solum-dev

2) Clone solum and python-solumclient repositories

   git clone https://github.com/openstack/solum.git
   git clone https://github.com/openstack/python-solumclient.git

3) Set SOLUM and SOLUMCLIENT environment variables

   export SOLUM=<path on Host system to solum repo>
   export SOLUMCLIENT=<path on Host system to python-solumclient repo>

4) Set SOLUM_IMAGE_FORMAT to docker

   export SOLUM_IMAGE_FORMAT=docker

4) Start the vagrant VM: vagrant up --provision

5) Enter the vagrant VM: vagrant ssh

8) Follow the steps from the getting_started guide (http://docs.openstack.org/developer/solum/getting_started/) to build and deploy an app on Solum.

2) Devstack

1) Create a brand new VM and login as root

2) Create non-root user

   useradd solumuser -m -d /home/solumuser -s /bin/bash
   visudo
   solumuser ALL=(ALL) NOPASSWD: ALL

3) Set password for the new user

    passwd solumuser

4) Logout and login as the new user (solumuser)

5) Setup devstack

   DEVSTACK_DIR="${HOME}/devstack"
   mkdir -p ${DEVSTACK_DIR}
   sudo apt-get update
   sudo apt-get install -y git python-pip
   sudo git clone https://git.openstack.org/openstack-dev/devstack.git ${DEVSTACK_DIR}
   cd ${DEVSTACK_DIR}
   wget https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf
   sudo chown -R solumuser ${DEVSTACK_DIR}
   sudo chgrp -R solumuser ${DEVSTACK_DIR}

6) Download nova

   sudo git clone https://github.com/openstack/nova.git /opt/stack/nova
   cd /opt/stack/nova
   sudo git checkout 859ff4893f699b680fec4db7dedd3bec8c8d0a1c

7) Download neutron

   sudo git clone https://github.com/openstack/neutron.git /opt/stack/neutron
   cd /opt/stack/neutron
   sudo git checkout 775893bb7f61c4641acbcb4ae16edf16e0989c39

8) Run stack.sh

   cd ${DEVSTACK_DIR}
   ./stack.sh
    When prompted, enter desired password

7) Follow the steps on (http://docs.openstack.org/developer/solum/getting_started/index.html) to build and deploy an app on Solum.


3) Setting up on Windows

1) Install Virtualbox, Vagrant, git-bash

   - When installing git-bash, make sure that you choose the option of using Unix style line endings (only LF) and not Windows style line endings (CRLF).

2) Open git-bash terminal

3) Follow steps from the Vagrant setup listed above.

Troubleshooting

1) Helpful screen commands

   - Attach to the screen session using 'screen -x stack'
   - Navigate between screens using following commands:
     - Cntrl a - n -> next screen
     - Cntrl a - p -> previous screen
     - Cntrl a - " -> see all the running screens

2) If docker is not installed on the vagrant vm, follow these steps to install it:

   echo deb http://get.docker.com/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list
   sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
   sudo apt-get install -y apt-transport-https
   sudo apt-get update
   sudo apt-get install -y lxc-docker-1.7.0

3) The vagrant setup may fail to start all the services except one of the nova services (n-cpu). This happens because Nova needs to be configured to use the nova-docker driver which does not happen by default in the vagrant setup. Use following steps to set the driver, install it, and then restart any failed nova services.

   Edit /etc/nova/nova.conf and add following lines:
   compute_driver = novadocker.virt.docker.driver.DockerDriver
   Change the scheduler_driver variable from 'filter_scheduler' to 
   scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
   - Install nova-docker
     - cd /opt/stack/nova-docker
     - sudo python setup.py install
   - Add current user to the docker group and change permissions of the unix docker socket
     - sudo gpasswd -a ${USER} docker
     - sudo chmod o=rwx /var/run/docker.sock
   - Copy docker filters to /etc/nova/rootwrap.d/
     - sudo cp /opt/stack/nova-docker/etc/nova/rootwrap.d/docker.filters /etc/nova/rootwrap.d/.
   - Go to n-* screens and restart them if they have failed.
  Note:
  We are currently granting rwx permissions for 'others' to the unix docker socket. We need to investigate what is the least amount of permissions required and only grant those   permissions.

4) In case the development environment fails with errors in nova screens then one way to get around the issues is to use specific versions of nova, nova-docker, and and neutron as specified below:

   Download nova-docker
   sudo git clone https://github.com/openstack/nova-docker.git /opt/stack/nova-docker
   cd /opt/stack/nova-docker
   sudo git checkout 7e55fd551ef4faf3499a8db056efc9535c20e434