managing multisite: lessons from a large network

24
Managing Multisite Lessons from a Large Network William Earnhardt - @earnjam WordCamp Raleigh November 9, 2014

Upload: william-earnhardt

Post on 20-Aug-2015

850 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Managing Multisite: Lessons from a Large Network

Managing MultisiteLessons from a Large Network

William Earnhardt - @earnjam

WordCamp RaleighNovember 9, 2014

Page 2: Managing Multisite: Lessons from a Large Network

Single Site vs MultisiteSingle Site Multisite

One WordPress Install ✓ ✓

One Database ✓ ✓

Supports Themes ✓ ✓

Supports Plugins ✓ ✓

Number of Websites 1 Unlimited*

*Only limited by system resources

Page 3: Managing Multisite: Lessons from a Large Network

The 7 Minute Install

Step 1: Do the famous “5 Minute Install”

Step 2: Add this to wp-config.php

Step 3: Go to Tools > Network Setup

and follow instructions.

Page 4: Managing Multisite: Lessons from a Large Network

Pros & Cons of MultisitePros:• Updates

• Reusability of code

• Shared Database

• Security

• Messaging

• Single Sign-On

Cons:• Updates

• Reusability of code

• Shared Database

• Security

• Single Point of Failure

Page 5: Managing Multisite: Lessons from a Large Network

Should You Use Multisite?

Absolutely• A group of related sites

• Need to allow users to create new sites

Probably Not• Unrelated client sites

Page 6: Managing Multisite: Lessons from a Large Network

WordPress at Carolina

Web.unc.eduSelf service web publishing for

Carolina faculty, staff, and

students.

Sites.unc.eduEnterprise web platform for

divisions, departments, schools,

and more.

Page 7: Managing Multisite: Lessons from a Large Network

• www.unc.edu

• Departments

• Divisions

• Schools

• Campus Units

• Centers

• Institutes

• Research Labs

• Programs

• Collaborations

• Student Organizations

• Greek Community

• Instructional

Resources

• Services

• Faculty CVs

• Portfolios

And Much, Much

More!

What Kind of Sites?

Page 8: Managing Multisite: Lessons from a Large Network

How big is “big”?

8,500 Sites

77,000

Users

Page 9: Managing Multisite: Lessons from a Large Network

How big is “big”?

243 Themes

140 Plugins

Page 10: Managing Multisite: Lessons from a Large Network

Infrastructure

Varnish• Bypassed for logged in users• Cache purging handled via custom plugin

3 Apache Webservers

NFS mounted shared file system • WordPress Core, themes, plugins, uploads, etc

2 MySQL servers • Replication/Hot spare• Full DB backups daily with point-in-time recovery

available from binary logs

Our Setup:

Page 11: Managing Multisite: Lessons from a Large Network

InfrastructureOngoing Challenges/Lessons:

Varnish• Cache invalidation is hard

NFS• A single file system is simple, but not as fast

Apache• You should probably just should use NGINX

Database• Our databases are huge• Explore using HyperDB, or purge unused sites/tables/rows

Page 12: Managing Multisite: Lessons from a Large Network

Plugins & Themes

“I’ll just use this plugin”

http://devpractic.es/post/98877425141/ill-just-use-this-plugin

Page 13: Managing Multisite: Lessons from a Large Network

Selecting Themes & PluginsLicensing

• GPLv2 or compatible?• Per Domain?

Updates & Notifications• Wordpress.org vs External Repositories• Notifications only when activated

Things to Watch Out For• SHOW TABLES LIKE• switch_to_blog()• get_plugins()• eval()

WordPress.com VIP standards• http://vip.wordpress.com/documentation/code-review-what-we-

look-for/

Page 14: Managing Multisite: Lessons from a Large Network

Selecting Themes & PluginsOngoing Challenges/Lessons:

Size of the codebase• Keep it simple• Only add what you truly need

Deprecate old plugins and themes• Over 2 years since last update? Find a replacement

Be picky about your plugins and themes• Thoroughly review the code• Is it in active development?• How is the support?

Page 15: Managing Multisite: Lessons from a Large Network

Security

Single Site = Multisite

No FTP

Thoroughly Review Themes & Plugins

Super Admins• Limit who/how many• Set them in code with an MU Plugin

Update, Update, Update!

Page 16: Managing Multisite: Lessons from a Large Network

Security

Page 17: Managing Multisite: Lessons from a Large Network

Tools!Splunk• Insight into your logs

• Reporting, Alerts, etc.

• We use for PHP, Apache & ModSecurity

• Free version lets you index up to 500MB of data per day

Page 18: Managing Multisite: Lessons from a Large Network

Tools!AppDynamics• Service monitoring

• Average response times

• Full call stack

• Free version stores data for last 24 hours

Page 19: Managing Multisite: Lessons from a Large Network

Tools!AppDynamics

Page 20: Managing Multisite: Lessons from a Large Network

Tools!AppDynamics

Page 21: Managing Multisite: Lessons from a Large Network

Tools!Query Monitor• Built by John Blackbourn, current WP 4.1 development

lead

• Deep insight into each page load

Multisite Specific Plugins• Multisite Plugin Manager

• Multisite Privacy Plugin

• WordPress MU Domain Mapping

• Network Manager Tools

Page 22: Managing Multisite: Lessons from a Large Network

Tools!Version Control• Git - Stash (Atlassian)• Full infrastructure builds of wp-content directory• Custom & 3rd party Themes/Plugins handled via

submodules

Local Development with Vagrant• Customized version of VVV Apache• Builds out 3 multisite environments

PHPStorm• PHP Storm 8 has full WordPress support• Xdebug• Database Connections• Version Control

Page 23: Managing Multisite: Lessons from a Large Network

TakeawaysKeep it simple!• Use as few themes/plugins as you truly need

• For open network, find add-ons that get your users 90%

there

Think long term• Each decision you make will affect a lot of sites/users

down the road

• The longer something is in place, the harder it is to change

Page 24: Managing Multisite: Lessons from a Large Network

Questions?