Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame^] | 1 | `DevStack </>`__ |
| 2 | |
| 3 | - `Overview <overview.html>`__ |
| 4 | - `Changes <changes.html>`__ |
| 5 | - `FAQ <faq.html>`__ |
| 6 | - `git.openstack.org <https://git.openstack.org/cgit/openstack-dev/devstack>`__ |
| 7 | - `Gerrit <https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z>`__ |
| 8 | |
| 9 | Configuration Making it go my way |
| 10 | --------------------------------- |
| 11 | |
| 12 | DevStack has always tried to be mostly-functional with a minimal amount |
| 13 | of configuration. The number of options has ballooned as projects add |
| 14 | features, new projects added and more combinations need to be tested. |
| 15 | Historically DevStack obtained all local configuration and |
| 16 | customizations from a ``localrc`` file. The number of configuration |
| 17 | variables that are simply passed-through to the individual project |
| 18 | configuration files is also increasing. The old mechanism for this |
| 19 | (``EXTRAS_OPTS`` and friends) required specific code for each file and |
| 20 | did not scale well. |
| 21 | |
| 22 | In Oct 2013 a new configuration method was introduced (in `review |
| 23 | 46768 <https://review.openstack.org/#/c/46768/>`__) to hopefully |
| 24 | simplify this process and meet the following goals: |
| 25 | |
| 26 | - contain all non-default local configuration in a single file |
| 27 | - be backward-compatible with ``localrc`` to smooth the transition |
| 28 | process |
| 29 | - allow settings in arbitrary configuration files to be changed |
| 30 | |
| 31 | local.conf |
| 32 | ~~~~~~~~~~ |
| 33 | |
| 34 | The new configuration file is ``local.conf`` and resides in the root |
| 35 | DevStack directory like the old ``localrc`` file. It is a modified INI |
| 36 | format file that introduces a meta-section header to carry additional |
| 37 | information regarding the configuration files to be changed. |
| 38 | |
| 39 | The new header is similar to a normal INI section header but with double |
| 40 | brackets (``[[ ... ]]``) and two internal fields separated by a pipe |
| 41 | (``|``): |
| 42 | |
| 43 | :: |
| 44 | |
| 45 | [[ <phase> | <config-file-name> ]] |
| 46 | |
| 47 | where ``<phase>`` is one of a set of phase names defined by ``stack.sh`` |
| 48 | and ``<config-file-name>`` is the configuration filename. The filename |
| 49 | is eval'ed in the ``stack.sh`` context so all environment variables are |
| 50 | available and may be used. Using the project config file variables in |
| 51 | the header is strongly suggested (see the ``NOVA_CONF`` example below). |
| 52 | If the path of the config file does not exist it is skipped. |
| 53 | |
| 54 | The defined phases are: |
| 55 | |
| 56 | - **local** - extracts ``localrc`` from ``local.conf`` before |
| 57 | ``stackrc`` is sourced |
| 58 | - **pre-install** - runs after the system packages are installed but |
| 59 | before any of the source repositories are installed |
| 60 | - **install** - runs immediately after the repo installations are |
| 61 | complete |
| 62 | - **post-config** - runs after the layer 2 services are configured and |
| 63 | before they are started |
| 64 | - **extra** - runs after services are started and before any files in |
| 65 | ``extra.d`` are executed |
| 66 | |
| 67 | The file is processed strictly in sequence; meta-sections may be |
| 68 | specified more than once but if any settings are duplicated the last to |
| 69 | appear in the file will be used. |
| 70 | |
| 71 | :: |
| 72 | |
| 73 | [[post-config|$NOVA_CONF]] |
| 74 | [DEFAULT] |
| 75 | use_syslog = True |
| 76 | |
| 77 | [osapi_v3] |
| 78 | enabled = False |
| 79 | |
| 80 | A specific meta-section ``local|localrc`` is used to provide a default |
| 81 | ``localrc`` file (actually ``.localrc.auto``). This allows all custom |
| 82 | settings for DevStack to be contained in a single file. If ``localrc`` |
| 83 | exists it will be used instead to preserve backward-compatibility. More |
| 84 | details on the `contents of localrc <localrc.html>`__ are available. |
| 85 | |
| 86 | :: |
| 87 | |
| 88 | [[local|localrc]] |
| 89 | FIXED_RANGE=10.254.1.0/24 |
| 90 | ADMIN_PASSWORD=speciale |
| 91 | LOGFILE=$DEST/logs/stack.sh.log |
| 92 | |
| 93 | Note that ``Q_PLUGIN_CONF_FILE`` is unique in that it is assumed to |
| 94 | *NOT* start with a ``/`` (slash) character. A slash will need to be |
| 95 | added: |
| 96 | |
| 97 | :: |
| 98 | |
| 99 | [[post-config|/$Q_PLUGIN_CONF_FILE]] |
| 100 | |
| 101 | Also note that the ``localrc`` section is sourced as a shell script |
| 102 | fragment amd MUST conform to the shell requirements, specifically no |
| 103 | whitespace around ``=`` (equals). |
| 104 | |
| 105 | Minimal Configuration |
| 106 | ~~~~~~~~~~~~~~~~~~~~~ |
| 107 | |
| 108 | While ``stack.sh`` is happy to run without a ``localrc`` section in |
| 109 | ``local.conf``, devlife is better when there are a few minimal variables |
| 110 | set. This is an example of a minimal configuration that touches the |
| 111 | values that most often need to be set. |
| 112 | |
| 113 | - no logging |
| 114 | - pre-set the passwords to prevent interactive prompts |
| 115 | - move network ranges away from the local network (``FIXED_RANGE`` and |
| 116 | ``FLOATING_RANGE``, commented out below) |
| 117 | - set the host IP if detection is unreliable (``HOST_IP``, commented |
| 118 | out below) |
| 119 | |
| 120 | :: |
| 121 | |
| 122 | [[local|localrc]] |
| 123 | ADMIN_PASSWORD=secrete |
| 124 | DATABASE_PASSWORD=$ADMIN_PASSWORD |
| 125 | RABBIT_PASSWORD=$ADMIN_PASSWORD |
| 126 | SERVICE_PASSWORD=$ADMIN_PASSWORD |
| 127 | SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50 |
| 128 | #FIXED_RANGE=172.31.1.0/24 |
| 129 | #FLOATING_RANGE=192.168.20.0/25 |
| 130 | #HOST_IP=10.3.4.5 |
| 131 | |
| 132 | If the ``*_PASSWORD`` variables are not set here you will be prompted to |
| 133 | enter values for them by ``stack.sh``. |
| 134 | |
| 135 | The network ranges must not overlap with any networks in use on the |
| 136 | host. Overlap is not uncommon as RFC-1918 'private' ranges are commonly |
| 137 | used for both the local networking and Nova's fixed and floating ranges. |
| 138 | |
| 139 | ``HOST_IP`` is normally detected on the first run of ``stack.sh`` but |
| 140 | often is indeterminate on later runs due to the IP being moved from an |
| 141 | Ethernet integace to a bridge on the host. Setting it here also makes it |
| 142 | available for ``openrc`` to set ``OS_AUTH_URL``. ``HOST_IP`` is not set |
| 143 | by default. |
| 144 | |
| 145 | Common Configuration Variables |
| 146 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 147 | |
| 148 | Set DevStack install directory |
| 149 | | *Default: ``DEST=/opt/stack``* |
| 150 | | The DevStack install directory is set by the ``DEST`` variable. |
| 151 | | By setting it early in the ``localrc`` section you can reference it |
| 152 | in later variables. It can be useful to set it even though it is not |
| 153 | changed from the default value. |
| 154 | | |
| 155 | |
| 156 | :: |
| 157 | |
| 158 | DEST=/opt/stack |
| 159 | |
| 160 | stack.sh logging |
| 161 | | *Defaults: ``LOGFILE="" LOGDAYS=7 LOG_COLOR=True``* |
| 162 | | By default ``stack.sh`` output is only written to the console |
| 163 | where is runs. It can be sent to a file in addition to the console |
| 164 | by setting ``LOGFILE`` to the fully-qualified name of the |
| 165 | destination log file. A timestamp will be appended to the given |
| 166 | filename for each run of ``stack.sh``. |
| 167 | | |
| 168 | |
| 169 | :: |
| 170 | |
| 171 | LOGFILE=$DEST/logs/stack.sh.log |
| 172 | |
| 173 | Old log files are cleaned automatically if ``LOGDAYS`` is set to the |
| 174 | number of days of old log files to keep. |
| 175 | |
| 176 | :: |
| 177 | |
| 178 | LOGDAYS=1 |
| 179 | |
| 180 | The some of the project logs (Nova, Cinder, etc) will be colorized |
| 181 | by default (if ``SYSLOG`` is not set below); this can be turned off |
| 182 | by setting ``LOG_COLOR`` False. |
| 183 | |
| 184 | :: |
| 185 | |
| 186 | LOG_COLOR=False |
| 187 | |
| 188 | Screen logging |
| 189 | | *Default: ``SCREEN_LOGDIR=""``* |
| 190 | | By default DevStack runs the OpenStack services using ``screen`` |
| 191 | which is useful for watching log and debug output. However, in |
| 192 | automated testing the interactive ``screen`` sessions may not be |
| 193 | available after the fact; setting ``SCREEN_LOGDIR`` enables logging |
| 194 | of the ``screen`` sessions in the specified diretory. There will be |
| 195 | one file per ``screen`` session named for the session name and a |
| 196 | timestamp. |
| 197 | | |
| 198 | |
| 199 | :: |
| 200 | |
| 201 | SCREEN_LOGDIR=$DEST/logs/screen |
| 202 | |
| 203 | *Note the use of ``DEST`` to locate the main install directory; this |
| 204 | is why we suggest setting it in ``local.conf``.* |
| 205 | |
| 206 | One syslog to bind them all |
| 207 | | *Default: ``SYSLOG=False SYSLOG_HOST=$HOST_IP SYSLOG_PORT=516``* |
| 208 | | Logging all services to a single syslog can be convenient. Enable |
| 209 | syslogging by setting ``SYSLOG`` to ``True``. If the destination log |
| 210 | host is not localhost ``SYSLOG_HOST`` and ``SYSLOG_PORT`` can be |
| 211 | used to direct the message stream to the log host. |
| 212 | | |
| 213 | |
| 214 | :: |
| 215 | |
| 216 | SYSLOG=True |
| 217 | SYSLOG_HOST=$HOST_IP |
| 218 | SYSLOG_PORT=516 |
| 219 | |
| 220 | A clean install every time |
| 221 | | *Default: ``RECLONE=""``* |
| 222 | | By default ``stack.sh`` only clones the project repos if they do |
| 223 | not exist in ``$DEST``. ``stack.sh`` will freshen each repo on each |
| 224 | run if ``RECLONE`` is set to ``yes``. This avoids having to manually |
| 225 | remove repos in order to get the current branch from ``$GIT_BASE``. |
| 226 | | |
| 227 | |
| 228 | :: |
| 229 | |
| 230 | RECLONE=yes |
| 231 | |
| 232 | Swift |
| 233 | Default: SWIFT_HASH="" SWIFT_REPLICAS=1 SWIFT_DATA_DIR=$DEST/data/swift |
| 234 | Swift is now used as the back-end for the S3-like object store. When enabled Nova's objectstore (n-obj in ENABLED_SERVICES) is automatically disabled. Enable Swift by adding it services to ENABLED_SERVICES: |
| 235 | enable_service s-proxy s-object s-container s-account |
| 236 | |
| 237 | Setting Swift's hash value is required and you will be prompted for |
| 238 | it if Swift is enabled so just set it to something already: |
| 239 | |
| 240 | :: |
| 241 | |
| 242 | SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5 |
| 243 | |
| 244 | For development purposes the default number of replicas is set to |
| 245 | ``1`` to reduce the overhead required. To better simulate a |
| 246 | production deployment set this to ``3`` or more. |
| 247 | |
| 248 | :: |
| 249 | |
| 250 | SWIFT_REPLICAS=3 |
| 251 | |
| 252 | The data for Swift is stored in the source tree by default (in |
| 253 | ``$DEST/swift/data``) and can be moved by setting |
| 254 | ``SWIFT_DATA_DIR``. The specified directory will be created if it |
| 255 | does not exist. |
| 256 | |
| 257 | :: |
| 258 | |
| 259 | SWIFT_DATA_DIR=$DEST/data/swift |
| 260 | |
| 261 | *Note: Previously just enabling ``swift`` was sufficient to start |
| 262 | the Swift services. That does not provide proper service |
| 263 | granularity, particularly in multi-host configurations, and is |
| 264 | considered deprecated. Some service combination tests now check for |
| 265 | specific Swift services and the old blanket acceptance will longer |
| 266 | work correctly.* |
| 267 | |
| 268 | Service Catalog Backend |
| 269 | | *Default: ``KEYSTONE_CATALOG_BACKEND=sql``* |
| 270 | | DevStack uses Keystone's ``sql`` service catalog backend. An |
| 271 | alternate ``template`` backend is also available. However, it does |
| 272 | not support the ``service-*`` and ``endpoint-*`` commands of the |
| 273 | ``keystone`` CLI. To do so requires the ``sql`` backend be enabled: |
| 274 | | |
| 275 | |
| 276 | :: |
| 277 | |
| 278 | KEYSTONE_CATALOG_BACKEND=template |
| 279 | |
| 280 | DevStack's default configuration in ``sql`` mode is set in |
| 281 | ``files/keystone_data.sh`` |
| 282 | |
| 283 | Cinder |
| 284 | | Default: |
| 285 | | VOLUME_GROUP="stack-volumes" VOLUME_NAME_PREFIX="volume-" VOLUME_BACKING_FILE_SIZE=10250M |
| 286 | | The logical volume group used to hold the Cinder-managed volumes |
| 287 | is set by ``VOLUME_GROUP``, the logical volume name prefix is set |
| 288 | with ``VOLUME_NAME_PREFIX`` and the size of the volume backing file |
| 289 | is set with ``VOLUME_BACKING_FILE_SIZE``. |
| 290 | | |
| 291 | |
| 292 | :: |
| 293 | |
| 294 | VOLUME_GROUP="stack-volumes" |
| 295 | VOLUME_NAME_PREFIX="volume-" |
| 296 | VOLUME_BACKING_FILE_SIZE=10250M |
| 297 | |
| 298 | Multi-host DevStack |
| 299 | | *Default: ``MULTI_HOST=False``* |
| 300 | | Running DevStack with multiple hosts requires a custom |
| 301 | ``local.conf`` section for each host. The master is the same as a |
| 302 | single host installation with ``MULTI_HOST=True``. The slaves have |
| 303 | fewer services enabled and a couple of host variables pointing to |
| 304 | the master. |
| 305 | | **Master** |
| 306 | |
| 307 | :: |
| 308 | |
| 309 | MULTI_HOST=True |
| 310 | |
| 311 | **Slave** |
| 312 | |
| 313 | :: |
| 314 | |
| 315 | MYSQL_HOST=w.x.y.z |
| 316 | RABBIT_HOST=w.x.y.z |
| 317 | GLANCE_HOSTPORT=w.x.y.z:9292 |
| 318 | ENABLED_SERVICES=n-vol,n-cpu,n-net,n-api |
| 319 | |
| 320 | API rate limits |
| 321 | | Default: ``API_RATE_LIMIT=True`` |
| 322 | | Integration tests such as Tempest will likely run afoul of the |
| 323 | default rate limits configured for Nova. Turn off rate limiting |
| 324 | during testing by setting ``API_RATE_LIMIT=False``.* |
| 325 | | |
| 326 | |
| 327 | :: |
| 328 | |
| 329 | API_RATE_LIMIT=False |
| 330 | |
| 331 | Examples |
| 332 | ~~~~~~~~ |
| 333 | |
| 334 | - Eliminate a Cinder pass-through (``CINDER_PERIODIC_INTERVAL``): |
| 335 | |
| 336 | :: |
| 337 | |
| 338 | [[post-config|$CINDER_CONF]] |
| 339 | [DEFAULT] |
| 340 | periodic_interval = 60 |
| 341 | |
| 342 | - Sample ``local.conf`` with screen logging enabled: |
| 343 | |
| 344 | :: |
| 345 | |
| 346 | [[local|localrc]] |
| 347 | FIXED_RANGE=10.254.1.0/24 |
| 348 | NETWORK_GATEWAY=10.254.1.1 |
| 349 | LOGDAYS=1 |
| 350 | LOGFILE=$DEST/logs/stack.sh.log |
| 351 | SCREEN_LOGDIR=$DEST/logs/screen |
| 352 | ADMIN_PASSWORD=quiet |
| 353 | DATABASE_PASSWORD=$ADMIN_PASSWORD |
| 354 | RABBIT_PASSWORD=$ADMIN_PASSWORD |
| 355 | SERVICE_PASSWORD=$ADMIN_PASSWORD |
| 356 | SERVICE_TOKEN=a682f596-76f3-11e3-b3b2-e716f9080d50 |
| 357 | |
| 358 | © Openstack Foundation 2011-2014 — An |
| 359 | `OpenStack <https://www.openstack.org/>`__ |
| 360 | `program <https://wiki.openstack.org/wiki/Programs>`__ |