Talk given on Hoppinger's Drupal deployment automation tool (named Voiture) at the Drupal Tech Talk, 19th May 2011.
Please note the references to all things that 'suck' ... the point was not to complain about the software or issues in question but to raise awareness to the fact that nothing is perfect, that 'good' developers should be critical thinkers and that when you think something 'sucks' it's an opportunity to improve on it somehow :)
5. What is my problem?
Don’t want to develop on a live site
Don’t want to develop and test on the
same site
Don’t want to have multiple
developers working on a single
installation
Don’t want to spend hours/days
manually rolling out and configuring
new functionality
6. I have more
problems...
Don’t click upgrade/install and pray
it works
Don’t want to bugfix a live site at
3am
I’m not a site administrator!
7. I need ...
Multiple developers working on a
project efficiently
Multiple installations of a project
Testable, reproducible rollouts of
new functionality
8. I need ...
Multiple developers working on a
project efficiently
Multiple installations of a project
Testable, reproducible rollouts of
new functionality
I need automation!
10. automated Drupal
deployment?!
this is quite difficult! why?
nobody is offering a complete
solution
11. automated Drupal
deployment?!
this is quite difficult! why?
nobody is offering a complete
solution
interactive site building paradigm
12. automated Drupal
deployment?!
this is quite difficult! why?
nobody is offering a complete
solution
interactive site building paradigm
everything is in the database
13. automated Drupal
deployment?!
this is quite difficult! why?
nobody is offering a complete
solution
interactive site building paradigm
everything is in the database
drush only goes so far?
19. Voiture Requirements
single command installation
single command update (idempotent)
project integrated developer tools
20. Voiture Requirements
single command installation
single command update (idempotent)
project integrated developer tools
everything in source control
21. Voiture Requirements
single command installation
single command update (idempotent)
project integrated developer tools
everything in source control
zero interactive configuration
22. Voiture Requirements
single command installation
single command update (idempotent)
project integrated developer tools
everything in source control
zero interactive configuration
no hacks in core
23. Voiture Limitations
SVN support only
*nix only (Linux & MacOSX)
Seperate D6 & D7 versions
Developers require [cmdline] experience
Click & go not supported
Fixed project structure
project setup & configuration overhead
24. Voiture Capabilities
initialize ‘structural’ data
install/enable project defined
modules (removes all others)
project integrated drush
all site configuration in code
per environment settings
logged `changeset` functionality
extensible bootstrap wrapper
25. Voiture/Drupal
Project Layout
cnf
shared ... config shared by all ‘targets’
targets ... per app-mode/install ‘target’ configs
data
structural_fixtures
sql
inc
class .... custom classes
funcs .... custom function ‘libs’
httpdocs ..... std drupal install + custom settings.php
+ sites/all/*/*
voiture
bin/*/* .. dev and deployment tools
cnf
dfc ...... custom ‘drupal front-controllers’
inc
init . ‘bootstrapping’ include files
26. Drupal Variables
defined in code
easy to edit (unserialized)
overloads whatever is in the DB
variables data lives in
cnf/shared/vars/*.php
28. shared `targets`
contains project / app-mode shared
app.ini + vhost configuration
contains project module list
contains other fun stuff too!
29. SFI (wtf?)
Data that defines the required structure
& entities of your site, think:
★ Nodes (e.g. home page)
★ Menulinks
★ Taxonomy
★ Domains (domains module)
★ Users (admin accounts)
30. Leveraging Features
if it’s not a self-contained module
put it in a feature!
when it doesn’t fit in a feature go
to Voiture!
no inter-dependencies please!
34. index.php
voiture/dfc/index.php
not httpdocs/index.php
uses Alias apache directive
<?php
/**
* Voiture bootstrapping wrapper around drupal
*/
require dirname(__FILE__). '/../inc/init/web.inc.php';
// let drupal do its thing ...
menu_execute_active_handler();
35. Voiture’s update.php
<?php
/**
* Voiture bootstrapping wrapper around drupal
*/
require dirname(__FILE__). '/../inc/init/web-light.inc.php';
if (in_array(DrupalApp::getMode(), array('stage', 'prod'))) {
if (!DrupalApp::isCLI() && !headers_sent())
header('Location: '.strip_tags($_SERVER['HTTP_HOST']));
exit;
}
/**
* Global flag indicating that update.php is being run.
*
* When this flag is set, various operations do not take place, such as invoking
* hook_init() and hook_exit(), css/js preprocessing, and translation.
*/
define('MAINTENANCE_MODE', 'update');
function update_selection_page() {
drupal_set_title('Drupal database update');
$elements = drupal_get_form('update_script_selection_form');