DevStack, as we have already discussed, is a script that installs the other OpenStack components in a development environment. There are several modes in which DevStack can be installed, but the only thoroughly tested mode is the All-In-One Single box installation.
The DevStack script itself is located on the GitHub and needs to be pulled from there. This ensures that we always have the latest script.
DevStack can be downloaded by the git clone
command. We will clone that in our home directory.
cd ~ git clone https://git.openstack.org/openstack-dev/devstack
This will clone the DevStack project onto the local devstack
folder. Since we are using a proxy server, this may not work right off the bat. If you don't have a proxy server, then you can skip this section.
In order to make git
work with a proxy, we will use corkscrew. We will need the following information:
Name |
Value |
---|---|
Proxy IP |
172.21.2.17 |
Proxy port |
80 |
Proxy username |
NA |
Proxy password |
NA |
In order to perform a read-only operation, we will need to create a file in some location; in our case, we will create a file, mygitproxy.sh
, in our home directory.
We will need to add the following lines to the file and set it in the proxy configuration of git
:
#!/bin/bash exec corkscrew <Proxy IP> <Proxy Port> $*
In our case, we will create the file and substitute our proxy IP and proxy port. Copying and pasting the following will create the file called mygitproxy.sh
and the contents of the file are delimited using the EOT
:
cat <<EOT >> /home/alokas/mygitproxy.sh #!/bin/bash exec corkscrew 172.21.2.17 80 $* EOT
We also have to change the permission for this file to be executable by using the chmod
command.
chmod +x /home/alokas/mygitproxy.sh
The contents of the file are as shown in the following screenshot:
As a last step, we have to now change the git
global configuration to use this file, which is done by using the following command:
git config --global core.gitproxy '/home/alokas/mygitproxy.sh'
We also have to set the environment variables: http_proxy, https_proxy
and no_proxy
.
export http_proxy=http://172.21.2.17:80 export https_proxy=http://172.21.2.17:80 export no_proxy=localhost,172.22.6.0/24
The http
and https_proxy
commands set the proxies to be used and no_proxy
is used to ignore the proxy. We will need to provide the details of our local networks, so that the local connections are not proxied.
We should now be able to execute the git clone
command that was mentioned in the earlier section (cd ~ && git clone https://git.openstack.org/openstack-dev/devstack
).
The devstack
repository is now cloned onto your local environment. Please change to that directory by typing the command:
cd ~/devstack
We are now in the DevStack
directory, which we have just cloned from git
.
Once in the directory, you will see several files and scripts. Although it is not necessary to know what these scripts do in detail, it is definitely a good idea to know the contents.
Being the most important script in the directory, stack.sh
is used to install the different components of OpenStack. This script allows us to specify configuration options of which git
repositories to use, what are the services you want to be enabled in your environment, and their network configurations and so on. It uses a configuration file called stackrc
for this purpose, which has most of the user configuration information.
As the name suggests, unstack.sh
is used to stop all OpenStack services except common services like MySQL and RabbitMQ.
The rejoin-stack.sh
script rejoins an existing screen, or re-creates a screen session from a previous run of stack.sh
. This is used after you have rebooted the server and would want to go back to where you left off. We will need to run this script and the VMs that we created and the data will be restored.
Please be advised that the rejoin stack doesn't actually power on the guest VMs running on OpenStack. You have to manually power them up from the Horizon dashboard or the CLI commands.
The run_test.sh
script runs tests on the entire project for any stray white spaces and major style formatting. We would use this if we were contributing to the DevStack code itself; however, in this book, we won't have much use for this script.
The function of this script is to run all the examples present in the devstack/exercises
directory and report on the results. The directory already has some scripts to demonstrate the capabilities of OpenStack; we may choose to add some more files in the directory.
DevStack uses the stackrc
file located in the base directory. However, the settings of stackrc
can be overridden by the local.conf
file if placed in the root directory. A copy of the local.conf
file can be found in the samples directory.
By default, the following services will be installed when running DevStack:
We can also install other components like Swift, Heat, Ceilometer, Trove, and so on by modifying the stackrc
file or the localrc
file.
Although Tempest is going to be installed, we will not be using it in this book as we are not going to be developing anything in OpenStack itself.
Before we start configuring the local.conf
file in order to provide the install and configure options to the stack.sh
script, here are a few things that we need to keep handy for us to modify:
Name |
Name in config file |
Value |
---|---|---|
Password for MySQL root user |
|
|
Password for RabbitMQ |
|
|
Passwords for different OpenStack service accounts |
|
|
Password for admin account |
|
|
Random service token |
|
|
IP range for instances |
|
|
Floating IP range |
|
|
Interface |
|
|
Number of IPs in the range for instances |
|
|
This is all the information we need to get started. Please note that in this case, we are using Nova networking and a simple flat network, where all the instances will be connected to the same bridge and can talk to each other.
If we do decide to use Neutron networking, then some additional settings need to be added.
The localrc
settings need to look like the following:
FLOATING_RANGE=192.168.1.0/27 FIXED_RANGE=10.1.10.0/24 FIXED_NETWORK_SIZE=256 FLAT_INTERFACE=eth0 ADMIN_PASSWORD=adm1npwd DATABASE_PASSWORD=dbr00tpwd RABBIT_PASSWORD=rabb1tpwd SERVICE_PASSWORD=oss3rvice SERVICE_TOKEN=x1y1z1token
Please ensure there are no spaces between the equal sign and the values themselves, otherwise the script will fail midway.
Assuming that you have also cloned devstack
in your home directory, let us change the directory.
cd ~/devstack cp samples/local.conf ./
You should see the local.conf
file copied to the base directory. This will be the only file we need to edit in order to install.
Under the [[local|localrc]]
section, we have to modify the settings with the values that we have just defined. After the edit, the file will look like the following screenshot:
As a final step, we will enable Trove and Swift (for database backups). The following commands will append the lines between the delimiters (EOF) to the local.conf
file.
Before executing the command, let us take a look at how this all works. ENABLED_SERVICES
is an array, which is used by the stack.sh
script to install and configure the different OpenStack services. +=
appends to the array and -=
takes away from the array.
So essentially, we enable the Swift and Trove services. We also enable the installation of the Trove client by enabling the plugin:
cd ~/devstack cat <<EOF >> local.conf ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond enable_plugin trove git://git.openstack.org/openstack/trove enable_plugin python-troveclient git://git.openstack.org/openstack/python-troveclient ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account EOF
Enabling Neutron
Optionally, we can enable Neutron networking by adding the following lines to the local.conf
:
ENABLED_SERVICES +=,neutron,q-meta,q-l3,q-dhcp,q-agt,q-svc
ENABLED_SERVICES -= n-net
This simply enables the Neutron services and disables the Nova networking service. But, for the sake of simplicity, we will not be using Neutron in this book.
That's it, we are now ready to install DevStack in our environment.
DevStack is normally installed with a single command. However, this takes a very long time to complete and, in order to save ourselves the trouble of being disconnected from the SSH session and having to restart the entire install, we will use screen.
Screen is a program that helps to open several terminal instances on one single physical terminal instance.
We will start a screen session and run the installer (typing the screen
command starts a new screen session).
screen cd ~/devstack ./stack.sh
You can then either monitor the progress or disconnect from the screen (by pressing Ctrl + A and Ctrl + D ) and let the process run on the backend. When you want to go back to the screen, please type screen –r
(to reconnect).
Running the stack.sh
script will run several things and will install the OpenStack components that have been selected in the stackrc
file. However, since we are using a proxy server, we have to make some simple additional changes before we can run with it.
Please follow this section only while using a proxy server to install DevStack, otherwise, skip it completely.
We need to make the following changes:
GIT_BASE
to the local section of the local.conf
fileWe can export the proxy variables as we did in the previous section when we were cloning DevStack itself.
export http_proxy=http://172.21.2.17:80 export https_proxy=http://172.21.2.17:80 export no_proxy=localhost,172.22.6.0/24
Using your favorite editor, go ahead and edit the local.conf
file (as we did in the previous section); add a line as shown:
GIT_BASE=http://github.com
The local.conf
file will have the contents as shown in the following screen capture:
Once this is complete, we can now just run the stack.sh
script, which will spew out a ton of output of the actions it is performing. Once that is complete, the script will give you the URLs to access your new OpenStack deployment.
Please use the same three commands mentioned to start the installation.
screen cd ~/devstack ./stack.sh
The script will start the installation as shown in the following screen capture:
During the process of the installation, it may ask you for your password for the sudoers access and any other passwords that you may not have specified in the local.conf
file.
After this, depending on your Internet connection speed, you may have to wait for several minutes or hours for the packages to be downloaded and installed on your server.
The DevStack script clones all the different OpenStack components in the /opt/stack
folder. You can navigate to this folder and see what individual services are cloned in the individual folders under this base folder.
We will need to reconnect to the screen session to see the output if we have disconnected, by typing:
screen –r
During the installation, you will also see that there are additional screens that are started as the DevStack script (this screen is called stack).
In this case, we know that our screen is the one that is not stack, so we will connect to it by passing PID.TTY.Host
in the command as shown:
screen –r 2237.pts-0.DevStack
Once the installation is complete, the script will give an output in the following format:
Our stack in the box is ready. It should have installed Horizon, Nova, Keystone, Cinder, Trove, and Swift. We can now log in to the Horizon portal with the URL mentioned.
If we don't have any errors in the log file, the stack should be ready. However, let's complete a few quick verification tasks before we go to the next section.
The first thing that we will do is log in to the horizon portal, the URL of which has been outputted by the stack.sh
script. In our case, it is http://172.22.6.246/dashboard
. We need to be able to log in with the credentials that we choose in the configuration file.
Once you are able to log in, navigate to System | System Information. This screen should be able to show you the status of the components of OpenStack that were installed.
You should be able to see all the services that are installed and the hosts on which they are installed. Since this is a single node installation, all the services will be installed on the same server. However, if you have done a multi-node install, then we will be able to see multiple servers listed in the services.
Please feel free to navigate around the Horizon portal and explore it; you will see that there are two tenants that are created: admin tenant and demo tenant. The admin user will have access to both of the tenants.