Features + Git + Drush = Drupal development and maintenance workflow

OK! So those who attended my session on my Drupal development workflow at DrupalCamp Austin this year are probably still reeling from the experience-- I know I am.  And I am wanting to post all the gaps I failed to cover and whatnot.  There will be a reprise session, streamlined, clearer, and still more thorough at Southwest Drupal Summit 2010.

For now, here are some tidbits to tide you over:

Just this afternoon, I had to swap out a header slideshow from using views rotator to views_slideshow on a live site. My workflow for this, true to how it was presented but even better, was:

  1. On production site:
    1. drush sql-dump > the .sql in the inaccessible assets folder monitored by git
    2. git add . to ensure I picked up all new documents, images and whatnot uploaded to the site since last maintenance
    3. git commit
    4. git push orign master
      because, in this case, I have an interim server hosting some of my git repos using indefero.
  2. On local dev:
    1. git pull origin master
      1. Contemplate pulling my hair out, because git crabbed about untracked files that would be overwritten, yada yada.. but instead
    2. rm that "offending" file and then git reset --hard for good measure
    3. then git pull origin master
    4. drush sqlc < the .sql from the inaccessible assets folder monitored by git.

At this point, I've got local looking just like production, but the current views_rotator driven front page slideshow is not managed by Features!  What to do!  No worries..

I downloaded and enabled the views_slideshow module, edited the View locally, simply changing the Style to Views Slideshow, and set up the other params.  Then I modified the css to match the previous views_rotator css-- not too different, just different selectors (and a chance to clean up a bit):

  1. drush dl views_slideshow
  2. drush en views_slideshow_single -y (what? oh cool, it automatically updates the "parent" dependency views_slideshow for me.. Thanks module manager!)
  3. Edit the view
  4. Edit the css

Next I created a new feature of this slideshow whose View machine name has not changed, added it to the site, and enabled it:

  1. Create the new feature via Manage Features web UI, cherrypicking a few things starting with the View in question and downloaded it.
  2. tar -xf frontpage_slideshow.tar (hmm, that sounds like my presentation almost to a T!) into the sites/all/modules/custom folder
  3. drush en frontpage_slideshow -y (psst, hey Chris, the -y is to bypass the y/n prompt ;) )

Commit to git, and push to remote. I include the sql-dump but don't intend to reload it at remote-- check it out:

  1. git add . (to pick up the newly downloaded views_slideshow module and the newly created frontpage_slideshow Feature)
  2. git commit -am "swapped out for views slideshow; modified css to support; created feature frontpage_slideshow"
  3. git push origin master (again, this is going to the lillipad indefero remote git repo)

Then on remote, production:

  1. git pull origin master at which point I now have all the files from the changes before but no database changes loaded
  2. drush en views_slideshow_single -y
  3. drush en frontpage_slideshow -y
    Ok, check this out.. do drush features or visit Manage Features page, and you'll see that the new Feature is installed and enabled..... but it's in the state of Overridden-- confused? Don't be: this just means that the database and live view of the frontpage slideshow (now actually referred to as frontpage_slideshow) is different (the old version) from the code version on disk.
  4. drush fr frontpage_slideshow -y
    Woah. Revert??  Yes.  That's the confusing nomenclature of Features (in this release). It's not really "revert", it's "update from file" in my workflow, but whatever.  Just do it.  Load from file, load from disk.

WHAM!  The frontpage slideshow is now the new views_slideshow, and life is GOOOoood.

(oh, and yeah, it really works! I hope to post some log or screenshots here in a bit, but don't hold your breath.)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

So - you are using features

So - you are using features to "package" aspects of the site and then Git provides version control for the feature? Then when you upload the updated feature to production, its all set except for the "revert" on the feature?

Is there any way to use Git to control versions of the whole site or DB? I'm just learning Git, so it may be dumb...

Or is it that you are using features to package the DB configuration into files, which are then versioned by Git?

Fantastic stuff, though... I appreciate the info and am looking forward to playing with a similar setup.

ron

Only features, not db _files_ in git

Good question, and in fact (if I understand correctly), I was once interested in storing the actual mysql files (the ones typically under /var/lib/mysql) but later go ahold of myself and never tried it.  No, in fact in my workflow, I store the db dump as a whole and let it ride with the repo wherever it goes.  Sometimes I dump again (usu just from staging/remote, not usu the other way) as changes to db and config are made.

As for your question (which is what getting stored where)-- I'm techincally only packaging site structures and functions (site features) and changes to css when I make these sorts of commits and updates remotely.  This is only made possible by the Drupal Features module, and that is its sole purpose in life.

Git itself is just the ultra convenient transport (in this case), although it does of course work as version control if that's what you need, too.  It is, in fact, version control at its heart, but is so efficient at moving things around and moving only and exactly everything that has changed on disk.  There is no voodoo to my workflow other than the way that each works so incredibly well!

Ohhhh hoh hum.  Now you're gonna motivate me to build out a proper blog post on my whole workflow.  It was bound to happen anyhow! :)

hehehe - +1 on the tutorial

hehehe - +1 on the tutorial for build out! It would make a nice edition to your talk in Houston...

I mean - its not like you are busy or anything with 2 kids and one being born any day... :)

Can you please write more

Can you please write more blog entries on this subject, its a request, because after reading your blog I am highly interested in learning more....

Wallace Keynes
My Blog:
copy xbox 360 games|copy wii games|

Then click on the launcher —

Then click on the launcher — and run away from you. Another important distance is 2.5 km from the different games. The 31 skills of the eve isk that has a very important impact during eve online isk fights. It can also start not with the support of a vanguard ship, easily breaking the enemy spends some forces on the boundary of its Shield. The exact orbit depends on your specific tactics. For the chance of death, and many low
slots will be too low, the road to high-sec systems.

Many persons are intriguing

Many persons are intriguing in progress of the pc. They wish to know the latest information of the pc progress. Then, they wish to use the latest version of the program. youtube converter

Website is one of the media

Website is one of the media that routinely used to share records. It's because many people use internet. Therefore, the website will become trends in sharing many things and more faster. online solar classes

re

This kind of content exemplifies the Internet at its finest - and I do not assert this lightly!

Nowadays, the development of

Nowadays, the development of the computer is very high. It is because the developers answers people's demand. The variation of computer has been a lot. lawn mower reviews

Sometimes, computer gives

Sometimes, computer gives some problems. Some people may be panic. They do not know about the structure of the computer. forex ipad

I agree with every statement

I agree with every statement that you have made in the post and I really appreciate your effort in gathering up the information. relatiegeschenken

Great article. You do make an

Great article. You do make an excellent point there. Best of luck with your future posts.Computerhulp

That means that our last two

That means that our last two years can be summarized in 40gigs, and there's a lot of repetition arabian ranches dubai

I'm still learning from you,

I'm still learning from you, but I'm trying to achieve my goals. I certainly enjoy reading all that is posted on your blog. Keeps the information coming. I loved it!
Foley Catheter

nice one

I am inspired by the writing style of author. I will be visiting in future to extend my knowledge. Thanks Google Plus 1 Service

Very interesting and

Very interesting and insightful.
radyo dinle

I couldn't get to much other

I couldn't get to much other details on this piece, so it was great to find this one. I will probably end up being back to check out some other posts that you have another time..ooglaseren

It’s a great pleasure reading

It’s a great pleasure reading that you posted here.
html kod

Nicely written blog This is a

Nicely written blog This is a wonderful post. I enjoyed the information lot. I will bookmark this page. Thanks for sharing this important information.
white one shoulder dress

Netter Post

Wenn man sich die Post so ansieht kann man schon glauben, dass es der Wirklichkeit entspricht was so gepostet wird. Bin immer wieder sehr erstaunt wieviele Möglichkeiten es im Netz gibt sich zu unterhalten. Schönen Gruß von Lena! Feuershow Freue mich auf Euren Besuch

I really enjoyed reading this

I really enjoyed reading this article. It was very well authored and easy to understand. Unlike other blogs I have read which are really not that good. I also found your posts very interesting.
porter-cable router table

Your blog is very

Your blog is very informative. I really appreciate your hardwork. Thanks You for such good information. Keep up good work !!
pick up lines

I think it is a very good

I think it is a very good website, that i'm very very interested to learn that. I think you'll provides more information that is a good choice for all. thank you so much
www.essentialservicesinc.com website designers in Minneapolis

This post give truly quality

This post give truly quality information.I’m definitely going to look into it.Really very useful tips are provided here. thank you so much. Keep up the good works.
http://www.starcitylimo.com/

Imagine all the people living

Imagine all the people living life in peace. You may say I'm a dreamer, but I'm not the only one. I hope someday you'll join us, and the world will be as one.
Optimum Nutrition

Your blog is very

Your blog is very informative. I really appreciate your hardwork. Thanks You for such good information. Keep up good work !!
http://www.yumdrop.com/

Useful conversation

This can be a quite valuable internet site and I have located fantastic details right here and I definitely value the efforts with the writer of this essay for sharing good ideas. Thanks! free cell phone spy

entries

entries on this subject, its a request, because after reading your blog I am highly interested in learning more....leather lounges sydney

I'm currently learning

I'm currently learning Drupal. It's very interesting and user friendly language.
Buy Website

Good - I should definitely

Good - I should definitely pronounce, impressed along with your website. I had created no trouble navigating through the many tabs in addition to related information became truly easy to do in order to access. Lengthy ago i found whatever hoped for before long in any way. Reasonably unusual. Excellent task..

famous quotes

This page is very informative

This page is very informative and fun to read. I appreciated what you have done here. I enjoyed every little bit part of it. I am always searching for informative information like this. Commercial LED Light Bulb

Messages informative,

Messages informative, materials areso interesting and useful. Thank you! was looking for something like this

Resources like the one you

Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
computer repair

Great article. You do make an

Great article. You do make an excellent point there. Best of luck with your future posts.
Addiction Counseling

rock

I am sure my visitors will find that very useful.

rock

useful to me! I will post a link to this page on my blog. I am sure my visitors

As a well-known site, they

As a well-known site, they must always keep upgrading their features and services. So users will enjoy in using their services.
Psychologists in Maryland

re

Nowadays, the event of the pc is quite excessive. The reason for this is that the developers answers people's demand. The adaptation of computer has been a lot.

School Assignment

great post

great development man. keep it up.
High class girls Amsterdam
high class girls Amsterdam

Thanks for your sharing .Your thoughts are creative and they act

Thanks for your sharing .Your thoughts are creative and they actually do help to me. It provides me with a lot of information. It is a nice post!
babykarten

Nowadays, the improvement of

Nowadays, the improvement of the pc could be very high. For the reason that the developers answers people's demand. The model of computer has been a lot. secure delete

Nowadays, the event of the pc

Nowadays, the event of the pc is quite excessive. The reason for this is that the developers answers people's demand. The adaptation of computer has been a lot. NRL Betting

There is solely nothing worse

There is solely nothing worse for the viewers than a band which is introduced, takes to the stage to an incredible burst of applause and then stands round for a couple of minutes tuning up foam pillow

virtual world

I think it is a very good website, that i'm very very interested to learn that. I think you'll provides more information that is a good choice for all. thank you so muchvirtual world

hi

In many societies, adult male or female status is subject to a ritual of this type. Altruistic action in the interests of the larger group is seen in virtually all societies.

My SQL's query caching can

My SQL's query caching can help reduce the load on the database server caused by Drupal's high query rate. Drupal caches database schema meta data as well as elements such as blocks, forms and menus. Drupal seven increases performance in database queries and reduces PHP code usage. Thanks.
Regards,
Atlanta bankruptcy lawyer

Great article. You do make an

Great article. You do make an excellent point there. Best of luck with your future posts Govt jobs || Classifieds

house cleaning San Antonio

Thanks for sharing your comments here that is so very interesting. house cleaning San Antonio

I'm techincally only

I'm techincally only packaging site structures and functions (site features) and changes to css when I make these sorts of commits and updates remotely. This is only made possible by the Drupal Features module, and that is its sole purpose in life. You can Hire a DJ if you need any help.

bam

Hey, as an alternative to attempting to store the actual mysql db files in git, I have become reliant on the backup and migrate module + drush while developing an installation. As I go along with development, I can take snapshots of the db at points along the way. I then commit these backups into the repo. Then, if I want to go back to a prior state or bring the db down to a localhost dev environment, it can all be done in a few keystrokes.