Managing Drupal with Aegir
Chris BurgeBurge Consulting, LLC
30 June 2013Dublin, IrelandDrupal Dev Days
Creating a New Site• Create directory space (& deal with permissions)• Deploy codebase (& deal with permissions)• Configure Apache• Restart Apache• Create database• Create database user• Assign database permissions• Enter database credentials into settings.php• Run Drupal installer
What is Aegir?
“The Aegir hosting system allows developers and site administrators to automate many of the common tasks associated with deploying and managing large websites. Aegir makes it easy to install, upgrade, deploy, and backup an entire network of Drupal sites.”
Source: http://www.aegirproject.org/
What is Aegir?
“The Aegir hosting system allows developers and site administrators to automate many of the common tasks associated with deploying and managing large websites. Aegir makes it easy to install, upgrade, deploy, and backup an entire network of Drupal sites.”
Source: http://www.aegirproject.org/
Aegir Basics• Server
– Web server (Apache)– Database server (MySQL)
• Platform– Drupal 6.28– Drupal 7.22
• Site– blog.chrisburge.net
• Client– Somewhat similar to a role– Day Cloud Studios (daycloudstudios)– Two users, lhunt and mvassios, are assigned to
‘daycloudstudios’ client
Web Server
Platform Platform
SiteA
SiteB
SiteC
SiteD
Web Server
Platform Platform
SiteE
SiteF
SiteG
SiteH
Web Server
Platform Platform
SiteA
SiteB
SiteC
SiteD
Database Server
Web Server
Platform Platform
SiteE
SiteF
SiteG
SiteH
Database Server
Web Server
Platform Platform
SiteA
SiteB
SiteC
SiteD
Database Server
Web Server
Platform Platform
SiteE
SiteF
SiteG
SiteH
Database Server
Installation
1. Install system requirements
# yum install httpd php php-mysql php-cli php-gd php-process sudo rsync git postfix mysql-server
2. Create user ‘aegir’ and add to group ‘apache’
# useradd --home-dir /var/aegir aegir# gpasswd -a aegir apache# chmod -R 755 /var/aegir
Installation
3. Create Apache configuration file symlink # ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
4. Grant ‘aegir’ permission to restart Apache– Open ‘sudoers’ file
# visudo
– Insert configuration below:
Defaults:aegir !requirettyaegir ALL=NOPASSWD: /usr/sbin/apachectl
Installation
5. Install Drush
# pear channel-discover pear.drush.org# pear install drush/drush-4.5.0
6. Become user ‘aegir’
# sudo –u aegir –i
Installation
7. Install provision– Provision is the backend of Aegir
# drush dl --destination=/var/aegir/.drush provision-6.x
8. Install hostmaster– Hostmaster is the frontend of Aegir
# drush hostmaster-install
(Hostmaster is a Drupal profile and runs on Drupal 6.x)
Make Files; Drush Make (http://drupal.org/project/drush_make)api = 2core = 7.x
; Drupal core
projects[drupal][type] = coreprojects[drupal][version] = 7.22
projects[wysiwyg][subdir] = contribprojects[wysiwyg][version] = 2.2
projects[views][subdir] = contribprojects[views][version] = 3.7projects[views][patch][1744478] = http://drupal.org/files/views-fill_up_single_row-1744478-8.patch
Make Filesprojects[views_php][subdir] = contribprojects[views_php][type] = moduleprojects[views_php][download][type] = gitprojects[views_php][download][url] = http://git.drupal.org/project/views_php.git;projects[views_php][download][branch] = 7.x-1.xprojects[views_php][download][revision] = 2b5ed52228394ee3c8e8c86be283da957cdfa6f6
; CKEditor 3.6.2libraries[ckeditor][download][type] = filelibraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.6.6/ckeditor_3.6.6.tar.gz"libraries[ckeditor][directory_name] = ckeditorlibraries[ckeditor][type] = library
Custom Hooks
• Aegir provides hooks
• E.g. add MemCache config to settings.php
• Create file customhook.drush.inc in /var/aegir/.drush
function customhook_provision_drupal_config($uri,$data) {if($uri==”aegir.chrisburge.net") {
return NULL;}### Memcache## Make a unique key for a site (special character not permitted)$unique = str_replace('.','',str_replace('-','',$uri));$returnArray [] = "### Memcache ###\$conf['cache_backends'][] =
'sites/all/modules/contrib/memcache/memcache.inc';// the path to the core cache file
include_once('./includes/cache.inc'); // the path to the memcache cache file include_once('./sites/all/modules/contrib/memcache/memcache.inc'); // make MemCacheDrupal the default cache class \$conf['cache_default_class'] = 'MemCacheDrupal'; # Key Prefix: edit this for multisite use. \$conf['memcache_key_prefix'] = \"$unique\"; \$conf['memcache_servers'] = array( '127.0.0.1:11211' => 'default', );
\$conf['memcache_bins'] = array( 'cache' => 'default', ); ”;return $returnArray;}
Links
• Aegir– http://www.aegirproject.org/– http://community.aegirproject.org/– http://drupal.org/project/provision– http://drupal.org/project/hostmaster
• Drush– http://drush.ws/– http://drupal.org/project/drush– http://drupal.org/project/drush_make
Top Related