Managing Drupal with Aegir Chris Burge Burge Consulting, LLC 30 June 2013 Dublin, Ireland Drupal 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
Enter Aegir
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:
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:
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
Aegir Basics
Web Server Platform Site A Site B Site C Site D Web Server Platform Site E Site F Site G Site H
Web Server Platform Site A Site B Site C Site D Database Server Web Server Platform Site E Site F Site G Site H Database Server
Web Server Platform Site A Site B Site C Site D Database Server Web Server Platform Site E Site F Site G Site H Database Server
Servers
Platforms
Sites
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 !requiretty aegir ALL=NOPASSWD: /usr/sbin/apachectl
Installation 5.Install Drush # pear channel-discover pear.drush.org # pear install drush/drush 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)
Aegir Web Interface
Creating a Platform
Make Files ; Drush Make ( api = 2 core = 7.x ; Drupal core projects[drupal][type] = core projects[drupal][version] = 7.22 projects[wysiwyg][subdir] = contrib projects[wysiwyg][version] = 2.2 projects[views][subdir] = contrib projects[views][version] = 3.7 projects[views][patch][ ] =
Make Files projects[views_php][subdir] = contrib projects[views_php][type] = module projects[views_php][download][type] = git projects[views_php][download][url] = ;projects[views_php][download][branch] = 7.x-1.x projects[views_php][download][revision] = 2b5ed ee3c8e8c86be283da957cdfa6f6 ; CKEditor libraries[ckeditor][download][type] = file libraries[ckeditor][download][url] = " libraries[ckeditor][directory_name] = ckeditor libraries[ckeditor][type] = library
Creating a Platform
Viewing Packages on a Platform
Creating a Site
Managing a Site
Migrating a Site
Cloning a Site
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( ' :11211' => 'default', ); \$conf['memcache_bins'] = array( 'cache' => 'default', ); ”; return $returnArray; }
Other Features
Links Aegir – – – – Drush – – –
Questions?