20
P: 949-230-3594 / ccharlton@stauer.com www.Stauer.com Powerful Drupal Administration Using Drush OCT 25, 2011 EXIT

Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

Embed Size (px)

Citation preview

Page 1: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

Powerful Drupal Administration

Using Drush

O C T 2 5 , 2 0 1 1

EXIT

Page 2: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

2ABOUTME

AUTHOR• Drupal & Flex book (2007)• Drupal Themes on Lynda.com

CONTRIBUTOR• Donate and contribute Drupal code• Level 7 on CertifiedToRock.com • Drupal since 2005

COMMUNITY LEADER• Organizer, Speaker, Volunteer• Teaching since 2007

SENIOR CONSULTANT• Stauffer.com (based in L.A.)• PHP/Drupal• Web Architecture & Development

P: 949-230-3594 / [email protected]

Page 3: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

EXIT

3PART#1

Site AliasesPart 1 Part 2 Part 3

STAUFFER NEW MEDIA DEVELOPMENT

P: 949-230-3594 / [email protected]

Page 4: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

EXIT

4BESTPRACTICE

DEVELOPMENT“Dev”

DEV STAGE PROD

STAGING“Stage”

PRODUCTION“Prod” or “Live”

STAUFFER NEW MEDIA DEVELOPMENT

P: 949-230-3594 / [email protected]

Page 5: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

EXIT

5BESTERPRACTICER

TESTING“QA”

QA STAGE PROD

STAGING“Stage”

PRODUCTION“Prod” or “Live”

STAUFFER NEW MEDIA DEVELOPMENT

P: 949-230-3594 / [email protected]

DEVELOPMENT“Dev”

DEV

Page 6: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

EXIT

6ELPROBLEMO

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

Big Problem: Wasted time and energyProblem: Communication confusion

Problem: Unfriendly interface

> drush long-command --url=example.com --not-fun --complex --hard-to-read=TRUE --wish-this-was-easier --FML

My “Dev” or your “Dev”?

Wait! You have your own “Dev”?

drupal

example.com

example.local

dev.example.com

stage.example.com

old.example.com

beta.example.com

Page 7: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

7

P: 949-230-3594 / [email protected]

We nickname projects.We nickname clients.We nickname environments.

Page 8: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

8

P: 949-230-3594 / [email protected]

We nickname our sites

Page 9: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

9

P: 949-230-3594 / [email protected]

Drush Site AliasesAllow nicknames to be recognized for Drupal sites and their settings.

Page 10: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

10

P: 949-230-3594 / [email protected]

$ drush @dev status

... is the same as...

$ drush --root=/path/to/drupal --uri=dev.example.com status

Page 11: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

EXIT

11IMMEDIATEGAIN

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

Convenience*Standards*SpeedShareArchive

*some assembly required

Page 12: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

12DEFAULTALIASES

P: 949-230-3594 / [email protected]

@self

default

Page 13: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

13MYALIASES

P: 949-230-3594 / [email protected]

@selfdefault@project_1@project_1.dev@project_1.qa@project_1.stage@project_1.prod

Page 14: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

14LISTALIASES

P: 949-230-3594 / [email protected]

drush sa

Page 15: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

15CONFIGSETTINGS

P: 949-230-3594 / [email protected]

Start with...uri = site domaindb-url = database connection string root = path to Drupalremote-host = remote IP or hostname

Then move onto...path-aliases (%dump_dir, %files, %custom)parent

Page 16: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

16NEWALIASES

P: 949-230-3594 / [email protected]

drush sa @self --full --with-optional

Page 17: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

17

P: 949-230-3594 / [email protected]

1./etc/drush2. In the drush folder3. Inside an ‘aliases’ folder within the drush folder4.$HOME/.drush

5. Inside the Drupal ‘sites’ folder

Alias file name saved as:1.ALIASNAME.alias.drushrc.php2.aliases.drushrc.php3.GROUPNAME.aliases.drushrc.php

ALIASDETECTION

Page 18: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

18ADVANCEDUSES

P: 949-230-3594 / [email protected]

// Easy database syncing!drush sync @qa @stage

// Easy file syncing!drush rsync @stage @prod

Page 19: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

STAUFFER NEW MEDIA DEVELOPMENT

EXIT

19DOCUMENTATION

P: 949-230-3594 / [email protected]

drush help sa

drush docs-aliases

Basic help

Detailed docs & example code

www.drush.org

Page 20: Site Aliases: Powerful Drupal Administration Using Drush by Chris Charlton

P: 949-230-3594 / [email protected]

THANKYOUATTEND FUTURE MEETUPS FOR PARTS 2&3

EXIT

STAUFFER NEW MEDIA DEVELOPMENT NowHiring