Jump to: navigation, search

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

(Created page with "=== Set Up Your Own Development Environment using Vagrant + Devstack === You can set up your own demo environment to run your own installation of Solum with Devstack in a vagr...")
 
 
(27 intermediate revisions by one other user not shown)
Line 1: Line 1:
=== Set Up Your Own Development Environment using Vagrant + 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 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.
 
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
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 11: 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>
 +
 
 +
    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
  
4) Start the vagrant VM: vagrant up --provision
+
3) Set password for the new user
 +
    passwd solumuser
  
5) Enter the vagrant VM: vagrant ssh
+
4) Logout and login as the new user (solumuser)
  
6) If docker is not installed on the vagrant vm, follow these steps to install it:
+
5) Setup devstack
     echo deb http://get.docker.com/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list
+
     DEVSTACK_DIR="${HOME}/devstack"
     sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
+
     mkdir -p ${DEVSTACK_DIR}
    sudo apt-get install -y apt-transport-https
 
 
     sudo apt-get update
 
     sudo apt-get update
     sudo apt-get install -y lxc-docker-1.7.0
+
     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
  
7) The vagrant setup will start all the services except one of the nova services (n-cpu). This happens because
+
8) Run stack.sh
    the Nova needs to be configured to use the nova-docker driver. Use following steps to enable that:
+
     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
 
        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.
 
  
Notes:  
+
7) Follow the steps on (http://docs.openstack.org/developer/solum/getting_started/index.html) to build and deploy an app on Solum.
    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/)
 
  
=== Set Up Your Own Development Environment using Devstack ===
+
=== 3) Setting up on Windows ===
  
- Create a brand new VM and login as root
+
1) Install Virtualbox, Vagrant, git-bash
- Create non-root user
+
    - 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).
    - 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
+
2) Open git-bash terminal
- cd /opt/stack/nova-docker
 
- sudo git checkout 7e55fd551ef4faf3499a8db056efc9535c20e434
 
  
- sudo git clone https://github.com/openstack/nova.git /opt/stack/nova
+
3) Follow steps from the Vagrant setup listed above.
- cd /opt/stack/nova
 
- sudo git checkout 859ff4893f699b680fec4db7dedd3bec8c8d0a1c
 
  
- sudo git clone https://github.com/openstack/neutron.git /opt/stack/neutron
+
=== Troubleshooting ===
- cd /opt/stack/neutron
+
1) Helpful screen commands
- sudo git checkout 775893bb7f61c4641acbcb4ae16edf16e0989c39
+
    - 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
  
- If docker is not installed on the vagrant vm, follow these steps to install it:
+
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
- sudo apt-get install -y apt-transport-https
+
    sudo apt-get install -y apt-transport-https
- sudo apt-get update
+
    sudo apt-get update
- sudo apt-get install -y lxc-docker-1.7.0
+
    sudo apt-get install -y lxc-docker-1.7.0
  
- cd ${DEVSTACK_DIR}
+
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.
- sudo apt-get install -y python-pip
+
     Edit /etc/nova/nova.conf and add following lines:
- chmod -R 777 ${DEVSTACK_DIR}
+
    compute_driver = novadocker.virt.docker.driver.DockerDriver
- ./stack.sh
+
    Change the scheduler_driver variable from 'filter_scheduler' to  
  - When prompted, enter desired password
+
    scheduler_driver = nova.scheduler.filter_scheduler.FilterScheduler
  - 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
 
     - Install nova-docker
 
       - cd /opt/stack/nova-docker
 
       - cd /opt/stack/nova-docker
Line 107: Line 114:
 
     - Go to n-* screens and restart them if they have failed.
 
     - Go to n-* screens and restart them if they have failed.
  
- Follow the steps given here:
+
  Note:
    - http://docs.openstack.org/developer/solum/getting_started/index.html
+
  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.
 
 
[1] https://raw.githubusercontent.com/devdattakulkarni/solum-provenance/master/local.conf
 
  
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