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