![Drupal 8 Configuration Management](https://chromatichq.com/sites/default/files/styles/content_image_lar/public/config-hero.jpg?itok=on6Y-kPg)
A common difficulty in web development is keeping configuration consistent between environments. Drupal keeps most configuration settings in the database and it can be a pain to keep databases across environments synchronized. Solving this conundrum was one of Drupal 8’s goals and the focus of D8’s Configuration Management Initiative (CMI). All site configuration is saved in YAML files (hooray for version control!) and can be shared between site environments.
THE WAY WE WERE
Let’s take a classic example from before D8, using the beloved Views module. When you build a great new view on your local machine you still need to get it onto the production site. You could repeat what you did on your local machine and build the View by hand on prod, but that’s just repeating all the work you have already completed, not to mention, prone to user error. Most developers are too lazy to do that anyways, so they depend on Drupal’s Features module. The Features module works by exporting db configuration settings into Drupal module code which can be shared amongst environments. It usually works pretty well, but it turns out the Features module was not built for handling deployment and configuration. These tasks have fallen into its lap because, until now, it was the only game in town.
THE WAY WE’RE GOING
With every Drupal 8 installation, the configuration system creates a configuration directory*, sync
, to hold the aforementioned YAML configuration files. The directory is actually created as a sub-directory in sites/default/files
, into a folder with a long, random hash as its name, prefaced by config_
. (Including a random hash makes it near impossible for bad guys to guess the configuration folder name.)
* At the time of writing the default installation actually created two directories: active
and staging
, but that was changed to just one, the staging
directory which subsequently was changed to sync
. The blog post has been updated to reflect this.
In picture form…a folder with a really, really long, random name
![Config Sync Folder](https://chromatichq.com/sites/default/files/styles/content_image_lar/public/config-sync-folder.png?itok=CYFvjajz)
So in the above screenshot the configuration directory’s name is
config_Z1fHk5YnKXiTdJl9lAfz_dqGmrMTzqT9lNnbUF6z4kwKxglnC8srJZBTcI1dIMSCOmOwvEMZ5g
and the full path of the sync
directory is:
sites/default/files/config_Z1fHk5YnKXiTdJl9lAfz_dqGmrMTzqT9lNnbUF6z4kwKxglnC8srJZBTcI1dIMSCOmOwvEMZ5g/sync
So that’s where the site configuration files live, but by default, for reasons of speed and security, the actual configuration settings are saved in the database. So all the configuration from those YAML files actually gets imported into the database.
The configuration management system provides a UI for uploading and double-checking changes before applying them to the live site. (Of course, there are Drush commands, drush config-export
and drush config-import
that allow you to import/export through the command line too.)
HOW DO YOU FEEL ABOUT CLONES?
Now hold on, you can’t upload one site’s configuration to any old site; you can only synchronize configuration settings between cloned instances of a site. This restriction was a conscious decision made by the Drupal CMI team. So you need to start with one environment and then clone it. If you don’t do this, Drupal simply will not allow configuration settings to be imported.
Read More 2001
Read More 2002
Read More 2003
Read More 2004
Read More 2005
Read More 2006
Read More 2007
Read More 2008
Read More 2009
Read More 2010
Read More 2011
Read More 2012
Read More 2013
Read More 2014
Read More 2015
Read More 2016
Read More 2017
Read More 2018
Read More 2019
Read More 2020
Read More 2021
Read More 2022
Read More 2023
Read More 2024
Read More 2025
Read More 2026
Read More 2027
Read More 2028
Read More 2029
Read More 2030
Read More 2031
Read More 2032
Read More 2033
Read More 2034
Read More 2035
Read More 2036
Read More 2037
Read More 2038
Read More 2039
Read More 2040
Read More 2041
Read More 2042
Read More 2043
Read More 2044
Read More 2045
Read More 2046
Read More 2047
Read More 2048
Read More 2049
Read More 2050
Read More 2051
Read More 2052
Read More 2053
Read More 2054
Read More 2055
Read More 2056
Read More 2057
Read More 2058
Read More 2059
Read More 2060
Read More 2061
Read More 2062
Read More 2063
Read More 2064
Read More 2065
Read More 2066
Read More 2067
Read More 2068
Read More 2069
Read More 2070
Read More 2071
Read More 2072
Read More 2073
Read More 2074
Read More 2075
Read More 2076
Read More 2077
Read More 2078
Read More 2079
Read More 2080
Read More 2081
Read More 2082
Read More 2083
Read More 2084
Read More 2085
Read More 2086
Read More 2087
Read More 2088
Read More 2089
Read More 2090
Read More 2091
Read More 2092
Read More 2093
Read More 2094
Read More 2095
Read More 2096
Read More 2097
Read More 2098
Read More 2099
Read More 2100
Read More 2101
Read More 2102
Read More 2103
Read More 2104
Read More 2105
Read More 2106
Read More 2107
Read More 2108
Read More 2109
Read More 2110
Read More 2111
Read More 2112
Read More 2113
Read More 2114
Read More 2115
Read More 2116
Read More 2117
Read More 2118
Read More 2119
Read More 2120
Read More 2121
Read More 2122
Read More 2123
Read More 2124
Read More 2125
Read More 2126
Read More 2127
Read More 2128
Read More 2129
Read More 2130
Read More 2131
Read More 2132
Read More 2133
Read More 2134
Read More 2135
Read More 2136
Read More 2137
Read More 2138
Read More 2139
Read More 2140
Read More 2141
Read More 2142
Read More 2143
Read More 2144
Read More 2145
Read More 2146
Read More 2147
Read More 2148
Read More 2149
Read More 2150
Read More 2151
Read More 2152
Read More 2153
Read More 2154
Read More 2155
Read More 2156
Read More 2157
Read More 2158
Read More 2159
Read More 2160
Read More 2161
Read More 2162
Read More 2163
Read More 2164
Read More 2165
Read More 2166
Read More 2167
Read More 2168
Read More 2169
Read More 2170
Read More 2171
Read More 2172
Read More 2173
Read More 2174
Read More 2175
Read More 2176
Read More 2177
Read More 2178
Read More 2179
Read More 2180
Read More 2181
Read More 2182
Read More 2183
Read More 2184
Read More 2185
Read More 2186
Read More 2187
Read More 2188
Read More 2189
Read More 2190
Read More 2191
Read More 2192
Read More 2193
Read More 2194
Read More 2195
Read More 2196
Read More 2197
Read More 2198
Read More 2199
Read More 2200
Read More 2201
Read More 2202
Read More 2203
Read More 2204
Read More 2205
Read More 2206
Read More 2207
Read More 2208
Read More 2209
Read More 2210
Read More 2211
Read More 2212
Read More 2213
Read More 2214
Read More 2215
Read More 2216
Read More 2217
Read More 2218
Read More 2219
Read More 2220
Read More 2221
Read More 2222
Read More 2223
Read More 2224
Read More 2225
Read More 2226
Read More 2227
Read More 2228
Read More 2229
Read More 2230
Read More 2231
Read More 2232
Read More 2233
Read More 2234
Read More 2235
Read More 2236
Read More 2237
Read More 2238
Read More 2239
Read More 2240
Read More 2241
Read More 2242
Read More 2243
Read More 2244
Read More 2245
Read More 2246
Read More 2247
Read More 2248
Read More 2249
Read More 2250
Read More 2251
Read More 2252
Read More 2253
Read More 2254
Read More 2255
Read More 2256
Read More 2257
Read More 2258
Read More 2259
Read More 2260
Read More 2261
Read More 2262
Read More 2263
Read More 2264
Read More 2265
Read More 2266
Read More 2267
Read More 2268
Read More 2269
Read More 2270
Read More 2271
Read More 2272
Read More 2273
Read More 2274
Read More 2275
Read More 2276
Read More 2277
Read More 2278
Read More 2279
Read More 2280
Read More 2281
Read More 2282
Read More 2283
Read More 2284
Read More 2285
Read More 2286
Read More 2287
Read More 2288
Read More 2289
Read More 2290
Read More 2291
Read More 2292
Read More 2293
Read More 2294
Read More 2295
Read More 2296
Read More 2297
Read More 2298
Read More 2299
Read More 2300
Read More 2301
Read More 2302
Read More 2303
Read More 2304
Read More 2305
Read More 2306
Read More 2307
Read More 2308
Read More 2309
Read More 2310
Read More 2311
Read More 2312
Read More 2313
Read More 2314
Read More 2315
Read More 2316
Read More 2317
Read More 2318
Read More 2319
Read More 2320
Read More 2321
Read More 2322
Read More 2323
Read More 2324
Read More 2325
Read More 2326
Read More 2327
Read More 2328
Read More 2329
Read More 2330
Read More 2331
Read More 2332
Read More 2333
Read More 2334
Read More 2335
Read More 2336
Read More 2337
Read More 2338
Read More 2339
Read More 2340
Read More 2341
Read More 2342
Read More 2343
Read More 2344
Read More 2345
Read More 2346
Read More 2347
Read More 2348
Read More 2349
Read More 2350
Read More 2351
Read More 2352
Read More 2353
Read More 2354
Read More 2355
Read More 2356
Read More 2357
Read More 2358
Read More 2359
Read More 2360
Read More 2361
Read More 2362
Read More 2363
Read More 2364
Read More 2365
Read More 2366
Read More 2367
Read More 2368
Read More 2369
Read More 2370
Read More 2371
Read More 2372
Read More 2373
Read More 2374
Read More 2375
Read More 2376
Read More 2377
Read More 2378
Read More 2379
Read More 2380
Read More 2381
Read More 2382
Read More 2383
Read More 2384
Read More 2385
Read More 2386
Read More 2387
Read More 2388
Read More 2389
Read More 2390
Read More 2391
Read More 2392
Read More 2393
Read More 2394
Read More 2395
Read More 2396
Read More 2397
Read More 2398
Read More 2399
Read More 2400
Read More 2401
Read More 2402
Read More 2403
Read More 2404
Read More 2405
Read More 2406
Read More 2407
Read More 2408
Read More 2409
Read More 2410
Read More 2411
Read More 2412
Read More 2413
Read More 2414
Read More 2415
Read More 2416
Read More 2417
Read More 2418
Read More 2419
Read More 2420
Read More 2421
Read More 2422
Read More 2423
Read More 2424
Read More 2425
Read More 2426
Read More 2427
Read More 2428
Read More 2429
Read More 2430
Read More 2431
Read More 2432
Read More 2433
Read More 2434
Read More 2435
Read More 2436
Read More 2437
Read More 2438
Read More 2439
Read More 2440
Read More 2441
Read More 2442
Read More 2443
Read More 2444
Read More 2445
Read More 2446
Read More 2447
Read More 2448
Read More 2449
Read More 2450
Read More 2451
Read More 2452
Read More 2453
Read More 2454
Read More 2455
Read More 2456
Read More 2457
Read More 2458
Read More 2459
Read More 2460
Read More 2461
Read More 2462
Read More 2463
Read More 2464
Read More 2465
Read More 2466
Read More 2467
Read More 2468
Read More 2469
Read More 2470
Read More 2471
Read More 2472
Read More 2473
Read More 2474
Read More 2475
Read More 2476
Read More 2477
Read More 2478
Read More 2479
Read More 2480
Read More 2481
Read More 2482
Read More 2483
Read More 2484
Read More 2485
Read More 2486
Read More 2487
Read More 2488
Read More 2489
Read More 2490
Read More 2491
Read More 2492
Read More 2493
Read More 2494
Read More 2495
Read More 2496
Read More 2497
Read More 2498
Read More 2499
Read More 2500