Jump to: navigation, search

Difference between revisions of "Solum/solum-development-setup"

(Set Up Your Own Development Environment using Vagrant + Devstack)
(Set Up Your Own Development Environment using Vagrant + Devstack)
Line 1: Line 1:
=== Set Up Your Own Development Environment using Vagrant + Devstack ===
+
There are two options to setup Solum development environment on Devstack. You can use Vagrant or you can directly setup Solum on Devstack.
 +
The Vagrant setup will spin up a VM with all the required OpenStack services and Solum services in a devstack environment. Below you will find the steps for both the approaches.
 +
 
 +
Notes about the setup:
 +
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 option to get a consistent development environment for Solum. 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.
 +
 
 +
=== Set Up Your Own Development Environment using 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.
 
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.
  
Line 40: Line 46:
 
     - Go to n-* screens and restart them if they have failed.
 
     - Go to n-* screens and restart them if they have failed.
  
Notes:
 
    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 just grant those.
 
  
 
After this you can follow the steps from the getting_started guide (http://docs.openstack.org/developer/solum/getting_started/)
 
After this you can follow the steps from the getting_started guide (http://docs.openstack.org/developer/solum/getting_started/)

Revision as of 16:31, 4 April 2016

There are two options to setup Solum development environment on Devstack. You can use Vagrant or you can directly setup Solum on Devstack. The Vagrant setup will spin up a VM with all the required OpenStack services and Solum services in a devstack environment. Below you will find the steps for both the approaches.

Notes about the setup: 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 option to get a consistent development environment for Solum. 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.

Set Up Your Own Development Environment using 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.

Ideally, following steps should be sufficient:

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

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

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

5) Enter the vagrant VM: vagrant ssh

6) 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

7) The vagrant setup will 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. Use following steps to enable that:

   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.


After this you can follow the steps from the getting_started guide (http://docs.openstack.org/developer/solum/getting_started/)

Set Up Your Own Development Environment using Devstack

- Create a brand new VM and login as root - Create non-root user

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

- Set password for the new user

    - passwd solumuser

- Logout and login as the new user (solumuser) - DEVSTACK_DIR="${HOME}/devstack" - mkdir -p ${DEVSTACK_DIR} - sudo apt-get update - sudo apt-get install -y git - sudo git clone https://git.openstack.org/openstack-dev/devstack.git ${DEVSTACK_DIR} - cd ${DEVSTACK_DIR} - Get [1] and place it in ${DEVSTACK_DIR}

 - wget https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf

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

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

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

- 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

- cd ${DEVSTACK_DIR} - sudo apt-get install -y python-pip - chmod -R 777 ${DEVSTACK_DIR} - ./stack.sh

 - When prompted, enter desired password
 - This may fail to start all the services except one of the nova services (n-cpu). This happens because
   the Nova needs to be configured to use the nova-docker driver. The approach to get it
   to work involves following steps:
   - 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.

- Follow the steps given here:

    - http://docs.openstack.org/developer/solum/getting_started/index.html

[1] https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf

Notes: - We are currently granting rwx permissions for 'others' to the unix docker socket. We should

 investigate what is the least amount of permissions required and just grant those.