Using update scripts to deploy content across environments

Presenters: tk421jag

This session focuses on how we rolled out the Farm Loan Tool and the Conservation Tool using a Drupal update.php script that builds each page, creates paragraph types, blocks, and fills in the content. After running the update script all pages are up and running with properly placed blocks and paragraph types filled with your content.


Setting up pages, blocks, paragraphs, and content on various environments can often times be a pain. If you deploy from your local environment, to a development environment, a QA environment, a client facing staging environment, and then a production environment, valuable time can be spent creating the same content over and over again. And if the pages you are rolling out include creating a large number of new paragraphs and blocks as well as placing them in a content type, the process can become monotonous and drag on for hours.

Configuration files can help with some of this process such as creating content types, paragraph types, or block types. However, filling in the content, embedded blocks or reference types can sometimes cause issues or simply not work properly with configuration. Properly placing block types, view blocks, module produced blocks and paragraph reference may not even be an option in configuration at times.

Enter Drupal's Update Script. With an update script, entire tools and large sections of a website can be rolled out flawlessly with all content in place and ready to go in a matter of seconds. The days of copying and pasting content from environment to environment are behind you! Simply run drush updb, and your update script will create your content, place blocks, create paragraphs and embed them, upload images, create views, etc. The possibilities are nearly endless. 

USDA's Farmers.Gov initiative has used update scripts to roll out very large interactive tools with high volumes of blocks and paragraphs that would take hours on end to setup manually. By spending the time on an update script, we've cut down on setup time across our environments and reduced production launch time to just seconds.

Experience Level
Session Track