SlideShare une entreprise Scribd logo
1  sur  30
Using multi-tenant WordPress to
simplify development
(among other things)
About Me
• WordPress dev at WashU since December 2011
• “Professional code monkey, amateur grease monkey.”
• WordCamp STL organizer
• Luckiest WordPress dev in the world!
About Me
December 2011
• 0 WordPress sites
• 1,000s of SharePoint sites
(OK, maybe an exaggeration but who cares about SP)
• 3 Devs
July 2013
• 100s of WordPress Sites hosted locally
• 100s of WordPress Sites hosted on CampusPress
• 0 SharePoint sites
(OK, maybe an exaggeration but who cares about SP)
• >25 Devs, designers, content strategists, project managers, etc…
WordPress@WashU
In the beginning…we coded every site like it was the only site we
were doing, which meant:
• Blank Slate: we didn’t even use Bootstrap
• No Plugins: wrote all functionality
into the theme
• No Version control: ¯_(ツ)_/¯
• No Access: WP Easy Uploader FTW (?)
WordPress@WashU
Since then, we’ve gotten smarter:
• Unified theme: one theme for CP, Med School, and Main Campus
• SO Many plugins: 34 on medicine
(but only 17 on wustl.edu)
• SO Much version control: GitHub,
Bitbucket, BitBucket server
• No Access: Still no SFTP/SSH access,
but that’s OK
WordPress@WashU
While we may have a unified theme, there are still “one off”s that
we handle, plus child themes and legacy sites.
We have over 30 “in-house” plugins that are used on at least one
site.
Multiply X by Y and you just get a headache
Developing for WordPress@WashU
First attempt – let’s not talk about that
Second attempt – Symlinks to Symlinks in Symlinks (OK, maybe not THAT bad)
Third (and so far final) attempt – Multitennant!!!
Developing for WordPress@WashU
WPCampus 2016
Sarasota, FL
…my parent’s just moved to Bradenton…
…I can crash on their couch…
…If I only need to get the cost of the ticket approved…
…HOLY COW, I’M IN FLORIDA!!!
…but first a story
“ ‘..a software architecture in which a single instance of software
runs on a server and serves multiple tenants…’
-the Internet”
-Mike Corkum
Multitenant 101
Multitenant ≠ Multisite
• Per site wp-config file
• Multiple Databases vs
Single Database
• One set of core files,
independent uploads
(or entire wp-content folder)
Multitenant 101
N.B. I came up with the term “landlord” to describe the main set of
WordPress Core files
Multitenant 101
• April 2014 - WordPress 3.9 introduced symlinking for plugins
which was the final component needed for general use
• There were articles and “hacks” to do it before, but don’t be this
guy:
Multitenant 201
Or this
guy
Multitenant 201
WP Core files Database #2Database #1
Site #3Site #3Site #3
Symlink
wp-config DB
settings
Confused Yet?
Multitenant 201
(I apologize for our lack of hammocks)
Using VVV – create vvv-custom.yml and copy-and-paste this:
sites:
<your_site_name_here>:
repo: https://github.com/coderaaron/mtv-vvv-site.git
hosts:
- <your_site_domain_here>.dev
Multitenant How-to
But only one site isn’t that much fun, try this:
sites:
<site1_name_here>:
repo: https://github.com/coderaaron/mtv-vvv-site.git
hosts:
- <site1_domain_here>.dev
<site2_name_here>:
repo: https://github.com/coderaaron/mtv-vvv-site.git
hosts:
- <site2_domain_here>.dev
Multitenant How-to
sites:
<site1_name_here>:
repo: https://github.com/coderaaron/mtv-vvv-site.git
hosts:
-<site1_domain_here>.dev
<site2_name_here>:
repo:https://github.com/coderaaron/mtv-vvv-site.git
hosts:
-<site2_domain_here>.dev
…
<site99_name_here>:
repo: https://github.com/coderaaron/mtv-vvv-site.git
hosts:
-<site99_domain_here>.dev
Multitenant How-to
ALL DONE!
Multitenant How-to
• Checked to see if there is a landlord
– If not download WordPress Core
– Create a certificate to sign other certificates
• Create database
• Setup symlinks for mu-plugins, plugins, and themes
• Create a certificate and signs it using the landlord’s certificate
• Copies the modified wp-config.php and index.php
• Runs famous “5 Minute Install”
…but what’d that do?
That’s great but I use…
• Local
• DesktopServer
• Lando
• Docker
• Virtual machines
• Good ol’ fashion server
Multitenant How-to
Manual Multitenant how-to
• Install WordPress (no need to do 5 minute install, just need core
files)
– Change wp-config.php to
require$_SERVER['DOCUMENT_ROOT'].'/wp-config.php’;
Manual Multitenant how-to
• If you want to use WP-CLI add this to wp-config.php:
//require_once(ABSPATH. 'wp-settings.php’);
if( '<PATH_TO_LANDLORD>’ == $_SERVER['DOCUMENT_ROOT']) {
$_SERVER['DOCUMENT_ROOT']= getcwd();
}
• Replace <PATH_TO_LANDLORD> with the absolute path to you core files
(i.e. /var/www/wp_core)
Manual Multitenant how-to
• Create a folder (that your server can access) for your uploads
• Inside folder you just created
– Create wp-content folder and uploads
– Create a symlink to folder containing core files (named wp)
Manual Multitenant how-to
• Copy index.php file from landlord
– Inside index.php change
require( dirname( __FILE__ ).'/wp-blog-header.php’ );
to
require( './wp/wp-blog-header.php' );
Manual Multitenant how-to
• Set up wp-config.php as normal (salts, wp_debug, etc)
– Add to wp-config.php:
define( 'WP_HOME', 'https://<YOUR_URL_HERE>’);
define( 'WP_SITEURL','https://<YOUR_URL_HERE>/wp’ );
define( 'WP_CONTENT_DIR',dirname( __FILE__ ) . '/wp-content’);
define( 'WP_CONTENT_URL','https://<YOUR_URL_HERE>/wp-content');
Manual Multitenant how-to
• If you want to use independent themes or plugins folder, create
them here
• If you want to use a unified themes or plugins folder, create
symlinks to their locations
Manual Multitenant how-to
THAT’S IT!!!
https://github.com/coderaaron/WPCampusDemo
Manual Multitenant how-to
• Questions?
• Thank you!
• github.com/coderaaron
• twitter.com/coderaaron
The End

Contenu connexe

Tendances

Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Simplilearn
 

Tendances (20)

Introduction to Docker storage, volume and image
Introduction to Docker storage, volume and imageIntroduction to Docker storage, volume and image
Introduction to Docker storage, volume and image
 
GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)GitHub Actions (Nakov at RuseConf, Sept 2022)
GitHub Actions (Nakov at RuseConf, Sept 2022)
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
 
Start your adventure with docker
Start your adventure with dockerStart your adventure with docker
Start your adventure with docker
 
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
What is Docker | Docker Tutorial for Beginners | Docker Container | DevOps To...
 
Docker introduction (1)
Docker introduction (1)Docker introduction (1)
Docker introduction (1)
 
Midi technique - présentation docker
Midi technique - présentation dockerMidi technique - présentation docker
Midi technique - présentation docker
 
Docker architecture-04-1
Docker architecture-04-1Docker architecture-04-1
Docker architecture-04-1
 
Introduzione a Docker (Maggio 2017) [ITA]
Introduzione a Docker (Maggio 2017) [ITA]Introduzione a Docker (Maggio 2017) [ITA]
Introduzione a Docker (Maggio 2017) [ITA]
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Learn docker in 90 minutes
Learn docker in 90 minutesLearn docker in 90 minutes
Learn docker in 90 minutes
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
Introduction to Docker - IndiaOpsUG
Introduction to Docker - IndiaOpsUGIntroduction to Docker - IndiaOpsUG
Introduction to Docker - IndiaOpsUG
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
 
What is Docker Architecture | Edureka
What is Docker Architecture | EdurekaWhat is Docker Architecture | Edureka
What is Docker Architecture | Edureka
 
Docker in real life
Docker in real lifeDocker in real life
Docker in real life
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Docker introduction &amp; benefits
Docker introduction &amp; benefitsDocker introduction &amp; benefits
Docker introduction &amp; benefits
 
Git slides
Git slidesGit slides
Git slides
 

Similaire à Using multi-tenant WordPress to simplify development

Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
Docker, Inc.
 
WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
Joe Casabona
 

Similaire à Using multi-tenant WordPress to simplify development (20)

Intro to advanced web development
Intro to advanced web developmentIntro to advanced web development
Intro to advanced web development
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
Up and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web DesignUp and Running with WordPress - Site Shack Nashville Web Design
Up and Running with WordPress - Site Shack Nashville Web Design
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote
 
eMusic: WordPress in the Enterprise
eMusic: WordPress in the EnterpriseeMusic: WordPress in the Enterprise
eMusic: WordPress in the Enterprise
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
Save Time by Managing WordPress from the Command Line
Save Time by Managing WordPress from the Command LineSave Time by Managing WordPress from the Command Line
Save Time by Managing WordPress from the Command Line
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
 
Learning to code
Learning to codeLearning to code
Learning to code
 
WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp Montreal
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
WP-CLI - WordCamp Miami 2015
WP-CLI - WordCamp Miami 2015WP-CLI - WordCamp Miami 2015
WP-CLI - WordCamp Miami 2015
 
Modern websites in 2020 and Joomla
Modern websites in 2020 and JoomlaModern websites in 2020 and Joomla
Modern websites in 2020 and Joomla
 
From Zero To WordPress
From Zero To WordPressFrom Zero To WordPress
From Zero To WordPress
 
NEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityNEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & Security
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
 
WordPress Intermediate Workshop
WordPress Intermediate WorkshopWordPress Intermediate Workshop
WordPress Intermediate Workshop
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails Apps
 
Big Websites
Big WebsitesBig Websites
Big Websites
 

Dernier

VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 

Dernier (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 

Using multi-tenant WordPress to simplify development

  • 1. Using multi-tenant WordPress to simplify development (among other things)
  • 3. • WordPress dev at WashU since December 2011 • “Professional code monkey, amateur grease monkey.” • WordCamp STL organizer • Luckiest WordPress dev in the world! About Me
  • 4. December 2011 • 0 WordPress sites • 1,000s of SharePoint sites (OK, maybe an exaggeration but who cares about SP) • 3 Devs July 2013 • 100s of WordPress Sites hosted locally • 100s of WordPress Sites hosted on CampusPress • 0 SharePoint sites (OK, maybe an exaggeration but who cares about SP) • >25 Devs, designers, content strategists, project managers, etc… WordPress@WashU
  • 5. In the beginning…we coded every site like it was the only site we were doing, which meant: • Blank Slate: we didn’t even use Bootstrap • No Plugins: wrote all functionality into the theme • No Version control: ¯_(ツ)_/¯ • No Access: WP Easy Uploader FTW (?) WordPress@WashU
  • 6. Since then, we’ve gotten smarter: • Unified theme: one theme for CP, Med School, and Main Campus • SO Many plugins: 34 on medicine (but only 17 on wustl.edu) • SO Much version control: GitHub, Bitbucket, BitBucket server • No Access: Still no SFTP/SSH access, but that’s OK WordPress@WashU
  • 7. While we may have a unified theme, there are still “one off”s that we handle, plus child themes and legacy sites. We have over 30 “in-house” plugins that are used on at least one site. Multiply X by Y and you just get a headache Developing for WordPress@WashU
  • 8. First attempt – let’s not talk about that Second attempt – Symlinks to Symlinks in Symlinks (OK, maybe not THAT bad) Third (and so far final) attempt – Multitennant!!! Developing for WordPress@WashU
  • 9. WPCampus 2016 Sarasota, FL …my parent’s just moved to Bradenton… …I can crash on their couch… …If I only need to get the cost of the ticket approved… …HOLY COW, I’M IN FLORIDA!!! …but first a story
  • 10. “ ‘..a software architecture in which a single instance of software runs on a server and serves multiple tenants…’ -the Internet” -Mike Corkum Multitenant 101
  • 11. Multitenant ≠ Multisite • Per site wp-config file • Multiple Databases vs Single Database • One set of core files, independent uploads (or entire wp-content folder) Multitenant 101
  • 12. N.B. I came up with the term “landlord” to describe the main set of WordPress Core files Multitenant 101
  • 13. • April 2014 - WordPress 3.9 introduced symlinking for plugins which was the final component needed for general use • There were articles and “hacks” to do it before, but don’t be this guy: Multitenant 201 Or this guy
  • 14. Multitenant 201 WP Core files Database #2Database #1 Site #3Site #3Site #3 Symlink wp-config DB settings
  • 15. Confused Yet? Multitenant 201 (I apologize for our lack of hammocks)
  • 16. Using VVV – create vvv-custom.yml and copy-and-paste this: sites: <your_site_name_here>: repo: https://github.com/coderaaron/mtv-vvv-site.git hosts: - <your_site_domain_here>.dev Multitenant How-to
  • 17. But only one site isn’t that much fun, try this: sites: <site1_name_here>: repo: https://github.com/coderaaron/mtv-vvv-site.git hosts: - <site1_domain_here>.dev <site2_name_here>: repo: https://github.com/coderaaron/mtv-vvv-site.git hosts: - <site2_domain_here>.dev Multitenant How-to
  • 20. • Checked to see if there is a landlord – If not download WordPress Core – Create a certificate to sign other certificates • Create database • Setup symlinks for mu-plugins, plugins, and themes • Create a certificate and signs it using the landlord’s certificate • Copies the modified wp-config.php and index.php • Runs famous “5 Minute Install” …but what’d that do?
  • 21. That’s great but I use… • Local • DesktopServer • Lando • Docker • Virtual machines • Good ol’ fashion server Multitenant How-to
  • 23. • Install WordPress (no need to do 5 minute install, just need core files) – Change wp-config.php to require$_SERVER['DOCUMENT_ROOT'].'/wp-config.php’; Manual Multitenant how-to
  • 24. • If you want to use WP-CLI add this to wp-config.php: //require_once(ABSPATH. 'wp-settings.php’); if( '<PATH_TO_LANDLORD>’ == $_SERVER['DOCUMENT_ROOT']) { $_SERVER['DOCUMENT_ROOT']= getcwd(); } • Replace <PATH_TO_LANDLORD> with the absolute path to you core files (i.e. /var/www/wp_core) Manual Multitenant how-to
  • 25. • Create a folder (that your server can access) for your uploads • Inside folder you just created – Create wp-content folder and uploads – Create a symlink to folder containing core files (named wp) Manual Multitenant how-to
  • 26. • Copy index.php file from landlord – Inside index.php change require( dirname( __FILE__ ).'/wp-blog-header.php’ ); to require( './wp/wp-blog-header.php' ); Manual Multitenant how-to
  • 27. • Set up wp-config.php as normal (salts, wp_debug, etc) – Add to wp-config.php: define( 'WP_HOME', 'https://<YOUR_URL_HERE>’); define( 'WP_SITEURL','https://<YOUR_URL_HERE>/wp’ ); define( 'WP_CONTENT_DIR',dirname( __FILE__ ) . '/wp-content’); define( 'WP_CONTENT_URL','https://<YOUR_URL_HERE>/wp-content'); Manual Multitenant how-to
  • 28. • If you want to use independent themes or plugins folder, create them here • If you want to use a unified themes or plugins folder, create symlinks to their locations Manual Multitenant how-to
  • 30. • Questions? • Thank you! • github.com/coderaaron • twitter.com/coderaaron The End