37
THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

Embed Size (px)

Citation preview

Page 1: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Aegir Hosting SystemOne Drupal to Rule Them All

COLLEGE OF ENGINEERING

Page 2: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Agenda: Aegir Hosting System

• Introduction– Challenges maintaining sites– How Aegir can help

• Using Aegir– Core components– Servers, sites, and platforms– Live demo

• Advanced Topics– Details– Gotchas– Awesomeness– References

Page 3: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro: Aegir Hosting System

Aegir @ Ohio State University– 3-4 known Aegir instances– 300+ sites in Aegir and rapidly growing.

My Experience– Almost 2 years starting with 0.4– Written some internal extensions.– 100+ sites

Why Aegir?– Encourages some best practices.– Order of magnitude efficiency savings with

high volumes of sites.– Works for few or many sites

(once you understand it).

Page 4: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Challenges: Create a Site from Scratch

1. Create a database

2. Create a database user

3. Copy Drupal files out to a web server

4. Set appropriate file permissions

5. Configure Apache

6. Run Drupal installer

Page 5: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Challenges: Upgrade a Site

1. Take site offline (maintenance mode)

2. Make a backup

3. Update files

4. Run update.php

5. Apply any manual configuration changes.

6. Take site out of maintenance mode.

Page 6: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Challenges: Other Concerns

1. Testing changes

2. Staging environments

3. Regular backups

4. Software audits5. Repeatable deployments6. General administration

Page 7: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Challenges: Options

• Maintain by hand– You manage everything– Easy to start out– Doesn’t scale well

• Become a Drush ninja– You manage everything

Now with scripts!– Scales as well as you

• Use Aegir– Setup requires knowledge– Novice can manage sites– Expert can use Drush-fu– Encourages best practices

Page 8: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Challenges: #Drupal Sites vs Cost to Sanity

Page 9: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Aegir: One Drupal to Rule Them All

Aegir can manage• Apache, Nginx• MySQL• Drupal sites & platforms• Upgrades• Backups

But wait, there’s more!• Free Drush CLI!• Learn best practices!• So easy, anyone can use!• Now midi-chlorian free!

Page 10: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Aegir: Hosting - a website to manage websites

Page 11: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Intro | Aegir: Provision - Drush extension backend

Sh-3.2$ drush | grep provision

provision-backup Generate a back up for the site.provision-backup_del Delete a backup file.provision-clone Clone a site between platforms.provision-delete Delete a site.provision-deploy Deploy an existing backup to a new url.provision-disable Disable a site.provision-enable Enable a disabled site.provision-import Import site to provisionprovision-install Provision a new site using the provided data.provision-lock Lock a platform from having any other sites.provision-login_rese Generate a one-time login reset URL.provision-migrate Migrate a site between platforms.provision-restore Restore the site to a previous backup. provision-save Save Drush aliasprovision-unlock Unlock a platformprovision-verify Verify the framework is correctly installed. provision-zone Manipulate a zonefile

Page 12: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Servers: Web or Database

Web Servers• Apache• Nginx

Database• MySQL

Servers have:• IP Address(es)• Port(s)• Credentials• Etc

Page 13: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Servers: Web or Database

Page 14: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Platforms: Root of a Multi-Site Install

OpenAtrium-rc1• puppies.com• kittens.org

OpenPublic-beta1• billthecat4pres.com• toonces4gov.com

A platform can have multiple sites but can reside only on one web server.

Page 15: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Platforms: Create a Platform

http://www.youtube.com/watch?v=A_QIvMLoouI

Page 16: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Sites: Your Websites

OpenAtrium-rc1 @ server1

• puppies.com• kittens.org

OpenPublic-beta1 @ server2

• billthecat4pres.com• toonces4gov.com

Sites are tied to a DB server and platform. The platform determines which web server the site runs on.

Page 17: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Sites: Create a Site

http://www.youtube.com/watch?v=jbJefaWUE-0

Page 18: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Migrations: Upgrade One or Many Sites

1. Create a new platform with the upgraded code.2. Migrate sites (or entire platforms) to the new platform.

Open Atrium Beta 2

Site 1

Site 2

Site 3

Open Atrium Beta 2

Page 19: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Upgrades: Upgrade One or Many Sites

http://www.youtube.com/watch?v=KD5KQTkj4Lk

Page 20: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Backups: Manual and Automatic

• Upgrades and other actions automatically create backups.• You can manually create/restore backups from web ui.• Backups are stored locally (/var/aegir/backup)• You can restore backups to another Aegir instance (with a

little work)

Page 21: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Backups: How to Backup / Restore a Site

http://www.youtube.com/watch?v=YCIRmtf_RV4

Page 22: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Using Aegir | Cloning: Make a copy of your site

• Works just like an upgrade/migration.• Great way to test a migration.• Can be a way to get a test copy of a site.

Page 23: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Migrate+Rename/Cloning: Under the Hood

When we migrated/cloned from puppies.com to the-puppy.com… How did this…

<img src=“/sites/puppies.com/files/vienna-sausages.png”>

Get changed to this…

<img src=“/sites/the-puppy.com/files/vienna-sausages.png”>

Aegir fixes some content programmatically.

It also adds this alias/files/vienna-sausages.png

Page 24: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Hooking In: vhost configuration

Aegir regenerates your vhost configuration (all the time).

/var/aegir/.drush/<whatever>.drush.inc

<?php  function <whatever>_provision_apache_vhost_config($uri, $data) {    if ($uri == “abc.com") {      return array("php_value upload_max_filesize 100M", "php_value post_max_size 200M");    }  }?>

See also pre.d and post.d vhost configurationhttp://community.aegirproject.org/node/341

Page 25: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Hooking In: settings.php

Aegir regenerates your settings.php file (all the time).

This file is included at the end of your Aegir controlled settings.php/var/aegir/platforms/sites/<yoursite>/local.settings.php

For example, you might want to configure a maintenance theme.

<?php $conf['maintenance_theme'] = 'themeName'; ?>

Page 26: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Installation: Easy or Hard

Vanilla Aegir

• If you use Ubuntu/Debian, you can use apt-get.http://community.aegirproject.org/node/400

• If you use RHEL/Centos/etc, you can use the manual instructions.It’s pretty well documented, but budget a couple hours.http://community.aegirproject.org/installing/manual

Omega8cc Alternatives to Vanilla (on d.org/projects)

BarracudaBarracuda is a bash script to install and/or upgrade, tuned for high performance, Aegir Master Instance with all related system services. 

OctopusOctopus is a bash script to install and/or upgrade, tuned for high performance, Aegir Satellite Instances, compatible with Barracuda

Page 27: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Gotchas: Multi-Server Architecture

Hub Spoke Model

Master Server• Has a copy of everything (sort of).• Migrations go through it.

- Web Server 1- Platform A

- Site 1

- Web Server 2- Platform B

Page 28: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Gotchas: Multi-Server $#@! Data Loss

There is a long standing data loss bug in which the files directory on the hub sometimes overwrites data on the spoke.

There are various patches in the issue queue none of which quite work.

We solved it by hacking our Aegir instance to rsync files from the spoke to hub prior to many other actions.

Bug Reporthttp://drupal.org/node/1083366

Why! Why was I programmed to feel pain?

Page 29: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Gotchas: Site Specific Modules/Themes

Site-specific modules/themes not super well supported in multi-server.

The original recommendation was to make a site specific install profile and put them there.

At some point they made the hub the authority but this doesn’t work with things like apps so it’s still debated.

Bug Reporthttp://drupal.org/node/1561102

Page 30: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Gotchas: Multi-Server Cron Runs Where?

Cron can run two ways:• Wget (on spoke)• Drush (on hub)

If your cron works with files (creating, updating, reading), you can’t use drush via Aegir in a Multi-Site environment.

Feature Request Aegir 2.0http://drupal.org/node/1080758

Page 31: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Gotchas: Security

Traditional mod_php issues apply.In addition…

Aegir user has access to all sites/dbs/web-roots/servers.

Site X’s code can run as Aegir user• hook_init• drush.inc• etc

Bug Reporthttp://drupal.org/node/762138

Provision ACL helpshttp://drupal.org/project/provisionacl

Page 32: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Awesomeness: SaaS Business Models

Couples buy a wedding website. Order page is an Aegir signup form. Purchase immediately provisions a new site.

Blog post on it.http://scotthadfield.ca/2010/06/15/overview-site-building-wedful-drupal-install-profiles-aegir-and-features

Clients purchase subscriptions to Open Atrium instances which are deployed through Aegir.

DrupalCon London Talkhttp://london2011.drupal.org/conference/sessions/aegir-based-business-models

Writeup:http://community.openatria.com/team/saas-business-model

Page 33: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | Awesomeness: Continuous Integration

Mig5 (an Aegir developer) has a wonderful tutorial on continuous integration with Jenkins and Aegir.

Also, Mike Butsko (OSU ASC tech) presenting on Jenkins later today and he uses Aegir too.

http://mig5.net/content/zero-touch-drupal-deployment-jenkins-aegir-git-fabric-and-drush.html

Page 34: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | References: Aegir Vendors

All vendors on this page are core Aegir developers.

Koumbit provides upper end Aegir IaaS and SaaS solutions (in addition to development and traditional web hosting.

Omega8.cc specializes more in Aegir. Their offering is very slick and arguably the cheapest/fastest way to get into Aegir.

Mig5 offers consulting services. He’s probably the best company in Aegir consulting and can help with things like dev-ops workflows.

Page 35: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | References: Other Aegir Tricks

Clientshttp://community.aegirproject.org/node/28

SSL keys and certificateshttp://community.aegirproject.org/content/content/administrator/post-install-configuration/using-ssl

Aegir can manage DNS zonefileshttp://community.aegirproject.org/administrator/dns

Aegir notes on Varnish and Memcachehttp://community.aegirproject.org/node/388

Page 36: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Advanced | References: Extensions

Ubercart (w\quotas)HTTP basic authHTTP basic LDAPFeedsRulesGitSubfoldersBackup Garbage CollectionServicesPuppet

Remote ImportVarnishBoostACLsCivilCRMKoumbit PlatformsCDN New RelicEtc…

More here….http://community.aegirproject.org/contrib-modules

Page 37: THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING Aegir Hosting System One Drupal to Rule Them All COLLEGE OF ENGINEERING

THE OHIO STATE UNIVERSITY COLLEGE OF ENGINEERING

Questions:

What questions do you have?