Drupal 8 Configuration Workflows sử dụng Git

Drupal 8 Configuration Workflows sử dụng Git

This blog post is a textual representation of the video shared yesterday. If you are visual learner, watch it. If you are in a hurry, read this blog :). Peter's video also shows how configuration_log module can be used to materialize all config changes in Prod so they may be easily integrated back into the codebase. That is not covered here.

The following commands are our current best thoughts on how folks will move configuration across environments using Git and the Drush config commands. Our goal is to coalesce the community on a best practice that non-trivial Drupal sites will follow.

# Save an arbitrary configuration change using Drush. Using the admin ui would work just as well.
local$ drush config-edit system.site

# Export all your active configuration to a directory labelled 'vcs'.
# This is a 3rd $config_directories[] item specified in settings.php (see below).
local$ drush config-export vcs
local$ git status

# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified:   ../config_vcs/system.site.yml
#

# Commit config changes so other devs can see them, and so we can propagate to other environments.
local$ git commit -am "New site information configuration"

# Push your changes. Resolve git conflicts as usual.
local$ git push

# Now, on the dev server, get latest codebase
local$ ssh -A [email protected]

##############################
#   Welcome to dev.server.example.com.
#   Last login: Wed Feb 26 19:43:14 2014 from localhost

dev$ cd www/docroot
dev$ git pull

# Import new config
dev$ drush config-import vcs --preview=diff

# Run DB updates, as usual
dev$ drush updatedb

In terms of the settings.php we have an array of config directories:

<?php
$config_directories['active'] = 'sites/default/files/config_JeZmqqMqX_S80W7DKVKKMT7uH8iJIeUHkuTWks8b3ZU/active';
$config_directories['staging'] = 'sites/default/files/config_JeZmqqMqX_S80W7DKVKKMT7uH8iJIeUHkuTWks8b3ZU/staging';
$config_directories['vcs'] = '../config_vcs';
?>

The third entry gives us the "vcs" name that is used with the Drush commands. This key is arbitrary, as is the path. Acquia Cloud will use a directory named 'config_vcs' at the root of the site's Git repository.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
6 lý do khiến blog bị đánh giá "thiếu chuyên nghiệp"

6 lý do khiến blog bị đánh giá "thiếu chuyên nghiệp"

Có đôi khi bạn thấy trang blog của mình quá đơn giản, nhưng độc giả lại thấy nó quá phức tạp. Do đó thiết nghĩ phải dành thời gian để chỉnh lí những yếu tố ...

15 sản phẩm “hot” đáng chờ tại CES 2012

15 sản phẩm “hot” đáng chờ tại CES 2012

Nhiều sản phẩm "đáng mặt anh tài" sẽ xuất hiện tại Triển lãm Điện tử tiêu dùng 2012, Las Vegas, Mỹ dựa theo những tin đồn, thông tin rò rỉ trước trước sự kiện.

10 lí do khiến Adobe thua cuộc trong cuộc chiến Flash di động với Apple

10 lí do khiến Adobe thua cuộc trong cuộc chiến Flash di động với Apple

Vừa qua, Adobe đã quyết định sẽ không còn hỗ trợ FLash Player cho các trình duyệt web di động nữa. Qua đó, ta có thể thấy rằng Adobe đã thua Apple trong cuộc chiến căng thẳng kéo dài về nền tảng phát triển ứng dụng Web này.

Công ty diệt chuột T&C

 

Diet con trung