• No results found

Drupal version control and deployment techniques. ENTICE meeting David Martín Clavo GS-SMS 30 th Sept. 2010

N/A
N/A
Protected

Academic year: 2021

Share "Drupal version control and deployment techniques. ENTICE meeting David Martín Clavo GS-SMS 30 th Sept. 2010"

Copied!
19
0
0

Loading.... (view fulltext now)

Full text

(1)

Drupal version control

and deployment techniques

ENTICE meeting David Martín Clavo

(2)

TOC

0. The Problem

1. Features

(3)

0. The Problem

● How to keep track of the changes?

● How to deploy changes from a development environment to a production environment?

(4)

0. The Problem

● First solution: dump the database to a text file and apply version control to it.

● Issues:

o Configuration and content are mixed:

– Configuration: CCK, Views, Blocks... – Content: nodes

o If we deploy to production, we get the new Views /

(5)

1. Features

Introduction

Features is Drupal a module that:

o Allows to export configuration items from the

Drupal DB into code.

o Allows to import code into configuration in the DB. o Has a poorly chosen name...

(6)

1. Features

Introduction

● Many things can be exported / imported: views, CCK content types, CCK fields, menus,

blocks...

Things are exported into features. A feature is a folder with code files, similar to a module.

A feature can contain different types of

configuration items (e.g. 2 content types with their fields, and 3 views).

(7)

1. Features

Exportables

Exportables are things that can be moved 100% to code:

o Views

o Imagecache presets.

o Ctools: Panels and OpenLayers o Rules

o Blocks (with help of Context module)

(8)

1. Features

Faux-exportables

Faux-exportables: cannot be moved but can be synchronized:

o CCK (better with Features+Strongarm modules):

– Content types – Fields

– Field groups

o Roles & Permissions o Menus

o Vocabularies (but not its terms)

o Nodes, terms and users: experimental state.

Faux-exportables can be overriden in the DB, and the Features

(9)

1. Features

Benefits

Helps organizing a complex project.

Exported features can be version controlled.

features can be shared with other people.

features can be deployed.

features can be hosted in a feature server

features help upgrade from Drupal 6 to Drupal 7.

features can be reused between projects.

If a site admin overrides a feature and something

(10)

1. Features

Integration with drush

● drush: command line tool for Drupal:

o drush dl: download core.

o drush dl cck views: download contributed projects. o drush en content views: enable modules.

o drush cc (all): clear cache.

● Integration with Features module:

o drush fl : list all the features in a site.

o drush fu : update the code of the features from the

(11)

1. Features

How to use

Install and enable Features, Strongarm and

CTools modules (CTools is a dependency of Strongarm).

In admin/build/features, create a feature by

selecting what components to include in it

o Add the “content type” before adding CCK fields.

● We obtain a .tar.gz file.

● Unzip it into sites/all/modules of another site. ● In admin/build/features of the other site,

(12)

1. Features

DEMO

● 2 sites: development and production

● Sites have CCK, Views, Features, Strongarm installed.

● A CCK content type with fields and a couple Views already created.

● We export them into a feature.

(13)

1. Features

Conclusion

Apply version control to features to keep track of

changes in your Content Types, Views...

drush helps: use drush fu to automatically

update a feature's code before committing.

Use features to deploy changes from

development to production without squashing the content.

git is recommended as VC system, but not compulsory

(14)

2. Other tools & techniques

Controller feature / module

● Some changes cannot be exported to features,

e.g. enabling / disabling modules.

● Technique: we write an empty module / feature

and we implement the hooks:

o hook_install

o hook_uninstall

o hook_update_N

– Used by other devs when they update from the version

(15)

2. Other tools & techniques

Installation profiles

● Code that gets executed when Drupal gets installed with install.php.

● Declares which modules are active.

● Custom code: initial configuration, interaction with the admin.

(16)

2. Other tools & techniques

Makefiles and drush make

● Drupal makefile: flat text file that declares what a

Drupal site is made of (i.e. a manifest): modules, themes, features, patches.

● .make files get executed by drush make

● Useful for:

o Knowing what is exactly on a site. o Building / rebuilding a site.

(17)

2. Other tools & techniques

Aegir

● A Drupal application that can monitor, deploy, and upgrade other Drupal sites.

● Allows mass deployment, updates, etc. ● Helps with the development > staging >

production workflow.

● Different Aegir users can have permissions to manage different remote sites.

(18)

Other DrupalCon sessions

● Attended module development training.

● Connecting Drupal with external systems: best practices.

● Debugging Drupal. ● Drupal performance.

(19)

Thanks :) Questions?

?

ENTICE meeting David Martín Clavo

References

Related documents

There is one more twist here because we collected these new data after the original Trial dataset was created we need to either add the individual data points to Trial or we can

A great deal of research into the depths of the ocean has been carried out using the submersible Alvin, a craft that can carry three people down to a depth of 4,500

Educational groups can schedule tours, and members of the public can enjoy Cracker Country during the annual Florida State Fair or during select special events..

It then analyses the impact of regional integration on member countries based on traditional and new trade theories (Section IV), and reviews empirical findings (Section V)..

8141 or 8142 Install the fresh air ventilator to the return side of the HVAC system and wire the control to turn on the system’s fan with ventilation to ensure good air mixing in

The immense potential for historians o f nineteenth-century Buganda was made clear through their efforts; at the same time, on a wider regional level, a number

Positioning of the controller plays an important part in controlling the air-conditioning efficiently by reducing operation times.. Many controllers are equipped with return

Investigating Environmental Migration and Other Rural Drought Adaptation Strategies in Baja California Sur, Mexico..