deployment strategies: managing code, content, and configurations
DESCRIPTION
Most development shops make use of a "development/staging/production" server model. Maintaining code, content, and configurations across multiple environments can be a bit tricky, particularly since drupal doesn't currently provide any native means to separate configuration from content. This session would discuss the various methods to make sure that your development server looks like your production server. We will touch on version control, the backup and migrate module, and the features module, as well as integrating a deployment management software such as hudson or aegir, and how to scale these solutions from a small application to a large enterprise server architecture. Speaker(s): Nick Hepner Experience Level: IntermediateTRANSCRIPT
Nick [email protected]
@NickHepner
Deployment Strategies: Deployment Strategies: Managing Code, Content, and Managing Code, Content, and Configurations Across Multiple Configurations Across Multiple
EnvironmentsEnvironments
Nick Hepner
Nick HepnerNick Hepner• Web Developer since 1998• Drupal since 2005• Enterprise Architect since 2008• Founding and active member Baltimore meetup• Likes: beer• Dislikes: PowerPoint Presentations
IntroductionIntroduction• Standard Deployment Model• Code, Content, Configuration and their workflows• Problems• Scalable Solutions for Drupal 6 & 7
Standard Deployment ModelStandard Deployment Model
Development Staging ProductionLocal
Content Staging
Users
Read Cluster
Static Cache
Memcache
Write Cluster
Apache Solr
Single Sign-On
Development/Deployment/Monitoring/Internal tools
File Share
Code Repository
Development
Staging
Production
81 Servers
ConfigurationConfiguration• Consists of Drupal admin and module settings
and presets.• Imagecache/image styles• Configuration workflow begins on development
servero New modules installedo Existing modules configuredo Content types, fields, and profile structures editedo Database stored stylesheets, php code
Configuration WorkflowConfiguration Workflow
Development Staging ProductionLocal
Configuration
Content Staging
ContentContent• Content workflow begins on the production server• User Content
o User registrationso User generated contento Files and uploadso Social interactions (e.g. Private Msg, Statuses, etc.)o Content managemento Site and user administration
• Officiated Contento News Articleso Press Releaseso Internal Announcements
Content WorkflowContent Workflow
Development Staging ProductionLocal
Configuration
Content
Content Staging
Officiated Content
User Content
ConflictsConflicts• Servers no longer synchronized
o Developers begin developing on different setups
• Data often gets overwritten• Most recent/accurate data set difficult to keep
track of• Dogs, Cats living together
CodeCode• Can be versioned for easy
deployment/management (SVN, Git)• Does not conflict with database changes• Does not include database stored code
Deploying Code With Deploying Code With VersioningVersioning• Deploy to development through “trunk”• Create a tag for deployment to staging• Either reject the tag and fix bugs, or promote it to
production.
Development Staging ProductionLocal
Code RepositoryCode Repository
Code
TrunkTrunk TagsTags
Rejected
Code WorkflowCode Workflow
Non-StartersNon-Starters• Migrate – Intended to be used when moving a site
from another framework, such as Wordpress or Joomla.
• Rsync - *nix command line tool for synchronizing files. Does not allow for proper staging.
Strategies: Strategies: Manual Configuration Manual Configuration ManagementManagement• Developer manually sets configuration options on
all servers• Fine for really small implementations• More than one developer causes issues
Strategies: Strategies: Backup and MigrateBackup and Migrate• Use backup and migrate module to create backup
profile for content and for configuration• Use versioning to move code• Configuration must still be entered manually on
development• Takes some trial and error
Strategies: Strategies: Launch ManagerLaunch Manager• Aegir – Seems to work well for launching initial
site rollouts. Not so much for maintenance updates
• Hudsono Extensive initial configurationo Integrates with version controlo Can script specific updates
Strategies: Strategies: The Three Pronged AttackThe Three Pronged Attack• Typically for enterprise environments• Features• Content Publication• File Share
o Mount files driveo Network-Attached Storage (NAS)o Content Delivery Networks (CDN)
The Three Prong Attack: The Three Prong Attack: FeaturesFeatures• Extracts configurations into code workflow to
avoid database conflicts.• Allows versioning of configuration• Great Documentation and support
o http://drupal.org/node/928026o IRC #drupal-support
• Can manage all configuration exports in this way – not feasible or scaleable.
The Three Prong Attack: The Three Prong Attack: ServicesServices• Publish content to lower environments• OAuth Support
The Three Prong Attack: The Three Prong Attack: FeedsFeeds• Pull content, users, and pretty much anything
exportable by views.• Can use Data module to map data to where it
needs to go.• OAuth Support• Use UUID module when importing to avoid
duplicate content.
The Three Prong Attack: The Three Prong Attack: Synching EnvironmentsSynching Environments• For the love of FSM: BACKUP YOUR DATABASES!!!!• Once content is synched, push dev data• If file share, Backup & Migrate exports
will be automatically available to allenvironments.
• Staging environment pushes will be “easy”. Use B&M “Restore”. Can be used with Drush.
• In production, push during off peak hours, put site in maintenance mode and import data.
• This slide has way too much text… sorry.
The Three Prong Attack: The Three Prong Attack: A Note on the Deploy A Note on the Deploy ModuleModule• Integrates with services. • Essential if a content staging environment exists.• Good for publishing content and approval
workflow• Not built to handle configuration settings, or
multiple workflows.
The Three Prong Attack: The Three Prong Attack: Content DistributionContent Distribution
Dev Stage
Production
Local
Content Staging
UsersContent In
Content Out
Network Drive
Config Export
The Three Prong Attack: The Three Prong Attack: Notable ModulesNotable Modules• Features – Export configuration into code.
o Features Tools – Automates feature downloads, and creates versioned change files.
• Feeds – Import pretty much anything on the web into Drupal.o Feeds xPath Parser – Allows xPath style syntax for XMLo Feeds OAuth – OAuth integration selection for feeds module.o Data – Allows customized data storage and mappings.
• Services – Publish anything in drupalo OAuth – contains a services integration for OAuth authentication.
• Backup and Migrate
QuestionsQuestions
Thank You!Thank You!Nick [email protected]@NickHepner