<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>DevStack - Overview</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le styles -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/local.css" rel="stylesheet">
    <style type="text/css">
      body { padding-top: 60px; }
      dd { padding: 10px; }
    </style>

    <!-- Le javascripts -->
    <script src="assets/js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="assets/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
  </head>

  <body>

    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="brand" href="/">DevStack</a>
          <ul class="nav pull-right">
            <li><a href="overview.html">Overview</a></li>
            <li><a href="changes.html">Changes</a></li>
            <li><a href="faq.html">FAQ</a></li>
            <li><a href="http://github.com/openstack-dev/devstack">GitHub</a></li>
            <li><a href="https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z">Gerrit</a></li>
          </ul>
        </div>
      </div>
    </div>

    <div class="container" id="home">

      <section id="overview" class="span12">

        <div class='row pull-left'>
          <h2>Configuration <small>Making it go my way</small></h2>
          <p>DevStack has always tried to be mostly-functional with a minimal amount of configuration.  The number of options has ballooned as projects add features, new projects added and more combinations need to be tested.  Historically DevStack obtained all local configuration and customizations from a <code>localrc</code> file.  The number of configuration variables that are simply passed-through to the individual project configuration files is also increasing.  The old mechanism for this (<code>EXTRAS_OPTS</code> and friends) required specific code for each file and did not scale well.</p>
          <p>In Oct 2013 a new configuration method was introduced (in <a href="https://review.openstack.org/#/c/46768/">review 46768</a>) to hopefully simplify this process and meet the following goals:</p>
          <ul>
            <li>contain all non-default local configuration in a single file</li>
            <li>be backward-compatible with <code>localrc</code> to smooth the transition process</li>
            <li>allow settings in arbitrary configuration files to be changed</li>
          </ul>

          <h3>local.conf</h3>
          <p>The new configuration file is <code>local.conf</code> and resides in the root DevStack directory like the old <code>localrc</code> file.  It is a modified INI format file that introduces a meta-section header to carry additional information regarding the configuration files to be changed.</p>

          <p>The new header is similar to a normal INI section header but with double brackets (<code>[[ ... ]]</code>) and two internal fields separated by a pipe (<code>|</code>):</p>
<pre>[[ &lt;phase&gt; | &lt;config-file-name&gt; ]]
</pre>

          <p>where <code>&lt;phase&gt;</code> is one of a set of phase names defined by <code>stack.sh</code> and <code>&lt;config-file-name&gt;</code> is the configuration filename.  The filename is eval'ed in the <code>stack.sh</code> context so all environment variables are available and may be used.  Using the project config file variables in the header is strongly suggested (see the <code>NOVA_CONF</code> example below).  If the path of the config file does not exist it is skipped.</p>

          <p>The defined phases are:</p>
          <ul>
            <li><strong>local</strong> - extracts <code>localrc</code> from <code>local.conf</code> before <code>stackrc</code> is sourced</li>
            <li><strong>pre-install</strong> - runs after the system packages are installed but before any of the source repositories are installed</li>
            <li><strong>install</strong> - runs immediately after the repo installations are complete</li>
            <li><strong>post-config</strong> - runs after the layer 2 services are configured and before they are started</li>
            <li><strong>extra</strong> - runs after services are started and before any files in <code>extra.d</code> are executed
          </ul>

          <p>The file is processed strictly in sequence; meta-sections may be specified more than once but if any settings are duplicated the last to appear in the file will be used.</p>
<pre>[[post-config|$NOVA_CONF]]
[DEFAULT]
use_syslog = True

[osapi_v3]
enabled = False
</pre>

          <p>A specific meta-section <code>local|localrc</code> is used to
          provide a default <code>localrc</code> file (actually
          <code>.localrc.auto</code>).  This allows all custom settings
          for DevStack to be contained in a single file.  If <code>localrc</code>
          exists it will be used instead to preserve backward-compatibility.  More
          details on the <a href="localrc.html">contents of localrc</a> are available.</p>
<pre>[[local|localrc]]
FIXED_RANGE=10.254.1.0/24
ADMIN_PASSWORD=speciale
LOGFILE=$DEST/logs/stack.sh.log
</pre>

          <p>Note that <code>Q_PLUGIN_CONF_FILE</code> is unique in that it is assumed to <em>NOT</em> start with a <code>/</code> (slash) character.  A slash will need to be added:</p>
<pre>[[post-config|/$Q_PLUGIN_CONF_FILE]]
</pre>

          <p>Also note that the <code>localrc</code> section is sourced as a shell script fragment amd <string>MUST</strong> conform to the shell requirements, specifically no whitespace around <code>=</code> (equals).</p>

          <a id="minimal"></a>
          <h3>Minimal Configuration</h3>
          <p>While <code>stack.sh</code> is happy to run without a <code>localrc</code> section in <code>local.conf</code>, devlife is better when there are a few minimal variables set. This is an example of a minimal configuration that touches the values that most often need to be set.</p>
          <ul>
            <li>no logging</li>
            <li>pre-set the passwords to prevent interactive prompts</li>
            <li>move network ranges away from the local network (<code>FIXED_RANGE</code> and <code>FLOATING_RANGE</code>, commented out below)</li>
            <li>set the host IP if detection is unreliable (<code>HOST_IP</code>, commented out below)</li>
          </ul>
          <pre>[[local|localrc]]
ADMIN_PASSWORD=secrete
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50
#FIXED_RANGE=172.31.1.0/24
#FLOATING_RANGE=192.168.20.0/25
#HOST_IP=10.3.4.5</pre>
          <p>If the <code>*_PASSWORD</code> variables are not set here you will be prompted to enter values for them by <code>stack.sh</code>.</p>
          <p>The network ranges must not overlap with any networks in use on the host.  Overlap is not uncommon as RFC-1918 'private' ranges are commonly used for both the local networking and Nova's fixed and floating ranges.</p>
          <p><code>HOST_IP</code> is normally detected on the first run of <code>stack.sh</code> but often is indeterminate on later runs due to the IP being moved from an Ethernet integace to a bridge on the host.  Setting it here also makes it available for <code>openrc</code> to set <code>OS_AUTH_URL</code>.  <code>HOST_IP</code> is not set by default.</p>

          <h3>Common Configuration Variables</h3>
          <dl>
            <dt>Set DevStack install directory</dt>
            <dd><em>Default: <code>DEST=/opt/stack</code></em><br />
            The DevStack install directory is set by the <code>DEST</code> variable. By setting it early in the <code>localrc</code> section you can reference it in later variables.  It can be useful to set it even though it is not changed from the default value.
            <pre>DEST=/opt/stack</pre></dd>

            <dt>stack.sh logging</dt>
            <dd><em>Defaults: <code>LOGFILE="" LOGDAYS=7 LOG_COLOR=True</code></em><br />
            By default <code>stack.sh</code> output is only written to the console where is runs.  It can be sent to a file in addition to the console by setting <code>LOGFILE</code> to the fully-qualified name of the destination log file.  A timestamp will be appended to the given filename for each run of <code>stack.sh</code>.
            <pre>LOGFILE=$DEST/logs/stack.sh.log</pre>
            Old log files are cleaned automatically if <code>LOGDAYS</code> is set to the number of days of old log files to keep.
            <pre>LOGDAYS=1</pre>
            The some of the project logs (Nova, Cinder, etc) will be colorized by default (if <code>SYSLOG</code> is not set below); this can be turned off by setting <code>LOG_COLOR</code> False.
            <pre>LOG_COLOR=False</pre></dd>

            <dt>Screen logging</dt>
            <dd><em>Default: <code>SCREEN_LOGDIR=""</code></em><br />
            By default DevStack runs the OpenStack services using <code>screen</code> which is useful for watching log and debug output.  However, in automated testing the interactive <code>screen</code> sessions may not be available after the fact; setting <code>SCREEN_LOGDIR</code> enables logging of the <code>screen</code> sessions in the specified diretory.  There will be one file per <code>screen</code> session named for the session name and a timestamp.  
            <pre>SCREEN_LOGDIR=$DEST/logs/screen</pre>
            <em>Note the use of <code>DEST</code> to locate the main install directory; this is why we suggest setting it in <code>local.conf</code>.</em></dd><br />

            <dt>One syslog to bind them all</dt>
            <dd><em>Default: <code>SYSLOG=False SYSLOG_HOST=$HOST_IP SYSLOG_PORT=516</code></em><br />
            Logging all services to a single syslog can be convenient.  Enable syslogging by setting <code>SYSLOG</code> to <code>True</code>. If the destination log host is not localhost <code>SYSLOG_HOST</code> and <code>SYSLOG_PORT</code> can be used to direct the message stream to the log host.
            <pre>SYSLOG=True
SYSLOG_HOST=$HOST_IP
SYSLOG_PORT=516</pre></dd>

            <dt>A clean install every time</dt>
            <dd><em>Default: <code>RECLONE=""</code></em><br />
            By default <code>stack.sh</code> only clones the project repos if they do not exist in <code>$DEST</code>.  <code>stack.sh</code> will freshen each repo on each run if <code>RECLONE</code> is set to <code>yes</code>. This avoids having to manually remove repos in order to get the current branch from <code>$GIT_BASE</code>.
            <pre>RECLONE=yes</code></dd>

            <dt>Swift</dt>
            <dd><em>Default: <code>SWIFT_HASH="" SWIFT_REPLICAS=1 SWIFT_DATA_DIR=$DEST/data/swift</code></em><br />
            Swift is now used as the back-end for the S3-like object store.  When enabled Nova's objectstore (n-obj in <code>ENABLED_SERVICES</code>) is automatically disabled. Enable Swift by adding it services to <code>ENABLED_SERVICES</code>:
            <pre>enable_service s-proxy s-object s-container s-account</pre>
            Setting Swift's hash value is required and you will be prompted for it if Swift is enabled so just set it to something already:
            <pre>SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5</pre>
            For development purposes the default number of replicas is set to <code>1</code> to reduce the overhead required.  To better simulate a production deployment set this to <code>3</code> or more.
            <pre>SWIFT_REPLICAS=3</pre>
            The data for Swift is stored in the source tree by default
            (in <code>$DEST/swift/data</code>) and can be moved by setting
            <code>SWIFT_DATA_DIR</code>.  The specified directory will be created if it does not exist.
            <pre>SWIFT_DATA_DIR=$DEST/data/swift</pre>
            <em>Note: Previously just enabling <code>swift</code> was sufficient to start the Swift services.  That does not provide proper service granularity, particularly in multi-host configurations, and is considered deprecated.  Some service combination tests now check for specific Swift services and the old blanket acceptance will longer work correctly.</em>
            </dd>

            <dt>Service Catalog Backend</dt>
            <dd><em>Default: <code>KEYSTONE_CATALOG_BACKEND=sql</code></em><br />
            DevStack uses Keystone's <code>sql</code> service catalog backend.  An alternate <code>template</code> backend is also available.  However, it does not support the <code>service-*</code> and <code>endpoint-*</code> commands of the <code>keystone</code> CLI.  To
            do so requires the <code>sql</code> backend be enabled:
            <pre>KEYSTONE_CATALOG_BACKEND=template</pre>
            DevStack's default configuration in <code>sql</code> mode is set in
            <code>files/keystone_data.sh</code></dd>

            <dt>Cinder</dt>
            <dd><em>Default: <code>VOLUME_GROUP="stack-volumes" VOLUME_NAME_PREFIX="volume-" VOLUME_BACKING_FILE_SIZE=10250M</code></em><br />
            The logical volume group used to hold the Cinder-managed volumes is set by <code>VOLUME_GROUP</code>, the logical volume name prefix is set with <code>VOLUME_NAME_PREFIX</code> and the size of the volume backing file is set with <code>VOLUME_BACKING_FILE_SIZE</code>.
            <pre>VOLUME_GROUP="stack-volumes"
VOLUME_NAME_PREFIX="volume-"
VOLUME_BACKING_FILE_SIZE=10250M</pre></dd>

            <dt>Multi-host DevStack</dt>
            <dd><em>Default: <code>MULTI_HOST=False</code></em><br />
            Running DevStack with multiple hosts requires a custom <code>local.conf</code> section for each host.  The master is the same as a single host installation with <code>MULTI_HOST=True</code>.  The slaves have fewer services enabled and a couple of host variables pointing to the master.  
            <br /><br />
            <strong>Master</strong>
            <pre>MULTI_HOST=True</pre>

            <strong>Slave</strong>
            <pre>MYSQL_HOST=w.x.y.z
RABBIT_HOST=w.x.y.z
GLANCE_HOSTPORT=w.x.y.z:9292
ENABLED_SERVICES=n-vol,n-cpu,n-net,n-api</pre></dd>

            <dt>API rate limits</dt>
            <dd><em>Default: <code>API_RATE_LIMIT=True</code><br />
            Integration tests such as Tempest will likely run afoul of the default rate limits configured for Nova.  Turn off rate limiting during testing by setting <code>API_RATE_LIMIT=False</code>.
            <pre>API_RATE_LIMIT=False</pre></dd>
          </dl>

          <h3>Examples</h3>
          <ul>
            <li>Eliminate a Cinder pass-through (<code>CINDER_PERIODIC_INTERVAL</code>):
<pre>[[post-config|$CINDER_CONF]]
[DEFAULT]
periodic_interval = 60
</pre></li>
            <li>Sample <code>local.conf</code> with screen logging enabled:
<pre>[[local|localrc]]
FIXED_RANGE=10.254.1.0/24
NETWORK_GATEWAY=10.254.1.1
LOGDAYS=1
LOGFILE=$DEST/logs/stack.sh.log
SCREEN_LOGDIR=$DEST/logs/screen
ADMIN_PASSWORD=quiet
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50</pre></li>
          </ul>

      </section>

      <footer>
        <p>&copy; Openstack Foundation 2011-2014 &mdash; An <a href="https://www.openstack.org/">OpenStack</a> <a href="https://wiki.openstack.org/wiki/Programs">program</a></p>
      </footer>

    </div> <!-- /container -->
  </body>
</html>