📜 ⬆️ ⬇️

Setting up the development environment for OpenStack

About the OpenStack system there were a lot of articles on Habré, but none touched on the development and testing of composite services. I will say right away, it is not easy and not very gratifying to tune the environment with bare hands. Fortunately, there is an official program called Devstack , which is a set of scripts to automatically install OpenStack on a local virtual machine. Well, I would like to finish the article here, but not everything is so smooth with this Devstack. Namely, to install it is a whole process of dancing with tambourines and choosing the right configuration parameters. In addition, the project is moving its own step, and what worked today can take off with any new committee.

Task


It is necessary to build a development environment for OpenStack for testing, bugfixing and adding features to the system services (nova, keystone, swift, heat, etc.). The environment should be built almost automatically, so that it is possible at any time to erase the created virtual machine, create a new one, run scripts and get the environment ready in a few minutes. And the environment should be the same as on the previous VM. Since the service of interest to me at the time of writing this article is heat, the configuration will be oriented to it, but by replacing a pair of lines you can adapt the entire configuration to any other service.

We collect


For assembly in the arsenal should be the following tools: VirtualBox, Vagrant. Everything else must be delivered by itself. I compiled on OSX 10.9.2, but I think there should be no problems with other * nix OSs.

Virtualbox

Everything is simple, go to www.virtualbox.org , download the release for your operating system and install. I put 4.3.8 for Vagrant sometimes spits on 4.2. *, Threatening to put nfs wrong.
')
Vagrant

We put Vagrant version 1.3.5 (note, when installing any other version, nfs is not guaranteed to work) and create a directory where we will store our environment, say / home / user / devstack. Put the Vagrantfile file in the folder with the following content:

-- mode: ruby -- vi: set ft=ruby : Vagrant config VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "heat" config.vm.box_url = "http://files.vagrantup.com/precise32.box" #    VM  2048MB config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "2048"] end #     Horizon config.vm.network :forwarded_port, guest: 80, host: 8080 #  IP ,  NFS config.vm.network :private_network, ip: "192.168.11.10" #  /opt/stack c  /home/user/devstack. config.vm.synced_folder "/home/user/devstack", "/opt/stack", nfs:true end 


Save the file, go to / home / user / devstack and build the VM
 vagrant up 

We get access to VM
 vagrant ssh 

We can now go directly to installing packages and the devstack itself. Since the machine we received is completely empty, we must put everything ourselves.

 sudo apt-get update && sudo apt-get -y install git vim-gtk libxml2-dev libxslt1-dev libpq-dev python-pip libsqlite3-dev && sudo apt-get -y build-dep python-mysqldb && sudo pip install git-review tox && git clone git://git.openstack.org/openstack-dev/devstack -b stable/havana && chown -R vagrant:vagrant devstack && cd devstack 


Congratulations, you now have a non-configured but stable devstack release havana.

Devstack

Devstack can be customized as you like. The configuration is quite flexible, and sometimes confusing. I’ve put together a configuration that puts all the stable (havana) OpenStack services, except heat. Make sure that you are in the devstack folder and create a local.conf file (you can also use localrc, devstack to work with both)

 #, ... ADMIN_PASSWORD=devstack MYSQL_PASSWORD=devstack RABBIT_PASSWORD=devstack SERVICE_PASSWORD=devstack SERVICE_TOKEN=devstack #   #RECLONE=yes #OFFLINE=True # Swift #SWIFT_REPLICAS=1 #SWIFT_HASH=011688b44136573e209e #   HOST_IP=192.168.11.10 HOST_IP_IFACE=eth1 FLAT_INTERFACE=br100 PUBLIC_INTERFACE=eth1 FLOATING_RANGE=192.168.11.224/27 #   LOGFILE=/opt/stack/logs/stack.sh.log VERBOSE=True LOG_COLOR=True SCREEN_LOGDIR=/opt/stack/logs #      NOVA_BRANCH=stable/havana CINDER_BRANCH=stable/havana GLANCE_BRANCH=stable/havana HORIZON_BRANCH=stable/havana KEYSTONE_BRANCH=stable/havana NEUTRON_BRANCH=stable/havana SWIFT_BRANCH=stable/havana HEAT_BRANCH=stable/havana CEILOMETER_BRANCH=stable/havana # Horizon ENABLED_SERVICES+=,horizon #  Heat (master branch) HEAT_REPO=https://github.com/openstack/heat.git HEAT_BRANCH=master #   ##   Neutron disable_service n-net enable_service q-svc enable_service q-agt enable_service q-dhcp enable_service q-l3 enable_service q-meta enable_service neutron #  Cinder disable_service cinder disable_service c-api disable_service c-sch disable_service c-vol ##   Swift,      :) #enable_service s-proxy s-object s-container s-account ##  Heat ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2" IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" ##  Ceilometer #   ,     ,       - postgres #CEILOMETER_BACKEND=mongo ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api ENABLED_SERVICES+=,ceilometer-alarm-notify,ceilometer-alarm-eva 

Make sure your HOST_IP matches the value of private_network ip in the Vagrantfile.
I remind the working version of the software for this configuration: VirtualBox 4.3.8, Vagrant 1.3.5

Look like that's it. Save the file and run ./stack.sh. Everything is going for quite a long time, considering that Heat pumps two disk images for testing. But this can be easily removed if the focus is not on heat, but on another service.
These configs on GitHub: github.com/sorantis/stackenv
Questions, suggestions, leave in the comments, I will be glad to bring the whole process to a one-click button!

PS If the article turned out to be useful to someone, then I can continue to share my experience here.

Source: https://habr.com/ru/post/216849/


All Articles