Jump to: navigation, search

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

(Set Up Your Own Development Environment using Devstack)
 
(19 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
There are two options to setup Solum development environment. You can use Vagrant or you can directly setup Solum on Devstack.
 
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 approaches.
+
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 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.
+
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 ===
 
=== 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.
 
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
+
1) Clone the vagrant repo
 +
    git clone https://github.com/rackerlabs/vagrant-solum-dev
  
 
2) Clone solum and python-solumclient repositories
 
2) Clone solum and python-solumclient repositories
Line 14: Line 15:
  
 
3) Set SOLUM and SOLUMCLIENT environment variables
 
3) Set SOLUM and SOLUMCLIENT environment variables
     SOLUM=<path on Host system to solum repo>
+
     export SOLUM=<path on Host system to solum repo>
     SOLUMCLIENT=<path on Host system to python-solumclient repo>
+
     export SOLUMCLIENT=<path on Host system to python-solumclient repo>
  
4) Start the vagrant VM: vagrant up --provision
+
    Find solum path using: cd solum; pwd
 +
    Find python-solumclient path using: cd python-solumclient; pwd
  
5) Enter the vagrant VM: vagrant ssh
+
4) Set SOLUM_IMAGE_FORMAT to docker
 +
    export SOLUM_IMAGE_FORMAT=docker
  
6) If docker is not installed on the vagrant vm, follow these steps to install it:
+
5) cd vagrant-solum-dev
    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
+
6) Start the vagrant VM: vagrant up --provision
    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:
+
7) Enter the vagrant VM: vagrant ssh
    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.
 
  
8) Follow the steps from the getting_started guide (http://docs.openstack.org/developer/solum/getting_started/) to build and deploy an app
+
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 ===
 
=== 2) Devstack ===
  
 
1) Create a brand new VM and login as root
 
1) Create a brand new VM and login as root
     Create non-root user
+
      
 +
2) Create non-root user
 
     useradd solumuser -m -d /home/solumuser -s /bin/bash
 
     useradd solumuser -m -d /home/solumuser -s /bin/bash
 
     visudo
 
     visudo
 
     solumuser ALL=(ALL) NOPASSWD: ALL
 
     solumuser ALL=(ALL) NOPASSWD: ALL
2) Set password for the new user
+
 
 +
3) Set password for the new user
 
     passwd solumuser
 
     passwd solumuser
3) Logout and login as the new user (solumuser)
 
  
4) Setup devstack
+
4) Logout and login as the new user (solumuser)
 +
 
 +
5) Setup devstack
 
     DEVSTACK_DIR="${HOME}/devstack"
 
     DEVSTACK_DIR="${HOME}/devstack"
 
     mkdir -p ${DEVSTACK_DIR}
 
     mkdir -p ${DEVSTACK_DIR}
 
     sudo apt-get update
 
     sudo apt-get update
     sudo apt-get install -y git
+
     sudo apt-get install -y git python-pip
 
     sudo git clone https://git.openstack.org/openstack-dev/devstack.git ${DEVSTACK_DIR}
 
     sudo git clone https://git.openstack.org/openstack-dev/devstack.git ${DEVSTACK_DIR}
 
     cd ${DEVSTACK_DIR}
 
     cd ${DEVSTACK_DIR}
 
     wget https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf
 
     wget https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf
- sudo apt-get install -y python-pip
+
    sudo chown -R solumuser ${DEVSTACK_DIR}
- chmod -R 777 ${DEVSTACK_DIR}
+
     sudo chgrp -R solumuser ${DEVSTACK_DIR}
 
 
5) 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
 
  
 
6) Download nova
 
6) Download nova
Line 82: Line 67:
 
     sudo git checkout 775893bb7f61c4641acbcb4ae16edf16e0989c39
 
     sudo git checkout 775893bb7f61c4641acbcb4ae16edf16e0989c39
  
8) If docker is not installed on the vagrant vm, follow these steps to install it:
+
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
 
     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-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
Line 89: Line 99:
 
     sudo apt-get install -y lxc-docker-1.7.0
 
     sudo apt-get install -y lxc-docker-1.7.0
  
9) Run stack.sh
+
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.
    cd ${DEVSTACK_DIR}
+
     Edit /etc/nova/nova.conf and add following lines:
    ./stack.sh
+
    compute_driver = novadocker.virt.docker.driver.DockerDriver
  - When prompted, enter desired password
+
    Change the scheduler_driver variable from 'filter_scheduler' to  
  - This may fail to start all the services except one of the nova services (n-cpu). This happens because
+
    scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
    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
 
     - Install nova-docker
 
       - cd /opt/stack/nova-docker
 
       - cd /opt/stack/nova-docker
Line 110: Line 114:
 
     - Go to n-* screens and restart them if they have failed.
 
     - Go to n-* screens and restart them if they have failed.
  
10) Follow the steps on (http://docs.openstack.org/developer/solum/getting_started/index.html) to build and deploy an app on Solum.
+
  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.
  
Notes:
+
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:
- 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.
+
    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

Latest revision as of 13:01, 8 September 2016

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>
   Find solum path using: cd solum; pwd
   Find python-solumclient path using: cd python-solumclient; pwd

4) Set SOLUM_IMAGE_FORMAT to docker

   export SOLUM_IMAGE_FORMAT=docker

5) cd vagrant-solum-dev

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

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